Merge branch 'master' of git://repo.or.cz/buildroot
[buildroot.git] / package / bash / bash32-039
blob653f06fc69d7829c0b9a4298da36220c484b9746
1                              BASH PATCH REPORT
2                              =================
4 Bash-Release: 3.2
5 Patch-ID: bash32-039
7 Bug-Reported-by:        rew@erebor.com
8 Bug-Reference-ID:       <20070119065603.546D011E9C@kansas.erebor.com>
9 Bug-Reference-URL:      
11 Bug-Description:
13 Bash-3.2 changed the behavior of the [[ command's `=~' operator when the
14 right-hand side was quoted:  it matched the quoted portions as strings.
15 This patch introduces a new shell option: compat31.  When enabled, it
16 restores the bash-3.1 behavior with respect to evaluating quoted arguments
17 to the =~ operator.
19 Patch:
21 *** ../bash-3.2-patched/execute_cmd.c   2007-12-14 21:12:39.000000000 -0500
22 --- bash-3.2/execute_cmd.c      2008-02-22 21:20:40.000000000 -0500
23 ***************
24 *** 2547,2551 ****
25         if (arg1 == 0)
26         arg1 = nullstr;
27 !       arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0));
28         if (arg2 == 0)
29         arg2 = nullstr;
30 --- 2552,2557 ----
31         if (arg1 == 0)
32         arg1 = nullstr;
33 !       arg2 = cond_expand_word (cond->right->op,
34 !                              (rmatch && shell_compatibility_level > 31) ? 2 : (patmatch ? 1 : 0));
35         if (arg2 == 0)
36         arg2 = nullstr;
37 *** ../bash-3.2-patched/shell.h 2003-06-01 15:04:36.000000000 -0400
38 --- bash-3.2/shell.h    2008-02-22 21:16:48.000000000 -0500
39 ***************
40 *** 90,93 ****
41 --- 90,94 ----
42   extern int interactive, interactive_shell;
43   extern int startup_state;
44 + extern int shell_compatibility_level;
45   
46   /* Structure to pass around that holds a bitmap of file descriptors
47 *** ../bash-3.2-patched/version.c       2007-12-14 21:12:29.000000000 -0500
48 --- bash-3.2/version.c  2008-04-10 08:22:22.000000000 -0400
49 ***************
50 *** 44,47 ****
51 --- 44,50 ----
52   const char *sccs_version = SCCSVERSION;
53   
54 + /* If == 31, shell compatible with bash-3.1, == 32 with bash-3.2, and so on */
55 + int shell_compatibility_level = 32;
56
57   /* Functions for getting, setting, and displaying the shell version. */
58   
59 *** ../bash-3.2-patched/builtins/shopt.def      2005-02-19 17:25:03.000000000 -0500
60 --- bash-3.2/builtins/shopt.def 2008-04-10 08:13:32.000000000 -0400
61 ***************
62 *** 102,105 ****
63 --- 102,107 ----
64   static int set_shellopts_after_change __P((int));
65   
66 + static int set_compatibility_level __P((int));
67
68   #if defined (RESTRICTED_SHELL)
69   static int set_restricted_shell __P((int));
70 ***************
71 *** 107,110 ****
72 --- 109,113 ----
73   
74   static int shopt_login_shell;
75 + static int shopt_compat31;
76   
77   typedef int shopt_set_func_t __P((int));
78 ***************
79 *** 122,125 ****
80 --- 125,129 ----
81     { "cmdhist", &command_oriented_history, (shopt_set_func_t *)NULL },
82   #endif
83 +   { "compat31", &shopt_compat31, set_compatibility_level },
84     { "dotglob", &glob_dot_filenames, (shopt_set_func_t *)NULL },
85     { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *)NULL },
86 ***************
87 *** 460,463 ****
88 --- 464,479 ----
89   }
90   
91 + static int
92 + set_compatibility_level (mode)
93 +      int mode;
94 + {
95 +   /* Need to change logic here as we add more compatibility levels */
96 +   if (shopt_compat31)
97 +     shell_compatibility_level = 31;
98 +   else
99 +     shell_compatibility_level = 32;
100 +   return 0;
101 + }
103   #if defined (RESTRICTED_SHELL)
104   /* Don't allow the value of restricted_shell to be modified. */
105 *** ../bash-3.2-patched/doc/bash.1      2006-09-28 10:26:05.000000000 -0400
106 --- bash-3.2/doc/bash.1 2008-04-25 12:32:49.000000000 -0400
107 ***************
108 *** 7978,7981 ****
109 --- 8200,8209 ----
110   easy re-editing of multi-line commands.
111   .TP 8
112 + .B compat31
113 + If set,
114 + .B bash
115 + changes its behavior to that of version 3.1 with respect to quoted
116 + arguments to the conditional command's =~ operator.
117 + .TP 8
118   .B dotglob
119   If set, 
120 *** ../bash-20080214/doc/bashref.texi   2008-02-08 21:28:35.000000000 -0500
121 --- bash-3.2/doc/bashref.texi   2008-02-22 21:44:51.000000000 -0500
122 ***************
123 *** 4053,4056 ****
124 --- 4061,4069 ----
125   easy re-editing of multi-line commands.
126   
127 + @item compat31
128 + If set, Bash
129 + changes its behavior to that of version 3.1 with respect to quoted
130 + arguments to the conditional command's =~ operator.
132   @item dotglob
133   If set, Bash includes filenames beginning with a `.' in
134 *** ../bash-3.2-patched/tests/shopt.right       2005-02-19 17:46:09.000000000 -0500
135 --- bash-3.2/tests/shopt.right  2008-04-28 09:13:07.000000000 -0400
136 ***************
137 *** 7,10 ****
138 --- 7,11 ----
139   shopt -u checkwinsize
140   shopt -s cmdhist
141 + shopt -u compat31
142   shopt -u dotglob
143   shopt -u execfail
144 ***************
145 *** 54,57 ****
146 --- 55,59 ----
147   shopt -u checkhash
148   shopt -u checkwinsize
149 + shopt -u compat31
150   shopt -u dotglob
151   shopt -u execfail
152 ***************
153 *** 78,81 ****
154 --- 80,84 ----
155   checkhash             off
156   checkwinsize          off
157 + compat31              off
158   dotglob               off
159   execfail              off
161 *** ../bash-3.2/patchlevel.h    Thu Apr 13 08:31:04 2006
162 --- bash-3.2/patchlevel.h       Mon Oct 16 14:22:54 2006
163 ***************
164 *** 26,30 ****
165      looks for to find the patch level (for the sccs version string). */
166   
167 ! #define PATCHLEVEL 38
168   
169   #endif /* _PATCHLEVEL_H_ */
170 --- 26,30 ----
171      looks for to find the patch level (for the sccs version string). */
172   
173 ! #define PATCHLEVEL 39
174   
175   #endif /* _PATCHLEVEL_H_ */