Bash-4.0 Official Patch 25

2009-07-27 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.0
Patch-ID:   bash40-025

Bug-Reported-by:Matt Zyzik 
Bug-Reference-ID:   <20090519011418.ga21...@ice.filescope.com>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2009-05/msg00044.html

Bug-Description:

bash40-024 introduced a regression for constructs like **/*.cs; that
expansion would no longer include matching files in the current directory.
This patch undoes portions of bash40-024 and fixes the original problem
in a different way.

Patch:

*** ../bash-4.0-patched/lib/glob/glob.c 2009-05-22 12:32:26.0 -0400
--- lib/glob/glob.c 2009-05-22 12:35:55.0 -0400
***
*** 666,672 
  }
  
!   /* compat: if GX_ALLDIRS, add the passed directory also, but don't add an
!  empty directory name. */
!   if (add_current && (flags & GX_NULLDIR) == 0)
  {
sdlen = strlen (dir);
--- 666,673 
  }
  
!   /* compat: if GX_ADDCURDIR, add the passed directory also.  Add an empty
!  directory name as a placeholder if GX_NULLDIR (in which case the passed
!  directory name is "."). */
!   if (add_current)
  {
sdlen = strlen (dir);
***
*** 680,684 
  nextlink->next = lastlink;
  lastlink = nextlink;
! bcopy (dir, nextname, sdlen + 1);
  ++count;
}
--- 681,688 
  nextlink->next = lastlink;
  lastlink = nextlink;
! if (flags & GX_NULLDIR)
!   nextname[0] = '\0';
! else
!   bcopy (dir, nextname, sdlen + 1);
  ++count;
}
***
*** 1008,1016 
/* Just return what glob_vector () returns appended to the
 directory name. */
dflags = flags & ~GX_MARKDIRS;
if (directory_len == 0)
dflags |= GX_NULLDIR;
if ((flags & GX_GLOBSTAR) && filename[0] == '*' && filename[1] == '*' 
&& filename[2] == '\0')
!   dflags |= GX_ALLDIRS|GX_ADDCURDIR;
temp_results = glob_vector (filename,
  (directory_len == 0 ? "." : directory_name),
--- 1012,1033 
/* Just return what glob_vector () returns appended to the
 directory name. */
+   /* If flags & GX_ALLDIRS, we're called recursively */
dflags = flags & ~GX_MARKDIRS;
if (directory_len == 0)
dflags |= GX_NULLDIR;
if ((flags & GX_GLOBSTAR) && filename[0] == '*' && filename[1] == '*' 
&& filename[2] == '\0')
!   {
! dflags |= GX_ALLDIRS|GX_ADDCURDIR;
! #if 0
! /* If we want all directories (dflags & GX_ALLDIRS) and we're not
!being called recursively as something like `echo **/*.o'
!((flags & GX_ALLDIRS) == 0), we want to prevent glob_vector from
!adding a null directory name to the front of the temp_results
!array.  We turn off ADDCURDIR if not called recursively and
!dlen == 0 */
! #endif
! if (directory_len == 0 && (flags & GX_ALLDIRS) == 0)
!   dflags &= ~GX_ADDCURDIR;
!   }
temp_results = glob_vector (filename,
  (directory_len == 0 ? "." : directory_name),
*** ../bash-4.0/patchlevel.h2009-01-04 14:32:40.0 -0500
--- patchlevel.h2009-02-22 16:11:31.0 -0500
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 24
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 25
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://tiswww.tis.case.edu/~chet/




Bash-4.0 Official Patch 26

2009-07-27 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.0
Patch-ID:   bash40-026

Bug-Reported-by:Sergei Steshenko 
Bug-Reference-ID:   <670181.38883...@web35204.mail.mud.yahoo.com>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2009-05/msg00059.html

Bug-Description:

A forgotten line in externs.h caused compilation errors to occur on some
systems (e.g., Cygwin).

Patch:

*** ../bash-4.0-patched/externs.h   2009-01-18 18:29:29.0 -0500
--- externs.h   2009-06-02 09:05:40.0 -0400
***
*** 193,196 
--- 193,198 
  
  /* Declarations for functions defined in lib/sh/fpurge.c */
+ 
+ #if defined NEED_FPURGE_DECL
  #if !HAVE_DECL_FPURGE
  
***
*** 201,205 
  
  #endif /* HAVE_DECL_FPURGE */
! 
  
  /* Declarations for functions defined in lib/sh/getcwd.c */
--- 203,207 
  
  #endif /* HAVE_DECL_FPURGE */
! #endif /* NEED_FPURGE_DECL */
  
  /* Declarations for functions defined in lib/sh/getcwd.c */
*** ../bash-4.0/patchlevel.h2009-01-04 14:32:40.0 -0500
--- patchlevel.h2009-02-22 16:11:31.0 -0500
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 25
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 26
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://tiswww.tis.case.edu/~chet/




Bash-4.0 Official Patch 27

2009-07-27 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.0
Patch-ID: bash40-027

Bug-Reported-by:j...@jim.sh
Bug-Reference-ID:   <200905262140.n4qleo4x030...@psychosis.jim.sh>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2009-05/msg00074.html

Bug-Description:

There are occasional cursor positioning errors when using readline's
horizontal scroll mode.

Patch:

*** ../bash-4.0-patched/lib/readline/display.c  2009-05-22 12:32:25.0 
-0400
--- lib/readline/display.c  2009-05-29 23:32:20.0 -0400
***
*** 1190,1196 
line[t - 1] = '>';
  
!   if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
{
  forced_display = 0;
  update_line (&visible_line[last_lmargin],
   &invisible_line[lmargin],
--- 1192,1200 
line[t - 1] = '>';
  
!   if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
{
  forced_display = 0;
+ o_cpos = _rl_last_c_pos;
+ cpos_adjusted = 0;
  update_line (&visible_line[last_lmargin],
   &invisible_line[lmargin],
***
*** 1200,1203 
--- 1204,1214 
   0);
  
+ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
+ cpos_adjusted == 0 &&
+ _rl_last_c_pos != o_cpos &&
+ _rl_last_c_pos > wrap_offset &&
+ o_cpos < prompt_last_invisible)
+   _rl_last_c_pos -= prompt_invis_chars_first_line;/* XXX 
- was wrap_offset */
+ 
  /* If the visible new line is shorter than the old, but the number
 of invisible characters is greater, and we are at the end of
*** ../bash-4.0/patchlevel.h2009-01-04 14:32:40.0 -0500
--- patchlevel.h2009-02-22 16:11:31.0 -0500
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 26
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 27
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://tiswww.tis.case.edu/~chet/




Bash-4.0 Official Patch 28

2009-07-27 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release:   4.0
Patch-ID:   bash40-028

Bug-Reported-by:martin f krafft 
Bug-Reference-ID:   <4a4e39e7.5080...@debian.org>
Bug-Reference-URL:  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519165

http://lists.gnu.org/archive/html/bug-bash/2009-07/msg00011.html

Bug-Description:

bash-4.0 reverted to the historical shell behavior of raising an error
when $@ or $* was expanded after `set -u' had been executed and there
were no positional parameters.  The Posix working group has since
clarified the standard's position on the issue, and $@ and $* are now the
only variables, parameters, or special parameters that do not raise an
error when unset if set -u is enabled.

Patch:

*** ../bash-4.0-patched/subst.c Mon Mar 23 11:34:55 2009
--- subst.c Wed Jun 17 18:12:18 2009
***
*** 6768,6778 
  
  case RBRACE:
!   if (var_is_set == 0 && unbound_vars_is_error)
{
  err_unboundvar (name);
  FREE (value);
  FREE (temp);
  free (name);
- last_command_exit_value = EXECUTION_FAILURE;
  return (interactive_shell ? &expand_wdesc_error : 
&expand_wdesc_fatal);
}
--- 6794,6804 
  
  case RBRACE:
!   if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && 
name[0] != '*') || name[1]))
{
+ last_command_exit_value = EXECUTION_FAILURE;
  err_unboundvar (name);
  FREE (value);
  FREE (temp);
  free (name);
  return (interactive_shell ? &expand_wdesc_error : 
&expand_wdesc_fatal);
}
***
*** 6991,6994 
--- 7017,7029 
list = list_rest_of_args ();
  
+ #if 0
+   /* According to austin-group posix proposal by Geoff Clare in
+<20090505091501.ga10...@squonk.masqnet> of 5 May 2009:
+ 
+   "The shell shall write a message to standard error and
+immediately exit when it tries to expand an unset parameter
+other than the '@' and '*' special parameters."
+   */
+ 
if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
{
***
*** 6996,7003 
  uerror[1] = '*';
  uerror[2] = '\0';
- err_unboundvar (uerror);
  last_command_exit_value = EXECUTION_FAILURE;
  return (interactive_shell ? &expand_wdesc_error : 
&expand_wdesc_fatal);
}
  
/* If there are no command-line arguments, this should just
--- 7031,7039 
  uerror[1] = '*';
  uerror[2] = '\0';
  last_command_exit_value = EXECUTION_FAILURE;
+ err_unboundvar (uerror);
  return (interactive_shell ? &expand_wdesc_error : 
&expand_wdesc_fatal);
}
+ #endif
  
/* If there are no command-line arguments, this should just
***
*** 7053,7056 
--- 7089,7101 
list = list_rest_of_args ();
  
+ #if 0
+   /* According to austin-group posix proposal by Geoff Clare in
+<20090505091501.ga10...@squonk.masqnet> of 5 May 2009:
+ 
+   "The shell shall write a message to standard error and
+immediately exit when it tries to expand an unset parameter
+other than the '@' and '*' special parameters."
+   */
+ 
if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
{
***
*** 7058,7065 
  uerror[1] = '@';
  uerror[2] = '\0';
- err_unboundvar (uerror);
  last_command_exit_value = EXECUTION_FAILURE;
  return (interactive_shell ? &expand_wdesc_error : 
&expand_wdesc_fatal);
}
  
/* We want to flag the fact that we saw this.  We can't turn
--- 7103,7111 
  uerror[1] = '@';
  uerror[2] = '\0';
  last_command_exit_value = EXECUTION_FAILURE;
+ err_unboundvar (uerror);
  return (interactive_shell ? &expand_wdesc_error : 
&expand_wdesc_fatal);
}
+ #endif
  
/* We want to flag the fact that we saw this.  We can't turn
*** ../bash-4.0-patched/doc/bash.1  Wed Feb 18 15:13:56 2009
--- doc/bash.1  Wed Jun 17 08:51:19 2009
***
*** 8258,8264 
  .TP 8
  .B \-u
! Treat unset variables as an error when performing
  parameter expansion.  If expansion is attempted on an
! unset variable, the shell prints an error message, and,
  if not interactive, exits with a non-zero status.
  .TP 8
--- 8274,8281 
  .TP 8
  .B \-u
! Treat unset variables and parameters other than the special
! parameters "@" and "*" as an error when performing
  parameter expansion.  If expansion is attempted on an
! unset variable or parameter, the shell prints an error message, and,
  if not interactive, exits with a non-zero status.
  .TP 8
*** ../bash-4.0-patched/doc/bashref.texiWed Feb 18 15:14:43 2009
--- doc/bashref.texiWed Jun 17 08:50:46 2009
***
*** 

Bash-3.2 Official Patch 50

2009-07-27 Thread Chet Ramey
 BASH PATCH REPORT
 =

Bash-Release: 3.2
Patch-ID: bash32-050

Bug-Reported-by:Jan Hnatek 
Bug-Reference-ID:   <4a44991f.8010...@sun.com>
Bug-Reference-URL:  
http://lists.gnu.org/archive/html/bug-bash/2009-06/msg00084.html

Bug-Description:

On systems where mbrtowc() returns -2 when passed a length argument with
value 0, when using a multibyte locale, Readline's emacs-mode forward-char
at the end of a line will leave the point beyond the end of the line.

Patch:

*** ../bash-3.2-patched/lib/readline/mbutil.c   2009-06-16 11:26:50.0 
-0400
--- lib/readline/mbutil.c   2009-01-04 14:32:33.0 -0500
***
*** 132,141 
  {
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
!   while (tmp > 0 && wcwidth (wc) == 0)
{
  point += tmp;
  tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
- if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
-   break;
}
  }
--- 130,137 
  {
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
!   while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wcwidth (wc) 
== 0)
{
  point += tmp;
  tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
}
  }
*** ../bash-3.2/patchlevel.hThu Apr 13 08:31:04 2006
--- patchlevel.hMon Oct 16 14:22:54 2006
***
*** 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 49
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 
 looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 50
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://tiswww.tis.case.edu/~chet/