Roman Rakus dbeb5d
			     BASH PATCH REPORT
Roman Rakus dbeb5d
			     =================
Roman Rakus dbeb5d
Roman Rakus dbeb5d
Bash-Release:	4.0
Roman Rakus dbeb5d
Patch-ID:	bash40-028
Roman Rakus dbeb5d
Roman Rakus dbeb5d
Bug-Reported-by:	martin f krafft <madduck@debian.org>
Roman Rakus dbeb5d
Bug-Reference-ID:	<4A4E39E7.5080807@debian.org>
Roman Rakus dbeb5d
Bug-Reference-URL:	http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519165
Roman Rakus dbeb5d
			http://lists.gnu.org/archive/html/bug-bash/2009-07/msg00011.html
Roman Rakus dbeb5d
Roman Rakus dbeb5d
Bug-Description:
Roman Rakus dbeb5d
Roman Rakus dbeb5d
bash-4.0 reverted to the historical shell behavior of raising an error
Roman Rakus dbeb5d
when $@ or $* was expanded after `set -u' had been executed and there
Roman Rakus dbeb5d
were no positional parameters.  The Posix working group has since
Roman Rakus dbeb5d
clarified the standard's position on the issue, and $@ and $* are now the
Roman Rakus dbeb5d
only variables, parameters, or special parameters that do not raise an
Roman Rakus dbeb5d
error when unset if set -u is enabled.
Roman Rakus dbeb5d
Roman Rakus dbeb5d
Patch:
Roman Rakus dbeb5d
Roman Rakus dbeb5d
*** ../bash-4.0-patched/subst.c	Mon Mar 23 11:34:55 2009
Roman Rakus dbeb5d
--- subst.c	Wed Jun 17 18:12:18 2009
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 6768,6778 ****
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
      case RBRACE:
Roman Rakus dbeb5d
!       if (var_is_set == 0 && unbound_vars_is_error)
Roman Rakus dbeb5d
  	{
Roman Rakus dbeb5d
  	  err_unboundvar (name);
Roman Rakus dbeb5d
  	  FREE (value);
Roman Rakus dbeb5d
  	  FREE (temp);
Roman Rakus dbeb5d
  	  free (name);
Roman Rakus dbeb5d
- 	  last_command_exit_value = EXECUTION_FAILURE;
Roman Rakus dbeb5d
  	  return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
Roman Rakus dbeb5d
  	}
Roman Rakus dbeb5d
--- 6794,6804 ----
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
      case RBRACE:
Roman Rakus dbeb5d
!       if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]))
Roman Rakus dbeb5d
  	{
Roman Rakus dbeb5d
+ 	  last_command_exit_value = EXECUTION_FAILURE;
Roman Rakus dbeb5d
  	  err_unboundvar (name);
Roman Rakus dbeb5d
  	  FREE (value);
Roman Rakus dbeb5d
  	  FREE (temp);
Roman Rakus dbeb5d
  	  free (name);
Roman Rakus dbeb5d
  	  return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
Roman Rakus dbeb5d
  	}
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 6991,6994 ****
Roman Rakus dbeb5d
--- 7017,7029 ----
Roman Rakus dbeb5d
        list = list_rest_of_args ();
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
+ #if 0
Roman Rakus dbeb5d
+       /* According to austin-group posix proposal by Geoff Clare in
Roman Rakus dbeb5d
+ 	 <20090505091501.GA10097@squonk.masqnet> of 5 May 2009:
Roman Rakus dbeb5d
+ 
Roman Rakus dbeb5d
+  	"The shell shall write a message to standard error and
Roman Rakus dbeb5d
+  	 immediately exit when it tries to expand an unset parameter
Roman Rakus dbeb5d
+  	 other than the '@' and '*' special parameters."
Roman Rakus dbeb5d
+       */
Roman Rakus dbeb5d
+ 
Roman Rakus dbeb5d
        if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
Roman Rakus dbeb5d
  	{
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 6996,7003 ****
Roman Rakus dbeb5d
  	  uerror[1] = '*';
Roman Rakus dbeb5d
  	  uerror[2] = '\0';
Roman Rakus dbeb5d
- 	  err_unboundvar (uerror);
Roman Rakus dbeb5d
  	  last_command_exit_value = EXECUTION_FAILURE;
Roman Rakus dbeb5d
  	  return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
Roman Rakus dbeb5d
  	}
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
        /* If there are no command-line arguments, this should just
Roman Rakus dbeb5d
--- 7031,7039 ----
Roman Rakus dbeb5d
  	  uerror[1] = '*';
Roman Rakus dbeb5d
  	  uerror[2] = '\0';
Roman Rakus dbeb5d
  	  last_command_exit_value = EXECUTION_FAILURE;
Roman Rakus dbeb5d
+ 	  err_unboundvar (uerror);
Roman Rakus dbeb5d
  	  return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
Roman Rakus dbeb5d
  	}
Roman Rakus dbeb5d
+ #endif
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
        /* If there are no command-line arguments, this should just
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 7053,7056 ****
Roman Rakus dbeb5d
--- 7089,7101 ----
Roman Rakus dbeb5d
        list = list_rest_of_args ();
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
+ #if 0
Roman Rakus dbeb5d
+       /* According to austin-group posix proposal by Geoff Clare in
Roman Rakus dbeb5d
+ 	 <20090505091501.GA10097@squonk.masqnet> of 5 May 2009:
Roman Rakus dbeb5d
+ 
Roman Rakus dbeb5d
+  	"The shell shall write a message to standard error and
Roman Rakus dbeb5d
+  	 immediately exit when it tries to expand an unset parameter
Roman Rakus dbeb5d
+  	 other than the '@' and '*' special parameters."
Roman Rakus dbeb5d
+       */
Roman Rakus dbeb5d
+ 
Roman Rakus dbeb5d
        if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
Roman Rakus dbeb5d
  	{
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 7058,7065 ****
Roman Rakus dbeb5d
  	  uerror[1] = '@';
Roman Rakus dbeb5d
  	  uerror[2] = '\0';
Roman Rakus dbeb5d
- 	  err_unboundvar (uerror);
Roman Rakus dbeb5d
  	  last_command_exit_value = EXECUTION_FAILURE;
Roman Rakus dbeb5d
  	  return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
Roman Rakus dbeb5d
  	}
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
        /* We want to flag the fact that we saw this.  We can't turn
Roman Rakus dbeb5d
--- 7103,7111 ----
Roman Rakus dbeb5d
  	  uerror[1] = '@';
Roman Rakus dbeb5d
  	  uerror[2] = '\0';
Roman Rakus dbeb5d
  	  last_command_exit_value = EXECUTION_FAILURE;
Roman Rakus dbeb5d
+ 	  err_unboundvar (uerror);
Roman Rakus dbeb5d
  	  return (interactive_shell ? &expand_wdesc_error : &expand_wdesc_fatal);
Roman Rakus dbeb5d
  	}
Roman Rakus dbeb5d
+ #endif
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
        /* We want to flag the fact that we saw this.  We can't turn
Roman Rakus dbeb5d
*** ../bash-4.0-patched/doc/bash.1	Wed Feb 18 15:13:56 2009
Roman Rakus dbeb5d
--- doc/bash.1	Wed Jun 17 08:51:19 2009
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 8258,8264 ****
Roman Rakus dbeb5d
  .TP 8
Roman Rakus dbeb5d
  .B \-u
Roman Rakus dbeb5d
! Treat unset variables as an error when performing
Roman Rakus dbeb5d
  parameter expansion.  If expansion is attempted on an
Roman Rakus dbeb5d
! unset variable, the shell prints an error message, and,
Roman Rakus dbeb5d
  if not interactive, exits with a non-zero status.
Roman Rakus dbeb5d
  .TP 8
Roman Rakus dbeb5d
--- 8274,8281 ----
Roman Rakus dbeb5d
  .TP 8
Roman Rakus dbeb5d
  .B \-u
Roman Rakus dbeb5d
! Treat unset variables and parameters other than the special
Roman Rakus dbeb5d
! parameters "@" and "*" as an error when performing
Roman Rakus dbeb5d
  parameter expansion.  If expansion is attempted on an
Roman Rakus dbeb5d
! unset variable or parameter, the shell prints an error message, and,
Roman Rakus dbeb5d
  if not interactive, exits with a non-zero status.
Roman Rakus dbeb5d
  .TP 8
Roman Rakus dbeb5d
*** ../bash-4.0-patched/doc/bashref.texi	Wed Feb 18 15:14:43 2009
Roman Rakus dbeb5d
--- doc/bashref.texi	Wed Jun 17 08:50:46 2009
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 4139,4143 ****
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
  @item -u
Roman Rakus dbeb5d
! Treat unset variables as an error when performing parameter expansion.
Roman Rakus dbeb5d
  An error message will be written to the standard error, and a non-interactive
Roman Rakus dbeb5d
  shell will exit.
Roman Rakus dbeb5d
--- 4151,4156 ----
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
  @item -u
Roman Rakus dbeb5d
! Treat unset variables and parameters other than the special parameters
Roman Rakus dbeb5d
! @samp{@@} or @samp{*} as an error when performing parameter expansion.
Roman Rakus dbeb5d
  An error message will be written to the standard error, and a non-interactive
Roman Rakus dbeb5d
  shell will exit.
Roman Rakus dbeb5d
*** ../bash-4.0/patchlevel.h	2009-01-04 14:32:40.000000000 -0500
Roman Rakus dbeb5d
--- patchlevel.h	2009-02-22 16:11:31.000000000 -0500
Roman Rakus dbeb5d
***************
Roman Rakus dbeb5d
*** 26,30 ****
Roman Rakus dbeb5d
     looks for to find the patch level (for the sccs version string). */
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
! #define PATCHLEVEL 27
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus dbeb5d
--- 26,30 ----
Roman Rakus dbeb5d
     looks for to find the patch level (for the sccs version string). */
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
! #define PATCHLEVEL 28
Roman Rakus dbeb5d
  
Roman Rakus dbeb5d
  #endif /* _PATCHLEVEL_H_ */