6c6fdb3e57ebb4a448183cdc8aaaff1a3d5c06c8
[packages.git] / utils / bash / patches / 123-upstream-bash42-023.patch
1                              BASH PATCH REPORT
2                              =================
3
4 Bash-Release:   4.2
5 Patch-ID:       bash42-023
6
7 Bug-Reported-by:        Ewan Mellor <Ewan.Mellor@eu.citrix.com>
8 Bug-Reference-ID:       <6005BE083BF501439A84DC3523BAC82DC4B964FD12@LONPMAILBOX01.citrite.net>
9 Bug-Reference-URL:      
10
11 Bug-Description:
12
13 Under some circumstances, an exit trap triggered by a bad substitution
14 error when errexit is enabled will cause the shell to exit with an
15 incorrect exit status (0).
16
17 Patch (apply with `patch -p0'):
18
19 --- a/subst.c
20 +++ b/subst.c
21 @@ -7274,6 +7274,7 @@ parameter_brace_expand (string, indexp, 
22      default:
23      case '\0':
24      bad_substitution:
25 +      last_command_exit_value = EXECUTION_FAILURE;
26        report_error (_("%s: bad substitution"), string ? string : "??");
27        FREE (value);
28        FREE (temp);
29 --- a/error.c
30 +++ b/error.c
31 @@ -200,7 +200,11 @@ report_error (format, va_alist)
32  
33    va_end (args);
34    if (exit_immediately_on_error)
35 -    exit_shell (1);
36 +    {
37 +      if (last_command_exit_value == 0)
38 +       last_command_exit_value = 1;
39 +      exit_shell (last_command_exit_value);
40 +    }
41  }
42  
43  void
44 --- a/patchlevel.h
45 +++ b/patchlevel.h
46 @@ -25,6 +25,6 @@
47     regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
48     looks for to find the patch level (for the sccs version string). */
49  
50 -#define PATCHLEVEL 22
51 +#define PATCHLEVEL 23
52  
53  #endif /* _PATCHLEVEL_H_ */