Browse Source

bash: Update to 4.3.33

Signed-off-by: Marcel Denia <naoir@gmx.net>
Marcel Denia 9 years ago
parent
commit
25e6fcbb85

+ 1
- 1
utils/bash/Makefile View File

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
10 10
 BASE_VERSION:=4.3
11 11
 
12 12
 PKG_NAME:=bash
13
-PKG_VERSION:=$(BASE_VERSION).30
13
+PKG_VERSION:=$(BASE_VERSION).33
14 14
 PKG_RELEASE:=1
15 15
 
16 16
 PKG_SOURCE:=$(PKG_NAME)-$(BASE_VERSION).tar.gz

+ 1
- 1
utils/bash/patches/122-upstream-bash43-022.patch View File

@@ -17,7 +17,7 @@ Patch (apply with `patch -p0'):
17 17
 
18 18
 --- a/execute_cmd.c
19 19
 +++ b/execute_cmd.c
20
-@@ -2413,7 +2413,16 @@ execute_pipeline (command, asynchronous,
20
+@@ -2409,7 +2409,16 @@ execute_pipeline (command, asynchronous,
21 21
  #endif
22 22
        lstdin = wait_for (lastpid);
23 23
  #if defined (JOB_CONTROL)

+ 96
- 0
utils/bash/patches/131-upstream-bash43-031.patch View File

@@ -0,0 +1,96 @@
1
+			     BASH PATCH REPORT
2
+			     =================
3
+
4
+Bash-Release:	4.3
5
+Patch-ID:	bash43-031
6
+
7
+Bug-Reported-by:	lolilolicon <lolilolicon@gmail.com>
8
+Bug-Reference-ID:	<CAMtVo_Nz=32Oq=zWTb6=+8gUNXOo2rRvud1W4oPnA-cgVk_ZqQ@mail.gmail.com>
9
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00139.html
10
+
11
+Bug-Description:
12
+
13
+The new nameref assignment functionality introduced in bash-4.3 did not perform
14
+enough validation on the variable value and would create variables with
15
+invalid names.
16
+
17
+Patch (apply with `patch -p0'):
18
+
19
+--- a/subst.h
20
++++ b/subst.h
21
+@@ -47,6 +47,7 @@
22
+ #define ASS_MKASSOC	0x0004
23
+ #define ASS_MKGLOBAL	0x0008	/* force global assignment */
24
+ #define ASS_NAMEREF	0x0010	/* assigning to nameref variable */
25
++#define ASS_FROMREF	0x0020	/* assigning from value of nameref variable */
26
+ 
27
+ /* Flags for the string extraction functions. */
28
+ #define SX_NOALLOC	0x0001	/* just skip; don't return substring */
29
+--- a/variables.c
30
++++ b/variables.c
31
+@@ -2516,10 +2516,27 @@ bind_variable_internal (name, value, tab
32
+      HASH_TABLE *table;
33
+      int hflags, aflags;
34
+ {
35
+-  char *newval;
36
++  char *newname, *newval;
37
+   SHELL_VAR *entry;
38
++#if defined (ARRAY_VARS)
39
++  arrayind_t ind;
40
++  char *subp;
41
++  int sublen;
42
++#endif
43
+ 
44
++  newname = 0;
45
++#if defined (ARRAY_VARS)
46
++  if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name))
47
++    {
48
++      newname = array_variable_name (name, &subp, &sublen);
49
++      if (newname == 0)
50
++	return (SHELL_VAR *)NULL;	/* XXX */
51
++      entry = hash_lookup (newname, table);
52
++    }
53
++  else
54
++#endif
55
+   entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table);
56
++
57
+   /* Follow the nameref chain here if this is the global variables table */
58
+   if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table)
59
+     {
60
+@@ -2550,6 +2567,16 @@ bind_variable_internal (name, value, tab
61
+       var_setvalue (entry, make_variable_value (entry, value, 0));
62
+       }
63
+     }
64
++#if defined (ARRAY_VARS)
65
++  else if (entry == 0 && newname)
66
++    {
67
++      entry = make_new_array_variable (newname);	/* indexed array by default */
68
++      if (entry == 0)
69
++	return entry;
70
++      ind = array_expand_index (name, subp, sublen);
71
++      bind_array_element (entry, ind, value, aflags);
72
++    }
73
++#endif
74
+   else if (entry == 0)
75
+     {
76
+       entry = make_new_variable (name, table);
77
+@@ -2670,7 +2697,8 @@ bind_variable (name, value, flags)
78
+ 			 normal. */
79
+ 		      if (nameref_cell (nv) == 0)
80
+ 			return (bind_variable_internal (nv->name, value, nvc->table, 0, flags));
81
+-		      return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags));
82
++		      /* XXX - bug here with ref=array[index] */
83
++		      return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags|ASS_FROMREF));
84
+ 		    }
85
+ 		  else
86
+ 		    v = nv;
87
+--- a/patchlevel.h
88
++++ b/patchlevel.h
89
+@@ -25,6 +25,6 @@
90
+    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
91
+    looks for to find the patch level (for the sccs version string). */
92
+ 
93
+-#define PATCHLEVEL 30
94
++#define PATCHLEVEL 31
95
+ 
96
+ #endif /* _PATCHLEVEL_H_ */

+ 42
- 0
utils/bash/patches/132-upstream-bash43-032.patch View File

@@ -0,0 +1,42 @@
1
+			     BASH PATCH REPORT
2
+			     =================
3
+
4
+Bash-Release:	4.3
5
+Patch-ID:	bash43-032
6
+
7
+Bug-Reported-by:	crispusfairbairn@gmail.com
8
+Bug-Reference-ID:	<b5e499f7-3b98-408d-9f94-c0387580e73a@googlegroups.com>
9
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00013.html
10
+
11
+Bug-Description:
12
+
13
+When bash is running in Posix mode, it allows signals -- including SIGCHLD --
14
+to interrupt the `wait' builtin, as Posix requires.  However, the interrupt
15
+causes bash to not run a SIGCHLD trap for all exited children.  This patch
16
+fixes the issue and restores the documented behavior in Posix mode.
17
+
18
+Patch (apply with `patch -p0'):
19
+
20
+--- a/jobs.c
21
++++ b/jobs.c
22
+@@ -3339,7 +3339,9 @@ itrace("waitchld: waitpid returns %d blo
23
+       if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin)
24
+ 	{
25
+ 	  interrupt_immediately = 0;
26
+-	  trap_handler (SIGCHLD);	/* set pending_traps[SIGCHLD] */
27
++	  /* This was trap_handler (SIGCHLD) but that can lose traps if
28
++	     children_exited > 1 */
29
++	  queue_sigchld_trap (children_exited);
30
+ 	  wait_signal_received = SIGCHLD;
31
+ 	  /* If we're in a signal handler, let CHECK_WAIT_INTR pick it up;
32
+ 	     run_pending_traps will call run_sigchld_trap later  */
33
+--- a/patchlevel.h
34
++++ b/patchlevel.h
35
+@@ -25,6 +25,6 @@
36
+    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
37
+    looks for to find the patch level (for the sccs version string). */
38
+ 
39
+-#define PATCHLEVEL 31
40
++#define PATCHLEVEL 32
41
+ 
42
+ #endif /* _PATCHLEVEL_H_ */

+ 201
- 0
utils/bash/patches/133-upstream-bash43-033.patch View File

@@ -0,0 +1,201 @@
1
+			     BASH PATCH REPORT
2
+			     =================
3
+
4
+Bash-Release:	4.3
5
+Patch-ID:	bash43-033
6
+
7
+Bug-Reported-by:	mickael9@gmail.com, Jan Rome <jan.rome@gmail.com>
8
+Bug-Reference-ID:	<20140907224046.382ED3610CC@mickael-laptop.localdomain>,
9
+			<540D661D.50908@gmail.com>
10
+Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00029.html
11
+			http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00030.html
12
+
13
+Bug-Description:
14
+
15
+Bash does not clean up the terminal state in all cases where bash or
16
+readline  modifies it and bash is subsequently terminated by a fatal signal.
17
+This happens when the `read' builtin modifies the terminal settings, both
18
+when readline is active and when it is not.  It occurs most often when a script
19
+installs a trap that exits on a signal without re-sending the signal to itself.
20
+
21
+Patch (apply with `patch -p0'):
22
+
23
+--- a/shell.c
24
++++ b/shell.c
25
+@@ -73,6 +73,7 @@
26
+ #endif
27
+ 
28
+ #if defined (READLINE)
29
++#  include <readline/readline.h>
30
+ #  include "bashline.h"
31
+ #endif
32
+ 
33
+@@ -909,6 +910,14 @@ exit_shell (s)
34
+   fflush (stdout);		/* XXX */
35
+   fflush (stderr);
36
+ 
37
++  /* Clean up the terminal if we are in a state where it's been modified. */
38
++#if defined (READLINE)
39
++  if (RL_ISSTATE (RL_STATE_TERMPREPPED) && rl_deprep_term_function)
40
++    (*rl_deprep_term_function) ();
41
++#endif
42
++  if (read_tty_modified ())
43
++    read_tty_cleanup ();
44
++
45
+   /* Do trap[0] if defined.  Allow it to override the exit status
46
+      passed to us. */
47
+   if (signal_is_trapped (0))
48
+--- a/builtins/read.def
49
++++ b/builtins/read.def
50
+@@ -140,10 +140,12 @@ static void reset_alarm __P((void));
51
+ procenv_t alrmbuf;
52
+ int sigalrm_seen;
53
+ 
54
+-static int reading;
55
++static int reading, tty_modified;
56
+ static SigHandler *old_alrm;
57
+ static unsigned char delim;
58
+ 
59
++static struct ttsave termsave;
60
++
61
+ /* In all cases, SIGALRM just sets a flag that we check periodically.  This
62
+    avoids problems with the semi-tricky stuff we do with the xfree of
63
+    input_string at the top of the unwind-protect list (see below). */
64
+@@ -188,7 +190,6 @@ read_builtin (list)
65
+   struct stat tsb;
66
+   SHELL_VAR *var;
67
+   TTYSTRUCT ttattrs, ttset;
68
+-  struct ttsave termsave;
69
+ #if defined (ARRAY_VARS)
70
+   WORD_LIST *alist;
71
+ #endif
72
+@@ -221,7 +222,7 @@ read_builtin (list)
73
+   USE_VAR(ps2);
74
+   USE_VAR(lastsig);
75
+ 
76
+-  sigalrm_seen = reading = 0;
77
++  sigalrm_seen = reading = tty_modified = 0;
78
+ 
79
+   i = 0;		/* Index into the string that we are reading. */
80
+   raw = edit = 0;	/* Not reading raw input by default. */
81
+@@ -438,6 +439,8 @@ read_builtin (list)
82
+ 	  retval = 128+SIGALRM;
83
+ 	  goto assign_vars;
84
+ 	}
85
++      if (interactive_shell == 0)
86
++	initialize_terminating_signals ();
87
+       old_alrm = set_signal_handler (SIGALRM, sigalrm);
88
+       add_unwind_protect (reset_alarm, (char *)NULL);
89
+ #if defined (READLINE)
90
+@@ -482,7 +485,10 @@ read_builtin (list)
91
+ 	  i = silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset);
92
+ 	  if (i < 0)
93
+ 	    sh_ttyerror (1);
94
++	  tty_modified = 1;
95
+ 	  add_unwind_protect ((Function *)ttyrestore, (char *)&termsave);
96
++	  if (interactive_shell == 0)
97
++	    initialize_terminating_signals ();
98
+ 	}
99
+     }
100
+   else if (silent)	/* turn off echo but leave term in canonical mode */
101
+@@ -497,7 +503,10 @@ read_builtin (list)
102
+       if (i < 0)
103
+ 	sh_ttyerror (1);
104
+ 
105
++      tty_modified = 1;
106
+       add_unwind_protect ((Function *)ttyrestore, (char *)&termsave);
107
++      if (interactive_shell == 0)
108
++	initialize_terminating_signals ();
109
+     }
110
+ 
111
+   /* This *must* be the top unwind-protect on the stack, so the manipulation
112
+@@ -588,6 +597,8 @@ read_builtin (list)
113
+ 	    }
114
+ 	  else
115
+ 	    lastsig = 0;
116
++	  if (terminating_signal && tty_modified)
117
++	    ttyrestore (&termsave);	/* fix terminal before exiting */
118
+ 	  CHECK_TERMSIG;
119
+ 	  eof = 1;
120
+ 	  break;
121
+@@ -978,6 +989,20 @@ ttyrestore (ttp)
122
+      struct ttsave *ttp;
123
+ {
124
+   ttsetattr (ttp->fd, ttp->attrs);
125
++  tty_modified = 0;
126
++}
127
++
128
++void
129
++read_tty_cleanup ()
130
++{
131
++  if (tty_modified)
132
++    ttyrestore (&termsave);
133
++}
134
++
135
++int
136
++read_tty_modified ()
137
++{
138
++  return (tty_modified);
139
+ }
140
+ 
141
+ #if defined (READLINE)
142
+--- a/builtins/common.h
143
++++ b/builtins/common.h
144
+@@ -122,6 +122,10 @@ extern void bash_logout __P((void));
145
+ /* Functions from getopts.def */
146
+ extern void getopts_reset __P((int));
147
+ 
148
++/* Functions from read.def */
149
++extern void read_tty_cleanup __P((void));
150
++extern int read_tty_modified __P((void));
151
++
152
+ /* Functions from set.def */
153
+ extern int minus_o_option_value __P((char *));
154
+ extern void list_minus_o_opts __P((int, int));
155
+--- a/bashline.c
156
++++ b/bashline.c
157
+@@ -202,6 +202,7 @@ extern int current_command_line_count, s
158
+ extern int last_command_exit_value;
159
+ extern int array_needs_making;
160
+ extern int posixly_correct, no_symbolic_links;
161
++extern int sigalrm_seen;
162
+ extern char *current_prompt_string, *ps1_prompt;
163
+ extern STRING_INT_ALIST word_token_alist[];
164
+ extern sh_builtin_func_t *last_shell_builtin, *this_shell_builtin;
165
+@@ -4208,8 +4209,9 @@ bash_event_hook ()
166
+ {
167
+   /* If we're going to longjmp to top_level, make sure we clean up readline.
168
+      check_signals will call QUIT, which will eventually longjmp to top_level,
169
+-     calling run_interrupt_trap along the way. */
170
+-  if (interrupt_state)
171
++     calling run_interrupt_trap along the way.  The check for sigalrm_seen is
172
++     to clean up the read builtin's state. */
173
++  if (terminating_signal || interrupt_state || sigalrm_seen)
174
+     rl_cleanup_after_signal ();
175
+   bashline_reset_event_hook ();
176
+   check_signals_and_traps ();	/* XXX */
177
+--- a/sig.c
178
++++ b/sig.c
179
+@@ -532,8 +532,10 @@ termsig_sighandler (sig)
180
+ #if defined (READLINE)
181
+   /* Set the event hook so readline will call it after the signal handlers
182
+      finish executing, so if this interrupted character input we can get
183
+-     quick response. */
184
+-  if (interactive_shell && interactive && no_line_editing == 0)
185
++     quick response.  If readline is active or has modified the terminal we
186
++     need to set this no matter what the signal is, though the check for
187
++     RL_STATE_TERMPREPPED is possibly redundant. */
188
++  if (RL_ISSTATE (RL_STATE_SIGHANDLER) || RL_ISSTATE (RL_STATE_TERMPREPPED))
189
+     bashline_set_event_hook ();
190
+ #endif
191
+ 
192
+--- a/patchlevel.h
193
++++ b/patchlevel.h
194
+@@ -25,6 +25,6 @@
195
+    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
196
+    looks for to find the patch level (for the sccs version string). */
197
+ 
198
+-#define PATCHLEVEL 32
199
++#define PATCHLEVEL 33
200
+ 
201
+ #endif /* _PATCHLEVEL_H_ */