From 4c2c2e354ac8a438dd09c544b2acebaf2b282dea Mon Sep 17 00:00:00 2001 From: licihua Date: Wed, 8 Apr 2020 20:53:53 +0800 Subject: [PATCH 1/5] add upstream patches --- bash-5.0-patch12.patch | 54 ++++++++++++++++++++++++++++++++++++ bash-5.0-patch13.patch | 60 ++++++++++++++++++++++++++++++++++++++++ bash-5.0-patch14.patch | 42 ++++++++++++++++++++++++++++ bash-5.0-patch15.patch | 62 ++++++++++++++++++++++++++++++++++++++++++ bash-5.0-patch16.patch | 50 ++++++++++++++++++++++++++++++++++ bash.spec | 34 ++++++++++++++++------- 6 files changed, 292 insertions(+), 10 deletions(-) create mode 100644 bash-5.0-patch12.patch create mode 100644 bash-5.0-patch13.patch create mode 100644 bash-5.0-patch14.patch create mode 100644 bash-5.0-patch15.patch create mode 100644 bash-5.0-patch16.patch diff --git a/bash-5.0-patch12.patch b/bash-5.0-patch12.patch new file mode 100644 index 0000000..fb885d3 --- /dev/null +++ b/bash-5.0-patch12.patch @@ -0,0 +1,54 @@ + +author Chet Ramey 2020-02-07 15:16:28 -0500 +committer Chet Ramey 2020-02-07 15:16:28 -0500 +commit b0852fb54efbcee630847fcfdc435133f82043b9 (patch) +tree b573556243ddd6eb448a39fb0d4dc44630e16e42 +parent d894cfd104086ddf68c286e67a5fb2e02eb43b7b (diff) +download bash-b0852fb54efbcee630847fcfdc435133f82043b9.tar.gz +Bash-5.0 patch 12: fix problems moving back beyond start of history +Diffstat +-rw-r--r-- lib/readline/misc.c 5 +-rw-r--r-- 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_ */ \ No newline at end of file diff --git a/bash-5.0-patch13.patch b/bash-5.0-patch13.patch new file mode 100644 index 0000000..5bafb36 --- /dev/null +++ b/bash-5.0-patch13.patch @@ -0,0 +1,60 @@ + +author Chet Ramey 2020-02-07 15:17:29 -0500 +committer Chet Ramey 2020-02-07 15:17:29 -0500 +commit f747f9ff4c8aed2d51fa54db3cb10e8118034753 (patch) +tree e0cc02859e5d03ec7a6dfd18a9663295f8b8e7ba +parent b0852fb54efbcee630847fcfdc435133f82043b9 (diff) +download bash-f747f9ff4c8aed2d51fa54db3cb10e8118034753.tar.gz +Bash-5.0 patch 13: reading history entries with timestamps can result in joined entries +Diffstat +-rw-r--r-- lib/readline/histfile.c 15 +-rw-r--r-- 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_ */ diff --git a/bash-5.0-patch14.patch b/bash-5.0-patch14.patch new file mode 100644 index 0000000..cf7c74b --- /dev/null +++ b/bash-5.0-patch14.patch @@ -0,0 +1,42 @@ + +author Chet Ramey 2020-02-07 15:18:41 -0500 +committer Chet Ramey 2020-02-07 15:18:41 -0500 +commit 8b6524c482573ea12eb20be756cdb8ca31d945f3 (patch) +tree db2dfe353344050dba07dff77391d0792988b105 +parent f747f9ff4c8aed2d51fa54db3cb10e8118034753 (diff) +download bash-8b6524c482573ea12eb20be756cdb8ca31d945f3.tar.gz +Bash-5.0 patch 14: edit-and-execute-command does not handle empty command lines +Diffstat +-rw-r--r-- bashline.c 7 +-rw-r--r-- 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_ */ \ No newline at end of file diff --git a/bash-5.0-patch15.patch b/bash-5.0-patch15.patch new file mode 100644 index 0000000..c74173d --- /dev/null +++ b/bash-5.0-patch15.patch @@ -0,0 +1,62 @@ + +author Chet Ramey 2020-02-07 15:19:53 -0500 +committer Chet Ramey 2020-02-07 15:19:53 -0500 +commit ad1b3e68229273b4983b607c5eeb56551536c583 (patch) +tree b4b89fb13929b42a51740b2a6b50e387bede1779 +parent 8b6524c482573ea12eb20be756cdb8ca31d945f3 (diff) +download bash-ad1b3e68229273b4983b607c5eeb56551536c583.tar.gz +Bash-5.0 patch 15: aliases and -c commands can cause premature termination +Diffstat +-rw-r--r-- builtins/evalstring.c 6 +-rw-r--r-- 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_ */ \ No newline at end of file diff --git a/bash-5.0-patch16.patch b/bash-5.0-patch16.patch new file mode 100644 index 0000000..d77439f --- /dev/null +++ b/bash-5.0-patch16.patch @@ -0,0 +1,50 @@ +author Chet Ramey 2020-02-07 15:20:38 -0500 +committer Chet Ramey 2020-02-07 15:20:38 -0500 +commit 6c6454cb18d7cd30b3b26d5ba6479431e599f3ed (patch) +tree f5bf71122c75efe5409dffc888cea930a6d9ea49 +parent ad1b3e68229273b4983b607c5eeb56551536c583 (diff) +download bash-6c6454cb18d7cd30b3b26d5ba6479431e599f3ed.tar.gz +Bash-5.0 patch 16: bash waits too long to reap /dev/fd process substitutions with loops and group commandsHEADmaster +Diffstat +-rw-r--r-- execute_cmd.c 16 +-rw-r--r-- patchlevel.h 2 +2 files changed, 17 insertions, 1 deletions +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_ */ \ No newline at end of file diff --git a/bash.spec b/bash.spec index f3e1d61..3be201b 100644 --- a/bash.spec +++ b/bash.spec @@ -22,21 +22,28 @@ Patch8: bash-5.0-patch8.patch Patch9: bash-5.0-patch9.patch Patch10: bash-5.0-patch10.patch Patch11: bash-5.0-patch11.patch +Patch12: bash-5.0-patch12.patch +Patch13: bash-5.0-patch13.patch +Patch14: bash-5.0-patch14.patch +Patch15: bash-5.0-patch15.patch +Patch16: bash-5.0-patch16.patch -Patch15: bash-2.05a-interpreter.patch -Patch18: bash-2.05b-pgrp_sync.patch -Patch25: bash-4.0-nobits.patch -Patch29: bash-4.2-coverity.patch + + +Patch115: bash-2.05a-interpreter.patch +Patch118: bash-2.05b-pgrp_sync.patch +Patch125: bash-4.0-nobits.patch +Patch129: bash-4.2-coverity.patch # rh1102815 -Patch33: bash-4.3-noecho.patch +Patch133: bash-4.3-noecho.patch # fix bash leaks memory when LC_ALL set-rh1241533,rh1224855 -Patch34: bash-4.3-memleak-lc_all.patch +Patch134: bash-4.3-memleak-lc_all.patch # https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=951bdaad7a18cc0dc1036bba86b18b90874d39ff -Patch35: CVE-2019-18276.patch +Patch135: CVE-2019-18276.patch # https://github.com/bminor/bash/commit/db26b1cf58aab63c39fd5665590cad3cb75eab72.patch -Patch36: commit-bash-20190913-snapshot.patch -Patch37:bugfix-Forbidden-non-root-user-to-clear-history.patch -Patch38:enable-dot-logout-and-source-bashrc-through-ssh.patch +Patch136: commit-bash-20190913-snapshot.patch +Patch137:bugfix-Forbidden-non-root-user-to-clear-history.patch +Patch138:enable-dot-logout-and-source-bashrc-through-ssh.patch BuildRequires: gcc bison texinfo autoconf ncurses-devel @@ -122,6 +129,13 @@ make check %{_mandir}/man1/*.gz %exclude %{_infodir}/dir +%changelog +* Wed April 8 2020 openEuler Buildteam - 5.0-13 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:add upstream patches + %changelog * Thu Mar 19 2020 openEuler Buildteam - 5.0-12 - Type:enhancement -- Gitee From bac55fac9abf11fb19a9c619be6fb5d5daec6421 Mon Sep 17 00:00:00 2001 From: licihua Date: Wed, 8 Apr 2020 21:27:08 +0800 Subject: [PATCH 2/5] delte blank line --- bash-5.0-patch12.patch | 1 - bash-5.0-patch13.patch | 1 - bash-5.0-patch14.patch | 1 - bash-5.0-patch15.patch | 1 - 4 files changed, 4 deletions(-) diff --git a/bash-5.0-patch12.patch b/bash-5.0-patch12.patch index fb885d3..012213b 100644 --- a/bash-5.0-patch12.patch +++ b/bash-5.0-patch12.patch @@ -1,4 +1,3 @@ - author Chet Ramey 2020-02-07 15:16:28 -0500 committer Chet Ramey 2020-02-07 15:16:28 -0500 commit b0852fb54efbcee630847fcfdc435133f82043b9 (patch) diff --git a/bash-5.0-patch13.patch b/bash-5.0-patch13.patch index 5bafb36..f69a61a 100644 --- a/bash-5.0-patch13.patch +++ b/bash-5.0-patch13.patch @@ -1,4 +1,3 @@ - author Chet Ramey 2020-02-07 15:17:29 -0500 committer Chet Ramey 2020-02-07 15:17:29 -0500 commit f747f9ff4c8aed2d51fa54db3cb10e8118034753 (patch) diff --git a/bash-5.0-patch14.patch b/bash-5.0-patch14.patch index cf7c74b..babd88b 100644 --- a/bash-5.0-patch14.patch +++ b/bash-5.0-patch14.patch @@ -1,4 +1,3 @@ - author Chet Ramey 2020-02-07 15:18:41 -0500 committer Chet Ramey 2020-02-07 15:18:41 -0500 commit 8b6524c482573ea12eb20be756cdb8ca31d945f3 (patch) diff --git a/bash-5.0-patch15.patch b/bash-5.0-patch15.patch index c74173d..60fb6e5 100644 --- a/bash-5.0-patch15.patch +++ b/bash-5.0-patch15.patch @@ -1,4 +1,3 @@ - author Chet Ramey 2020-02-07 15:19:53 -0500 committer Chet Ramey 2020-02-07 15:19:53 -0500 commit ad1b3e68229273b4983b607c5eeb56551536c583 (patch) -- Gitee From 7084ce9410a6c31592fc138d0ba0b19c10420f7e Mon Sep 17 00:00:00 2001 From: licihua Date: Thu, 9 Apr 2020 11:12:23 +0800 Subject: [PATCH 3/5] ad upstream patch --- bash-5.0-patch12.patch | 3 --- bash-5.0-patch13.patch | 3 --- bash-5.0-patch14.patch | 3 --- bash-5.0-patch15.patch | 3 --- bash-5.0-patch16.patch | 3 --- 5 files changed, 15 deletions(-) diff --git a/bash-5.0-patch12.patch b/bash-5.0-patch12.patch index 012213b..34a9a49 100644 --- a/bash-5.0-patch12.patch +++ b/bash-5.0-patch12.patch @@ -5,9 +5,6 @@ tree b573556243ddd6eb448a39fb0d4dc44630e16e42 parent d894cfd104086ddf68c286e67a5fb2e02eb43b7b (diff) download bash-b0852fb54efbcee630847fcfdc435133f82043b9.tar.gz Bash-5.0 patch 12: fix problems moving back beyond start of history -Diffstat --rw-r--r-- lib/readline/misc.c 5 --rw-r--r-- 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 diff --git a/bash-5.0-patch13.patch b/bash-5.0-patch13.patch index f69a61a..65b2dee 100644 --- a/bash-5.0-patch13.patch +++ b/bash-5.0-patch13.patch @@ -5,9 +5,6 @@ tree e0cc02859e5d03ec7a6dfd18a9663295f8b8e7ba parent b0852fb54efbcee630847fcfdc435133f82043b9 (diff) download bash-f747f9ff4c8aed2d51fa54db3cb10e8118034753.tar.gz Bash-5.0 patch 13: reading history entries with timestamps can result in joined entries -Diffstat --rw-r--r-- lib/readline/histfile.c 15 --rw-r--r-- 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 diff --git a/bash-5.0-patch14.patch b/bash-5.0-patch14.patch index babd88b..fd66d05 100644 --- a/bash-5.0-patch14.patch +++ b/bash-5.0-patch14.patch @@ -5,9 +5,6 @@ tree db2dfe353344050dba07dff77391d0792988b105 parent f747f9ff4c8aed2d51fa54db3cb10e8118034753 (diff) download bash-8b6524c482573ea12eb20be756cdb8ca31d945f3.tar.gz Bash-5.0 patch 14: edit-and-execute-command does not handle empty command lines -Diffstat --rw-r--r-- bashline.c 7 --rw-r--r-- patchlevel.h 2 2 files changed, 3 insertions, 6 deletions diff --git a/bashline.c b/bashline.c index 824ea9d9..97adaa0f 100644 diff --git a/bash-5.0-patch15.patch b/bash-5.0-patch15.patch index 60fb6e5..284565d 100644 --- a/bash-5.0-patch15.patch +++ b/bash-5.0-patch15.patch @@ -5,9 +5,6 @@ tree b4b89fb13929b42a51740b2a6b50e387bede1779 parent 8b6524c482573ea12eb20be756cdb8ca31d945f3 (diff) download bash-ad1b3e68229273b4983b607c5eeb56551536c583.tar.gz Bash-5.0 patch 15: aliases and -c commands can cause premature termination -Diffstat --rw-r--r-- builtins/evalstring.c 6 --rw-r--r-- patchlevel.h 2 2 files changed, 5 insertions, 3 deletions diff --git a/builtins/evalstring.c b/builtins/evalstring.c index cadc9bc0..2f13a66a 100644 diff --git a/bash-5.0-patch16.patch b/bash-5.0-patch16.patch index d77439f..44cc6a2 100644 --- a/bash-5.0-patch16.patch +++ b/bash-5.0-patch16.patch @@ -5,9 +5,6 @@ tree f5bf71122c75efe5409dffc888cea930a6d9ea49 parent ad1b3e68229273b4983b607c5eeb56551536c583 (diff) download bash-6c6454cb18d7cd30b3b26d5ba6479431e599f3ed.tar.gz Bash-5.0 patch 16: bash waits too long to reap /dev/fd process substitutions with loops and group commandsHEADmaster -Diffstat --rw-r--r-- execute_cmd.c 16 --rw-r--r-- patchlevel.h 2 2 files changed, 17 insertions, 1 deletions diff --git a/execute_cmd.c b/execute_cmd.c index f1d74bfe..3864986d 100644 -- Gitee From 8bd97ea5ba7c5013f3f9272f7a4a1050ae72aa7b Mon Sep 17 00:00:00 2001 From: licihua Date: Thu, 9 Apr 2020 11:13:50 +0800 Subject: [PATCH 4/5] change date --- bash.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bash.spec b/bash.spec index 3be201b..18fa85e 100644 --- a/bash.spec +++ b/bash.spec @@ -130,13 +130,12 @@ make check %exclude %{_infodir}/dir %changelog -* Wed April 8 2020 openEuler Buildteam - 5.0-13 +* Wed Apr 8 2020 openEuler Buildteam - 5.0-13 - Type:enhancement - ID:NA - SUG:NA - DESC:add upstream patches -%changelog * Thu Mar 19 2020 openEuler Buildteam - 5.0-12 - Type:enhancement - ID:NA -- Gitee From 2900b2e3816e7f71c53f767b2c8323e7f0704a7e Mon Sep 17 00:00:00 2001 From: licihua Date: Thu, 9 Apr 2020 14:27:03 +0800 Subject: [PATCH 5/5] change patch -- Gitee