Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS-8602 update bash to 5.2 #138

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/bash/bash-4.3.30-32
/bash/bash-5.2-32
/bind/bind-9.10.1-P1-32
/binutils/binutils-2.34-32*
/bzip2/bzip2-1.0.6*
Expand Down
2 changes: 1 addition & 1 deletion bash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Copyright (c) 2012, Joyent Inc. All rights reserved.
#

VER = bash-4.3.30
VER = bash-5.2

include ../Makefile.defs

Expand Down
46 changes: 46 additions & 0 deletions bash/Patches/bash52-001.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
BASH PATCH REPORT
=================

Bash-Release: 5.2
Patch-ID: bash52-001

Bug-Reported-by: Emanuele Torre <[email protected]>
Bug-Reference-ID: <CAA7hNqeR1eSdiGK8mjQSqJPo815JYoG-Ekz-5PrAJTEYy2e6hg@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-09/msg00060.html

Bug-Description:

Expanding unset arrays in an arithmetic context can cause a segmentation fault.

Patch (apply with `patch -p1'):

*** a/subst.c 2022-08-31 17:36:46.000000000 -0400
--- b/subst.c 2022-09-30 09:12:05.000000000 -0400
***************
*** 10858,10862 ****
t = expand_subscript_string (exp, quoted & ~(Q_ARITH|Q_DOUBLE_QUOTES));
free (exp);
! exp = sh_backslash_quote (t, abstab, 0);
free (t);

--- 10858,10862 ----
t = expand_subscript_string (exp, quoted & ~(Q_ARITH|Q_DOUBLE_QUOTES));
free (exp);
! exp = t ? sh_backslash_quote (t, abstab, 0) : savestring ("");
free (t);

*** a/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- b/patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 0

#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 1

#endif /* _PATCHLEVEL_H_ */
46 changes: 46 additions & 0 deletions bash/Patches/bash52-002.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
BASH PATCH REPORT
=================

Bash-Release: 5.2
Patch-ID: bash52-002

Bug-Reported-by: Kan-Ru Chen <[email protected]>
Bug-Reference-ID:
Bug-Reference-URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021109

Bug-Description:

Starting bash with an invalid locale specification for LC_ALL/LANG/LC_CTYPE
can cause the shell to crash.

Patch (apply with `patch -p1'):

*** a/lib/readline/nls.c 2022-08-15 09:38:51.000000000 -0400
--- b/lib/readline/nls.c 2022-10-05 09:23:22.000000000 -0400
***************
*** 142,145 ****
--- 142,149 ----
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
+ if (ret == 0 || *ret == 0)
+ ret = setlocale (LC_CTYPE, (char *)NULL);
+ if (ret == 0 || *ret == 0)
+ ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;

*** a/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- b/patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 1

#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 2

#endif /* _PATCHLEVEL_H_ */
89 changes: 89 additions & 0 deletions bash/Patches/bash52-003.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
BASH PATCH REPORT
=================

Bash-Release: 5.2
Patch-ID: bash52-003

Bug-Reported-by: D630 <[email protected]>
Bug-Reference-ID: <[email protected]>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00092.html

Bug-Description:

Command substitutions need to preserve newlines instead of replacing them
with semicolons, especially in the presence of multiple here-documents.

Patch (apply with `patch -p1'):

*** a/print_cmd.c 2022-07-26 09:16:39.000000000 -0400
--- b/print_cmd.c 2022-10-17 10:41:06.000000000 -0400
***************
*** 298,305 ****
--- 298,307 ----
{
char c = command->value.Connection->connector;
+ int was_newline;

s[0] = printing_comsub ? c : ';';
s[1] = '\0';

+ was_newline = deferred_heredocs == 0 && was_heredoc == 0 && c == '\n';
if (deferred_heredocs == 0)
{
***************
*** 315,318 ****
--- 317,322 ----
if (inside_function_def)
cprintf ("\n");
+ else if (printing_comsub && c == '\n' && was_newline == 0)
+ cprintf ("\n"); /* preserve newlines in comsubs but don't double them */
else
{
***************
*** 1366,1370 ****
}
else
! newline ("}");

dispose_command (cmdcopy);
--- 1371,1379 ----
}
else
! {
! /* { */
! newline ("}");
! was_heredoc = 0; /* not printing any here-documents now */
! }

dispose_command (cmdcopy);
***************
*** 1443,1447 ****
}
else
! newline ("}");

result = the_printed_command;
--- 1452,1459 ----
}
else
! { /* { */
! newline ("}");
! was_heredoc = 0;
! }

result = the_printed_command;
*** a/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- b/patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 2

#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 3

#endif /* _PATCHLEVEL_H_ */
70 changes: 70 additions & 0 deletions bash/Patches/bash52-004.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
BASH PATCH REPORT
=================

Bash-Release: 5.2
Patch-ID: bash52-004

Bug-Reported-by: Antoine <[email protected]>
Bug-Reference-ID: <[email protected]>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00022.html

Bug-Description:

Bash needs to keep better track of nested brace expansions to avoid problems
with quoting and POSIX semantics.

Patch (apply with `patch -p1'):

*** a/subst.c 2022-10-05 10:22:02.000000000 -0400
--- b/subst.c 2022-10-06 15:19:08.000000000 -0400
***************
*** 1799,1802 ****
--- 1804,1810 ----
}

+ #define PARAMEXPNEST_MAX 32 // for now
+ static int dbstate[PARAMEXPNEST_MAX];
+
/* Extract a parameter expansion expression within ${ and } from STRING.
Obey the Posix.2 rules for finding the ending `}': count braces while
***************
*** 1829,1832 ****
--- 1837,1842 ----
return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));

+ dbstate[0] = dolbrace_state;
+
pass_character = 0;
nesting_level = 1;
***************
*** 1853,1856 ****
--- 1863,1868 ----
if (string[i] == '$' && string[i+1] == LBRACE)
{
+ if (nesting_level < PARAMEXPNEST_MAX)
+ dbstate[nesting_level] = dolbrace_state;
nesting_level++;
i += 2;
***************
*** 1865,1868 ****
--- 1877,1881 ----
if (nesting_level == 0)
break;
+ dolbrace_state = (nesting_level < PARAMEXPNEST_MAX) ? dbstate[nesting_level] : dbstate[0]; /* Guess using initial state */
i++;
continue;
*** a/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- b/patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 3

#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 4

#endif /* _PATCHLEVEL_H_ */
47 changes: 47 additions & 0 deletions bash/Patches/bash52-005.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
BASH PATCH REPORT
=================

Bash-Release: 5.2
Patch-ID: bash52-005

Bug-Reported-by: Justin Wood (Callek) <[email protected]>
Bug-Reference-ID: <CANBDKY9fp2yiXONP7RY4kNuRteuovUebxSJaqePHeu7cyaFS9Q@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00088.html

Bug-Description:

Null pattern substitution replacement strings can cause a crash.

Patch (apply with `patch -p1'):

*** a/subst.c 2022-10-05 10:22:02.000000000 -0400
--- b/subst.c 2022-10-13 16:57:26.000000000 -0400
***************
*** 8966,8970 ****
}
else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
! return ((mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2) : savestring (rep));

ret = (char *)xmalloc (rsize = 64);
--- 8966,8971 ----
}
else if (*string == 0 && (match_pattern (string, pat, mtype, &s, &e) != 0))
! return (mflags & MATCH_EXPREP) ? strcreplace (rep, '&', "", 2)
! : (rep ? savestring (rep) : savestring (""));

ret = (char *)xmalloc (rsize = 64);
*** a/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- b/patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 4

#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 5

#endif /* _PATCHLEVEL_H_ */
Loading