- chk_atstar: if we see "$*" don't note that we saw $@ unless
expand_no_split_dollar_star is unset. This is what param_expand
does
+
+ 3/18
+ ----
+lib/readline/misc.c
+ - rl_get_previous_history: if we are trying to go back from the
+ beginning of the history, or if we are trying to go back before the
+ beginning of the history, call _rl_free_saved_history_line to just
+ get rid of the history line we saved instead of using
+ rl_maybe_unsave_line, which modifies the current line buffer.
+ Fixes bug reported by lessbug <lessbug@qq.com>
+
+ 3/20
+ ----
+execute_cmd.c
+ - execute_command_internal: save and restore line_number around
+ user_subshell setting it to the line number saved in the command.
+ Fixes bug reported in https://bugzilla.novell.com/show_bug.cgi?id=1128936
+
+ 3/21
+ ----
+lib/sh/strtrans.c
+ - ansicstr: handle multibyte characters that are not preceded by a
+ backslash so we skip over potential escapes in characters whose
+ multibyte representation contains a backslash. Fixes issue reported by
+ Stephane Chazelas <stephane.chazelas@gmail.com>
+
+subst.c
+ - reap_some_procsubs: reap_procsubs, but parameterized to take the
+ max index to check -- general function for future use
+ - reap_procsubs: now just calls reap_some_procsubs with the right arg
+
+execute_cmd.c
+ - execute_command_internal: if we are using /dev/fd for process
+ substitution, reap the procsubs at the end of this function (FIFOs
+ do it at the beginning -- look at this more closely). Only do it
+ for loops to avoid fd exhaustion. Fixes bug reported by
+ sunnycemetery@gmail.com
/* Fork a subshell, turn off the subshell bit, turn off job
control and call execute_command () on the command again. */
+ save_line_number = line_number;
if (command->type == cm_subshell)
line_number_for_err_trap = line_number = command->value.Subshell->line; /* XXX - save value? */
/* Otherwise we defer setting line_number */
stop_pipeline (asynchronous, (COMMAND *)NULL);
+ line_number = save_line_number;
+
if (asynchronous == 0)
{
was_error_trap = signal_is_trapped (ERROR_TRAP) && signal_is_ignored (ERROR_TRAP) == 0;
free ((void *)ofifo_list);
discard_unwind_frame ("internal_fifos");
}
+# if defined (HAVE_DEV_FD)
+ /* Reap process substitutions at the end of loops */
+ switch (command->type)
+ {
+ case cm_while:
+ case cm_until:
+ case cm_for:
+# if defined (ARITH_FOR_COMMAND)
+ case cm_arith_for:
+# endif
+ reap_procsubs ();
+ default:
+ break;
+ }
+# endif /* HAVE_DEV_FD */
#endif
/* Invert the return value if we have to */
if (temp == 0)
{
- rl_maybe_unsave_line ();
+ _rl_free_saved_history_line ();
rl_ding ();
}
else
int c, temp;
char *ret, *r, *s;
unsigned long v;
+ size_t clen;
+ int b, mb_cur_max;
+#if defined (HANDLE_MULTIBYTE)
+ wchar_t wc;
+#endif
if (string == 0 || *string == '\0')
return ((char *)NULL);
+ mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
- temp = 4*len + 1;
+ temp = 4*len + 4;
if (temp < 12)
temp = 12; /* ensure enough for eventual u32cesc */
ret = (char *)xmalloc (temp);
{
c = *s++;
if (c != '\\' || *s == '\0')
- *r++ = c;
+ {
+ clen = 1;
+#if defined (HANDLE_MULTIBYTE)
+ if ((locale_utf8locale && (c & 0x80)) ||
+ (locale_utf8locale == 0 && mb_cur_max > 0 && is_basic (c) == 0))
+ {
+ clen = mbrtowc (&wc, s - 1, mb_cur_max, 0);
+ if (MB_INVALIDCH (clen))
+ clen = 1;
+ }
+#endif
+ *r++ = c;
+ for (--clen; clen > 0; clen--)
+ *r++ = *s++;
+ }
else
{
switch (c = *s++)
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 2
+#define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
+
#if defined (PROCESS_SUBSTITUTION)
+static void reap_some_procsubs __P((int));
+
/*****************************************************************/
/* */
/* Hacking Process Substitution */
/* If we've marked the process for this procsub as dead, close the
associated file descriptor and delete the FIFO. */
-void
-reap_procsubs ()
+static void
+reap_some_procsubs (max)
+ int max;
{
int i;
- for (i = 0; i < nfifo; i++)
+ for (i = 0; i < max; i++)
if (fifo_list[i].proc == (pid_t)-1) /* reaped */
unlink_fifo (i);
}
+void
+reap_procsubs ()
+{
+ reap_some_procsubs (nfifo);
+}
+
void
wait_procsubs ()
{
/* If we've marked the process for this procsub as dead, close the
associated file descriptor. */
-void
-reap_procsubs ()
+static void
+reap_some_procsubs (max)
+ int max;
{
int i;
- for (i = 0; nfds > 0 && i < totfds; i++)
+ for (i = 0; nfds > 0 && i < max; i++)
if (dev_fd_list[i] == (pid_t)-1)
unlink_fifo (i);
}
+void
+reap_procsubs ()
+{
+ reap_some_procsubs (totfds);
+}
+
void
wait_procsubs ()
{
#if 0 /* TAG:bash-5.1 */
/* Just like do_assignment_internal(). This makes assignments preceding
special builtins act like standalone assignment statements when in
- posix mode. */
+ posix mode, satisfying the posix requirement that this affect the
+ "current execution environment." */
v = bind_variable (var->name, value_cell (var), ASS_FORCE|ASS_NOLONGJMP);
/* If this modifies an existing local variable, v->context will be non-zero.
vc->table = tempvars;
/* Have to do this because the temp environment was created before
variable_context was incremented. */
+ /* XXX - only need to do it if flags&VC_FUNCENV */
flatten (tempvars, set_context, (VARLIST *)NULL, 0);
vc->flags |= VC_HASTMPVAR;
}