Bash-4.3 Official Patch 12

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-012

Bug-Reported-by:Eduardo A. Bustamante López
Bug-Reference-ID:   <5346b54c.4070...@case.edu>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00051.html

Bug-Description:

When a SIGCHLD trap runs a command containing a shell builtin while
a script is running `wait' to wait for all running children to complete,
the SIGCHLD trap will not be run once for each child that terminates.

Patch (apply with `patch -p0'):

*** ../bash-4.3-patched/jobs.c  2014-03-28 10:54:19.0 -0400
--- jobs.c  2014-04-15 08:47:03.0 -0400
***
*** 3598,3601 
--- 3598,3602 
unwind_protect_pointer (the_pipeline);
unwind_protect_pointer (subst_assign_varlist);
+   unwind_protect_pointer (this_shell_builtin);
  
/* We have to add the commands this way because they will be run
*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 11
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 12
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bash-4.3 Official Patch 13

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-013

Bug-Reported-by:
Bug-Reference-ID:   

Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00069.html

Bug-Description:

Using reverse-i-search when horizontal scrolling is enabled does not redisplay
the entire line containing the successful search results.

Patch (apply with `patch -p0'):
*** ../bash-4.3-patched/lib/readline/display.c  2014-04-08 18:19:36.0 
-0400
--- lib/readline/display.c  2014-04-20 18:32:52.0 -0400
***
*** 1638,1642 
   the spot of first difference is before the end of the invisible chars,
   lendiff needs to be adjusted. */
!   if (current_line == 0 && !_rl_horizontal_scroll_mode &&
current_invis_chars != visible_wrap_offset)
  {
--- 1638,1642 
   the spot of first difference is before the end of the invisible chars,
   lendiff needs to be adjusted. */
!   if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */
current_invis_chars != visible_wrap_offset)
  {
***
*** 1826,1831 
_rl_last_c_pos += bytes_to_insert;
  
  if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
!   goto clear_rest_of_line;
}
}
--- 1826,1836 
_rl_last_c_pos += bytes_to_insert;
  
+ /* XXX - we only want to do this if we are at the end of the line
+so we move there with _rl_move_cursor_relative */
  if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
!   {
! _rl_move_cursor_relative (ne-new, new);
! goto clear_rest_of_line;
!   }
}
}
*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 12
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 13
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bash-4.3 Official Patch 15

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-015

Bug-Reported-by:Clark Wang 
Bug-Reference-ID:   

Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00095.html

Bug-Description:

When completing directory names, the directory name is dequoted twice.
This causes problems for directories with single and double quotes in
their names.

Patch (apply with `patch -p0'):
*** ../bash-4.3-patched/bashline.c  2014-02-09 19:56:58.0 -0500
--- bashline.c  2014-04-25 14:57:52.0 -0400
***
*** 4168,4174 
  
qc = rl_dispatching ? rl_completion_quote_character : 0;  
!   dfn = bash_dequote_filename ((char *)text, qc);
m1 = rl_completion_matches (dfn, rl_filename_completion_function);
!   free (dfn);
  
if (m1 == 0 || m1[0] == 0)
--- 4209,4222 
  
qc = rl_dispatching ? rl_completion_quote_character : 0;  
!   /* If rl_completion_found_quote != 0, rl_completion_matches will call the
!  filename dequoting function, causing the directory name to be dequoted
!  twice. */
!   if (rl_dispatching && rl_completion_found_quote == 0)
! dfn = bash_dequote_filename ((char *)text, qc);
!   else
! dfn = (char *)text;
m1 = rl_completion_matches (dfn, rl_filename_completion_function);
!   if (dfn != text)
! free (dfn);
  
if (m1 == 0 || m1[0] == 0)
*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 14
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 15
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bash-4.3 Official Patch 14

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-014

Bug-Reported-by:Greg Wooledge 
Bug-Reference-ID:   <20140418202123.gb7...@eeg.ccf.org>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/help-bash/2014-04/msg4.html

Bug-Description:

Under certain circumstances, $@ is expanded incorrectly in contexts where
word splitting is not performed.

Patch (apply with `patch -p0'):
*** ../bash-4.3-patched/subst.c 2014-01-23 16:26:37.0 -0500
--- subst.c 2014-04-19 15:41:26.0 -0400
***
*** 3249,3254 
--- 3249,3256 
  return ((char *)NULL);
  
+   expand_no_split_dollar_star = 1;
w->flags |= W_NOSPLIT2;
l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0);
+   expand_no_split_dollar_star = 0;
if (l)
  {
***
*** 7848,7851 
--- 7850,7857 
 according to POSIX.2, this expands to a list of the positional
 parameters no matter what IFS is set to. */
+   /* XXX - what to do when in a context where word splitting is not
+performed? Even when IFS is not the default, posix seems to imply
+that we behave like unquoted $* ?  Maybe we should use PF_NOSPLIT2
+here. */
temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? 
(quoted|Q_DOUBLE_QUOTES) : quoted);
  
***
*** 8817,8820 
--- 8823,8827 
  {
char *ifs_chars;
+   char *tstring;
  
ifs_chars = (quoted_dollar_at || has_dollar_at) ? ifs_value : (char 
*)NULL;
***
*** 8831,8834 
--- 8838,8865 
if (split_on_spaces)
list = list_string (istring, " ", 1);   /* XXX quoted == 1? */
+   /* If we have $@ (has_dollar_at != 0) and we are in a context where we
+don't want to split the result (W_NOSPLIT2), and we are not quoted,
+we have already separated the arguments with the first character of
+$IFS.  In this case, we want to return a list with a single word
+with the separator possibly replaced with a space (it's what other
+shells seem to do).
+quoted_dollar_at is internal to this function and is set if we are
+passed an argument that is unquoted (quoted == 0) but we encounter a
+double-quoted $@ while expanding it. */
+   else if (has_dollar_at && quoted_dollar_at == 0 && ifs_chars && quoted 
== 0 && (word->flags & W_NOSPLIT2))
+   {
+ /* Only split and rejoin if we have to */
+ if (*ifs_chars && *ifs_chars != ' ')
+   {
+ list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1);
+ tstring = string_list (list);
+   }
+ else
+   tstring = istring;
+ tword = make_bare_word (tstring);
+ if (tstring != istring)
+   free (tstring);
+ goto set_word_flags;
+   }
else if (has_dollar_at && ifs_chars)
list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1);
***
*** 8836,8839 
--- 8867,8871 
{
  tword = make_bare_word (istring);
+ set_word_flags:
  if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == 
WHOLLY_QUOTED))
tword->flags |= W_QUOTED;
*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 13
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 14
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bash-4.3 Official Patch 16

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-016

Bug-Reported-by:Pierre Gaston 
Bug-Reference-ID:   

Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00100.html

Bug-Description:

An extended glob pattern containing a slash (`/') causes the globbing code
to misinterpret it as a directory separator.

Patch (apply with `patch -p0'):
*** ../bash-4.3-patched/lib/glob/glob.c 2014-03-28 10:54:23.0 -0400
--- lib/glob/glob.c 2014-05-02 10:24:28.0 -0400
***
*** 124,127 
--- 124,129 
  extern wchar_t *glob_patscan_wc __P((wchar_t *, wchar_t *, int));
  
+ extern char *glob_dirscan __P((char *, int));
+ 
  /* Compile `glob_loop.c' for single-byte characters. */
  #define CHAR  unsigned char
***
*** 188,191 
--- 190,196 
pe = glob_patscan (pp, se, 0);  /* end of extglob pattern (( */
/* we should check for invalid extglob pattern here */
+   if (pe == 0)
+ return 0;
+ 
/* if pe != se we have more of the pattern at the end of the extglob
   pattern. Check the easy case first ( */
***
*** 1016,1020 
char **result;
unsigned int result_size;
!   char *directory_name, *filename, *dname;
unsigned int directory_len;
int free_dirname;   /* flag */
--- 1021,1025 
char **result;
unsigned int result_size;
!   char *directory_name, *filename, *dname, *fn;
unsigned int directory_len;
int free_dirname;   /* flag */
***
*** 1032,1035 
--- 1037,1052 
/* Find the filename.  */
filename = strrchr (pathname, '/');
+ #if defined (EXTENDED_GLOB)
+   if (filename && extended_glob)
+ {
+   fn = glob_dirscan (pathname, '/');
+ #if DEBUG_MATCHING
+   if (fn != filename)
+   fprintf (stderr, "glob_filename: glob_dirscan: fn (%s) != filename 
(%s)\n", fn ? fn : "(null)", filename);
+ #endif
+   filename = fn;
+ }
+ #endif
+ 
if (filename == NULL)
  {
*** ../bash-4.3-patched/lib/glob/gmisc.c2014-03-28 10:54:23.0 
-0400
--- lib/glob/gmisc.c2014-05-02 09:35:57.0 -0400
***
*** 43,46 
--- 43,48 
  #define WRPAREN L')'
  
+ extern char *glob_patscan __P((char *, char *, int));
+ 
  /* Return 1 of the first character of WSTRING could match the first
 character of pattern WPAT.  Wide character version. */
***
*** 376,377 
--- 378,410 
return matlen;
  }
+ 
+ /* Skip characters in PAT and return the final occurrence of DIRSEP.  This
+is only called when extended_glob is set, so we have to skip over extglob
+patterns x(...) */
+ char *
+ glob_dirscan (pat, dirsep)
+  char *pat;
+  int dirsep;
+ {
+   char *p, *d, *pe, *se;
+ 
+   d = pe = se = 0;
+   for (p = pat; p && *p; p++)
+ {
+   if (extglob_pattern_p (p))
+   {
+ if (se == 0)
+   se = p + strlen (p) - 1;
+ pe = glob_patscan (p + 2, se, 0);
+ if (pe == 0)
+   continue;
+ else if (*pe == 0)
+   break;
+ p = pe - 1;   /* will do increment above */
+ continue;
+   }
+   if (*p ==  dirsep)
+   d = p;
+ }
+   return d;
+ }

*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 15
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 16
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bash-4.3 Official Patch 17

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-017

Bug-Reported-by:Dan Douglas 
Bug-Reference-ID:   <7781746.RhfoTROLxF@smorgbox>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2014-05/msg00026.html

Bug-Description:

The code that creates local variables should not clear the `invisible'
attribute when returning an existing local variable.  Let the code that
actually assigns a value clear it.

Patch (apply with `patch -p0'):
*** ../bash-4.3-patched/variables.c 2014-02-14 11:55:12.0 -0500
--- variables.c 2014-05-07 10:53:57.0 -0400
***
*** 2198,2205 
old_var = find_variable (name);
if (old_var && local_p (old_var) && old_var->context == variable_context)
! {
!   VUNSETATTR (old_var, att_invisible);/* XXX */
!   return (old_var);
! }
  
was_tmpvar = old_var && tempvar_p (old_var);
--- 2260,2264 
old_var = find_variable (name);
if (old_var && local_p (old_var) && old_var->context == variable_context)
! return (old_var);
  
was_tmpvar = old_var && tempvar_p (old_var);

*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 16
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 17
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Bash-4.3 Official Patch 18

2014-05-17 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.3
Patch-ID:   bash43-018

Bug-Reported-by:Geir Hauge 
Bug-Reference-ID:   

Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2014-05/msg00040.html

Bug-Description:

When assigning an array variable using the compound assignment syntax,
but using `declare' with the rhs of the compound assignment quoted, the
shell did not mark the variable as visible after successfully performing
the assignment.

Patch (apply with `patch -p0'):
*** ../bash-4.3-patched/arrayfunc.c 2014-03-28 10:54:21.0 -0400
--- arrayfunc.c 2014-05-12 11:19:00.0 -0400
***
*** 180,183 
--- 180,184 
FREE (newval);
  
+   VUNSETATTR (entry, att_invisible);  /* no longer invisible */
return (entry);
  }

*** ../bash-4.3/patchlevel.h2012-12-29 10:47:57.0 -0500
--- patchlevel.h2014-03-20 20:01:28.0 -0400
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 17
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 18
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/