Roman Rakus e73230
			     BASH PATCH REPORT
Roman Rakus e73230
			     =================
Roman Rakus e73230
Roman Rakus e73230
Bash-Release:	4.0
Roman Rakus e73230
Patch-ID:	bash40-013
Roman Rakus e73230
Roman Rakus e73230
Bug-Reported-by:	jidanni@jidanni.org
Roman Rakus e73230
Bug-Reference-ID:
Roman Rakus e73230
Bug-Reference-URL:	http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519165
Roman Rakus e73230
Roman Rakus e73230
Bug-Description:
Roman Rakus e73230
Roman Rakus e73230
Though references to $@ when there are no positional parameters will now
Roman Rakus e73230
cause the shell to exit if the `errexit' option has been enabled, constructs
Roman Rakus e73230
such as ${@:-foo} should not cause an exit.
Roman Rakus e73230
Roman Rakus e73230
Patch:
Roman Rakus e73230
Roman Rakus e73230
*** ../bash-4.0-patched/subst.c	2009-03-08 21:24:39.000000000 -0400
Roman Rakus e73230
--- subst.c	2009-03-14 19:04:10.000000000 -0400
Roman Rakus e73230
***************
Roman Rakus e73230
*** 86,89 ****
Roman Rakus e73230
--- 86,90 ----
Roman Rakus e73230
  /* Flags for the `pflags' argument to param_expand() */
Roman Rakus e73230
  #define PF_NOCOMSUB	0x01	/* Do not perform command substitution */
Roman Rakus e73230
+ #define PF_IGNUNBOUND	0x02	/* ignore unbound vars even if -u set */
Roman Rakus e73230
  
Roman Rakus e73230
  /* These defs make it easier to use the editor. */
Roman Rakus e73230
***************
Roman Rakus e73230
*** 264,268 ****
Roman Rakus e73230
  static int chk_arithsub __P((const char *, int));
Roman Rakus e73230
  
Roman Rakus e73230
! static WORD_DESC *parameter_brace_expand_word __P((char *, int, int));
Roman Rakus e73230
  static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
Roman Rakus e73230
  static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
Roman Rakus e73230
--- 265,269 ----
Roman Rakus e73230
  static int chk_arithsub __P((const char *, int));
Roman Rakus e73230
  
Roman Rakus e73230
! static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int));
Roman Rakus e73230
  static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
Roman Rakus e73230
  static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
Roman Rakus e73230
***************
Roman Rakus e73230
*** 5196,5202 ****
Roman Rakus e73230
     NAME was found inside of a double-quoted expression. */
Roman Rakus e73230
  static WORD_DESC *
Roman Rakus e73230
! parameter_brace_expand_word (name, var_is_special, quoted)
Roman Rakus e73230
       char *name;
Roman Rakus e73230
!      int var_is_special, quoted;
Roman Rakus e73230
  {
Roman Rakus e73230
    WORD_DESC *ret;
Roman Rakus e73230
--- 5197,5203 ----
Roman Rakus e73230
     NAME was found inside of a double-quoted expression. */
Roman Rakus e73230
  static WORD_DESC *
Roman Rakus e73230
! parameter_brace_expand_word (name, var_is_special, quoted, pflags)
Roman Rakus e73230
       char *name;
Roman Rakus e73230
!      int var_is_special, quoted, pflags;
Roman Rakus e73230
  {
Roman Rakus e73230
    WORD_DESC *ret;
Roman Rakus e73230
***************
Roman Rakus e73230
*** 5230,5234 ****
Roman Rakus e73230
  
Roman Rakus e73230
        ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
Roman Rakus e73230
! 			  (int *)NULL, (int *)NULL, 0);
Roman Rakus e73230
        free (tt);
Roman Rakus e73230
      }
Roman Rakus e73230
--- 5231,5235 ----
Roman Rakus e73230
  
Roman Rakus e73230
        ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
Roman Rakus e73230
! 			  (int *)NULL, (int *)NULL, pflags);
Roman Rakus e73230
        free (tt);
Roman Rakus e73230
      }
Roman Rakus e73230
***************
Roman Rakus e73230
*** 5291,5295 ****
Roman Rakus e73230
    WORD_DESC *w;
Roman Rakus e73230
  
Roman Rakus e73230
!   w = parameter_brace_expand_word (name, var_is_special, quoted);
Roman Rakus e73230
    t = w->word;
Roman Rakus e73230
    /* Have to dequote here if necessary */
Roman Rakus e73230
--- 5292,5296 ----
Roman Rakus e73230
    WORD_DESC *w;
Roman Rakus e73230
  
Roman Rakus e73230
!   w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
Roman Rakus e73230
    t = w->word;
Roman Rakus e73230
    /* Have to dequote here if necessary */
Roman Rakus e73230
***************
Roman Rakus e73230
*** 5308,5312 ****
Roman Rakus e73230
      return (WORD_DESC *)NULL;
Roman Rakus e73230
  
Roman Rakus e73230
!   w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
Roman Rakus e73230
    free (t);
Roman Rakus e73230
  
Roman Rakus e73230
--- 5309,5313 ----
Roman Rakus e73230
      return (WORD_DESC *)NULL;
Roman Rakus e73230
  
Roman Rakus e73230
!   w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0);
Roman Rakus e73230
    free (t);
Roman Rakus e73230
  
Roman Rakus e73230
***************
Roman Rakus e73230
*** 6659,6663 ****
Roman Rakus e73230
      tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
Roman Rakus e73230
    else
Roman Rakus e73230
!     tdesc = parameter_brace_expand_word (name, var_is_special, quoted);
Roman Rakus e73230
  
Roman Rakus e73230
    if (tdesc)
Roman Rakus e73230
--- 6660,6664 ----
Roman Rakus e73230
      tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
Roman Rakus e73230
    else
Roman Rakus e73230
!     tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
Roman Rakus e73230
  
Roman Rakus e73230
    if (tdesc)
Roman Rakus e73230
***************
Roman Rakus e73230
*** 6990,6994 ****
Roman Rakus e73230
        list = list_rest_of_args ();
Roman Rakus e73230
  
Roman Rakus e73230
!       if (list == 0 && unbound_vars_is_error)
Roman Rakus e73230
  	{
Roman Rakus e73230
  	  uerror[0] = '$';
Roman Rakus e73230
--- 6991,6995 ----
Roman Rakus e73230
        list = list_rest_of_args ();
Roman Rakus e73230
  
Roman Rakus e73230
!       if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
Roman Rakus e73230
  	{
Roman Rakus e73230
  	  uerror[0] = '$';
Roman Rakus e73230
***************
Roman Rakus e73230
*** 7052,7056 ****
Roman Rakus e73230
        list = list_rest_of_args ();
Roman Rakus e73230
  
Roman Rakus e73230
!       if (list == 0 && unbound_vars_is_error)
Roman Rakus e73230
  	{
Roman Rakus e73230
  	  uerror[0] = '$';
Roman Rakus e73230
--- 7053,7057 ----
Roman Rakus e73230
        list = list_rest_of_args ();
Roman Rakus e73230
  
Roman Rakus e73230
!       if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
Roman Rakus e73230
  	{
Roman Rakus e73230
  	  uerror[0] = '$';
Roman Rakus e73230
Roman Rakus e73230
Roman Rakus e73230
*** ../bash-4.0/patchlevel.h	2009-01-04 14:32:40.000000000 -0500
Roman Rakus e73230
--- patchlevel.h	2009-02-22 16:11:31.000000000 -0500
Roman Rakus e73230
***************
Roman Rakus e73230
*** 26,30 ****
Roman Rakus e73230
     looks for to find the patch level (for the sccs version string). */
Roman Rakus e73230
  
Roman Rakus e73230
! #define PATCHLEVEL 12
Roman Rakus e73230
  
Roman Rakus e73230
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus e73230
--- 26,30 ----
Roman Rakus e73230
     looks for to find the patch level (for the sccs version string). */
Roman Rakus e73230
  
Roman Rakus e73230
! #define PATCHLEVEL 13
Roman Rakus e73230
  
Roman Rakus e73230
  #endif /* _PATCHLEVEL_H_ */