diff --git a/bash-5.0-patch-12.patch b/bash-5.0-patch-12.patch new file mode 100644 index 0000000..3b383b1 --- /dev/null +++ b/bash-5.0-patch-12.patch @@ -0,0 +1,56 @@ +From b0852fb54efbcee630847fcfdc435133f82043b9 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 15:16:28 -0500 +Subject: [PATCH] Bash-5.0 patch 12: fix problems moving back beyond start of + history + +--- + lib/readline/misc.c | 5 ++++- + patchlevel.h | 2 +- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/lib/readline/misc.c b/lib/readline/misc.c +index 64b1457d..42005b0c 100644 +--- a/lib/readline/misc.c ++++ b/lib/readline/misc.c +@@ -576,6 +576,7 @@ int + rl_get_previous_history (int count, int key) + { + HIST_ENTRY *old_temp, *temp; ++ int had_saved_line; + + if (count < 0) + return (rl_get_next_history (-count, key)); +@@ -588,6 +589,7 @@ rl_get_previous_history (int count, int key) + _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point; + + /* If we don't have a line saved, then save this one. */ ++ had_saved_line = _rl_saved_line_for_history != 0; + rl_maybe_save_line (); + + /* If the current line has changed, save the changes. */ +@@ -611,7 +613,8 @@ rl_get_previous_history (int count, int key) + + if (temp == 0) + { +- rl_maybe_unsave_line (); ++ if (had_saved_line == 0) ++ _rl_free_saved_history_line (); + rl_ding (); + } + else +diff --git a/patchlevel.h b/patchlevel.h +index 772676c8..93dbe0db 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 11 ++#define PATCHLEVEL 12 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.25.1 + diff --git a/bash-5.0-patch-13.patch b/bash-5.0-patch-13.patch new file mode 100644 index 0000000..f9060ae --- /dev/null +++ b/bash-5.0-patch-13.patch @@ -0,0 +1,62 @@ +From f747f9ff4c8aed2d51fa54db3cb10e8118034753 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 15:17:29 -0500 +Subject: [PATCH] Bash-5.0 patch 13: reading history entries with timestamps + can result in joined entries + +--- + lib/readline/histfile.c | 15 ++++++++++++++- + patchlevel.h | 2 +- + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c +index a8a92aa3..6c3adc9b 100644 +--- a/lib/readline/histfile.c ++++ b/lib/readline/histfile.c +@@ -369,9 +369,11 @@ read_history_range (const char *filename, int from, int to) + } + + has_timestamps = HIST_TIMESTAMP_START (buffer); +- history_multiline_entries += has_timestamps && history_write_timestamps; ++ history_multiline_entries += has_timestamps && history_write_timestamps; + + /* Skip lines until we are at FROM. */ ++ if (has_timestamps) ++ last_ts = buffer; + for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++) + if (*line_end == '\n') + { +@@ -380,7 +382,18 @@ read_history_range (const char *filename, int from, int to) + line. We should check more extensively here... */ + if (HIST_TIMESTAMP_START(p) == 0) + current_line++; ++ else ++ last_ts = p; + line_start = p; ++ /* If we are at the last line (current_line == from) but we have ++ timestamps (has_timestamps), then line_start points to the ++ text of the last command, and we need to skip to its end. */ ++ if (current_line >= from && has_timestamps) ++ { ++ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++) ++ ; ++ line_start = (*line_end == '\n') ? line_end + 1 : line_end; ++ } + } + + /* If there are lines left to gobble, then gobble them now. */ +diff --git a/patchlevel.h b/patchlevel.h +index 93dbe0db..779671cd 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 12 ++#define PATCHLEVEL 13 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.25.1 + diff --git a/bash-5.0-patch-14.patch b/bash-5.0-patch-14.patch new file mode 100644 index 0000000..efc0ee5 --- /dev/null +++ b/bash-5.0-patch-14.patch @@ -0,0 +1,44 @@ +From 8b6524c482573ea12eb20be756cdb8ca31d945f3 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 15:18:41 -0500 +Subject: [PATCH] Bash-5.0 patch 14: edit-and-execute-command does not handle + empty command lines + +--- + bashline.c | 7 ++----- + patchlevel.h | 2 +- + 2 files changed, 3 insertions(+), 6 deletions(-) + +diff --git a/bashline.c b/bashline.c +index 824ea9d9..97adaa0f 100644 +--- a/bashline.c ++++ b/bashline.c +@@ -961,11 +961,8 @@ edit_and_execute_command (count, c, editing_mode, edit_command) + /* This breaks down when using command-oriented history and are not + finished with the command, so we should not ignore the last command */ + using_history (); +- if (rl_line_buffer[0]) +- { +- current_command_line_count++; /* for rl_newline above */ +- bash_add_history (rl_line_buffer); +- } ++ current_command_line_count++; /* for rl_newline above */ ++ bash_add_history (rl_line_buffer); + current_command_line_count = 0; /* for dummy history entry */ + bash_add_history (""); + history_lines_this_session++; +diff --git a/patchlevel.h b/patchlevel.h +index 779671cd..09a3cc84 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 13 ++#define PATCHLEVEL 14 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.25.1 + diff --git a/bash-5.0-patch-15.patch b/bash-5.0-patch-15.patch new file mode 100644 index 0000000..ce5e72f --- /dev/null +++ b/bash-5.0-patch-15.patch @@ -0,0 +1,64 @@ +From ad1b3e68229273b4983b607c5eeb56551536c583 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 15:19:53 -0500 +Subject: [PATCH] Bash-5.0 patch 15: aliases and -c commands can cause + premature termination + +--- + builtins/evalstring.c | 6 ++++-- + patchlevel.h | 2 +- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/builtins/evalstring.c b/builtins/evalstring.c +index cadc9bc0..2f13a66a 100644 +--- a/builtins/evalstring.c ++++ b/builtins/evalstring.c +@@ -91,6 +91,7 @@ should_suppress_fork (command) + return (startup_state == 2 && parse_and_execute_level == 1 && + running_trap == 0 && + *bash_input.location.string == '\0' && ++ parser_expanding_alias () == 0 && + command->type == cm_simple && + signal_is_trapped (EXIT_TRAP) == 0 && + signal_is_trapped (ERROR_TRAP) == 0 && +@@ -105,6 +106,7 @@ can_optimize_connection (command) + COMMAND *command; + { + return (*bash_input.location.string == '\0' && ++ parser_expanding_alias () == 0 && + (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') && + command->value.Connection->second->type == cm_simple); + } +@@ -290,7 +292,7 @@ parse_and_execute (string, from_file, flags) + + with_input_from_string (string, from_file); + clear_shell_input_line (); +- while (*(bash_input.location.string)) ++ while (*(bash_input.location.string) || parser_expanding_alias ()) + { + command = (COMMAND *)NULL; + +@@ -545,7 +547,7 @@ parse_string (string, from_file, flags, endp) + ostring = string; + + with_input_from_string (string, from_file); +- while (*(bash_input.location.string)) ++ while (*(bash_input.location.string)) /* XXX - parser_expanding_alias () ? */ + { + command = (COMMAND *)NULL; + +diff --git a/patchlevel.h b/patchlevel.h +index 09a3cc84..6e9ed3fc 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 14 ++#define PATCHLEVEL 15 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.25.1 + diff --git a/bash-5.0-patch-16.patch b/bash-5.0-patch-16.patch new file mode 100644 index 0000000..a5e710d --- /dev/null +++ b/bash-5.0-patch-16.patch @@ -0,0 +1,53 @@ +From 6c6454cb18d7cd30b3b26d5ba6479431e599f3ed Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Feb 2020 15:20:38 -0500 +Subject: [PATCH] Bash-5.0 patch 16: bash waits too long to reap /dev/fd + process substitutions with loops and group commands + +--- + execute_cmd.c | 16 ++++++++++++++++ + patchlevel.h | 2 +- + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/execute_cmd.c b/execute_cmd.c +index f1d74bfe..3864986d 100644 +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -1103,6 +1103,22 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, + free ((void *)ofifo_list); + discard_unwind_frame ("internal_fifos"); + } ++# if defined (HAVE_DEV_FD) ++ /* Reap process substitutions at the end of loops */ ++ switch (command->type) ++ { ++ case cm_while: ++ case cm_until: ++ case cm_for: ++ case cm_group: ++# if defined (ARITH_FOR_COMMAND) ++ case cm_arith_for: ++# endif ++ reap_procsubs (); ++ default: ++ break; ++ } ++# endif /* HAVE_DEV_FD */ + #endif + + /* Invert the return value if we have to */ +diff --git a/patchlevel.h b/patchlevel.h +index 6e9ed3fc..9074f4dd 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 15 ++#define PATCHLEVEL 16 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.25.1 + diff --git a/bash-5.0-patch-17.patch b/bash-5.0-patch-17.patch new file mode 100644 index 0000000..bca2d4d --- /dev/null +++ b/bash-5.0-patch-17.patch @@ -0,0 +1,213 @@ +From 9e49d343e3cd7e20dad1b86ebfb764e8027596a7 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 24 Apr 2020 11:05:06 -0400 +Subject: [PATCH] Bash-5.0 patch 17: better fix for reaping process + substitution file descriptors + +--- + execute_cmd.c | 26 ++++++-------------------- + patchlevel.h | 2 +- + subst.c | 35 +++++++++++++++++++++-------------- + subst.h | 5 ++--- + 4 files changed, 30 insertions(+), 38 deletions(-) + +diff --git a/execute_cmd.c b/execute_cmd.c +index 3864986d..4a05758d 100644 +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -564,7 +564,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, + volatile int save_line_number; + #if defined (PROCESS_SUBSTITUTION) + volatile int ofifo, nfifo, osize, saved_fifo; +- volatile char *ofifo_list; ++ volatile void *ofifo_list; + #endif + + if (breaking || continuing) +@@ -750,12 +750,14 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, + reap_procsubs (); + # endif + +- if (variable_context != 0) /* XXX - also if sourcelevel != 0? */ ++ /* XXX - also if sourcelevel != 0? */ ++ if (variable_context != 0) + { + ofifo = num_fifos (); + ofifo_list = copy_fifo_list ((int *)&osize); + begin_unwind_frame ("internal_fifos"); +- add_unwind_protect (xfree, ofifo_list); ++ if (ofifo_list) ++ add_unwind_protect (xfree, ofifo_list); + saved_fifo = 1; + } + else +@@ -1099,26 +1101,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, + { + nfifo = num_fifos (); + if (nfifo > ofifo) +- close_new_fifos ((char *)ofifo_list, osize); ++ close_new_fifos ((void *)ofifo_list, osize); + free ((void *)ofifo_list); + discard_unwind_frame ("internal_fifos"); + } +-# if defined (HAVE_DEV_FD) +- /* Reap process substitutions at the end of loops */ +- switch (command->type) +- { +- case cm_while: +- case cm_until: +- case cm_for: +- case cm_group: +-# if defined (ARITH_FOR_COMMAND) +- case cm_arith_for: +-# endif +- reap_procsubs (); +- default: +- break; +- } +-# endif /* HAVE_DEV_FD */ + #endif + + /* Invert the return value if we have to */ +diff --git a/patchlevel.h b/patchlevel.h +index 9074f4dd..98e714da 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 16 ++#define PATCHLEVEL 17 + + #endif /* _PATCHLEVEL_H_ */ +diff --git a/subst.c b/subst.c +index fd6db240..8884b487 100644 +--- a/subst.c ++++ b/subst.c +@@ -5336,13 +5336,13 @@ clear_fifo_list () + { + } + +-char * ++void * + copy_fifo_list (sizep) + int *sizep; + { + if (sizep) + *sizep = 0; +- return (char *)NULL; ++ return (void *)NULL; + } + + static void +@@ -5408,8 +5408,13 @@ unlink_fifo_list () + for (i = j = 0; i < nfifo; i++) + if (fifo_list[i].file) + { +- fifo_list[j].file = fifo_list[i].file; +- fifo_list[j].proc = fifo_list[i].proc; ++ if (i != j) ++ { ++ fifo_list[j].file = fifo_list[i].file; ++ fifo_list[j].proc = fifo_list[i].proc; ++ fifo_list[i].file = (char *)NULL; ++ fifo_list[i].proc = 0; ++ } + j++; + } + nfifo = j; +@@ -5425,10 +5430,11 @@ unlink_fifo_list () + case it's larger than fifo_list_size (size of fifo_list). */ + void + close_new_fifos (list, lsize) +- char *list; ++ void *list; + int lsize; + { + int i; ++ char *plist; + + if (list == 0) + { +@@ -5436,8 +5442,8 @@ close_new_fifos (list, lsize) + return; + } + +- for (i = 0; i < lsize; i++) +- if (list[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1) ++ for (plist = (char *)list, i = 0; i < lsize; i++) ++ if (plist[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1) + unlink_fifo (i); + + for (i = lsize; i < fifo_list_size; i++) +@@ -5559,22 +5565,22 @@ clear_fifo_list () + nfds = 0; + } + +-char * ++void * + copy_fifo_list (sizep) + int *sizep; + { +- char *ret; ++ void *ret; + + if (nfds == 0 || totfds == 0) + { + if (sizep) + *sizep = 0; +- return (char *)NULL; ++ return (void *)NULL; + } + + if (sizep) + *sizep = totfds; +- ret = (char *)xmalloc (totfds * sizeof (pid_t)); ++ ret = xmalloc (totfds * sizeof (pid_t)); + return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t))); + } + +@@ -5647,10 +5653,11 @@ unlink_fifo_list () + totfds (size of dev_fd_list). */ + void + close_new_fifos (list, lsize) +- char *list; ++ void *list; + int lsize; + { + int i; ++ pid_t *plist; + + if (list == 0) + { +@@ -5658,8 +5665,8 @@ close_new_fifos (list, lsize) + return; + } + +- for (i = 0; i < lsize; i++) +- if (list[i] == 0 && i < totfds && dev_fd_list[i]) ++ for (plist = (pid_t *)list, i = 0; i < lsize; i++) ++ if (plist[i] == 0 && i < totfds && dev_fd_list[i]) + unlink_fifo (i); + + for (i = lsize; i < totfds; i++) +diff --git a/subst.h b/subst.h +index 34763222..faf831bd 100644 +--- a/subst.h ++++ b/subst.h +@@ -273,9 +273,8 @@ extern int num_fifos __P((void)); + extern void unlink_fifo_list __P((void)); + extern void unlink_fifo __P((int)); + +-extern char *copy_fifo_list __P((int *)); +-extern void unlink_new_fifos __P((char *, int)); +-extern void close_new_fifos __P((char *, int)); ++extern void *copy_fifo_list __P((int *)); ++extern void close_new_fifos __P((void *, int)); + + extern void clear_fifo_list __P((void)); + +-- +2.25.1 + diff --git a/bash.spec b/bash.spec index 30975a6..fcb0da3 100644 --- a/bash.spec +++ b/bash.spec @@ -1,12 +1,12 @@ #% define beta_tag rc2 -%define patchleveltag .11 +%define patchleveltag .17 %define baseversion 5.0 %bcond_without tests Version: %{baseversion}%{patchleveltag} Name: bash Summary: The GNU Bourne Again shell -Release: 2%{?dist} +Release: 1%{?dist} License: GPLv3+ Url: https://www.gnu.org/software/bash Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz @@ -20,7 +20,7 @@ Source3: dot-bash_logout # Official upstream patches # Patches are converted to apply with '-p1' -%{lua:for i=1,11 do print(string.format("Patch%u: bash-5.0-patch-%u.patch\n", i, i)) end} +%{lua:for i=1,17 do print(string.format("Patch%u: bash-5.0-patch-%u.patch\n", i, i)) end} # Other patches # We don't want to add '/etc:/usr/etc' in standard utils path. @@ -308,6 +308,9 @@ end %{_libdir}/pkgconfig/%{name}.pc %changelog +* Mon Jun 01 2020 situ - 5.0.17-1 +- Update to bash-5.0 patchlevel 17 + * Tue Jan 28 2020 Fedora Release Engineering - 5.0.11-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild