diff --git a/bash-5.1-sw.patch b/bash-5.1-sw.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ba225309205a5c09e4eb3047e9483727fa60d5b --- /dev/null +++ b/bash-5.1-sw.patch @@ -0,0 +1,122 @@ +diff -Nuar bash-5.1.8.org/configure bash-5.1.8.sw/configure +--- bash-5.1.8.org/configure 2021-10-15 16:12:05.691193735 +0800 ++++ bash-5.1.8.sw/configure 2021-10-15 16:32:01.231145759 +0800 +@@ -2890,6 +2890,7 @@ + case "${host_cpu}-${host_os}" in + # mostly obsolete platforms + alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux ++sw_64*-*) opt_bash_malloc=no ;; # sw_64 running osf/1 or linux + *[Cc]ray*-*) opt_bash_malloc=no ;; # Crays + *-osf1*) opt_bash_malloc=no ;; # other osf/1 machines + *-dgux*) opt_bash_malloc=no ;; # DG/UX machines +@@ -7875,7 +7876,7 @@ + + # Guess based on the CPU. + case "$host_cpu" in +- alpha* | i[34567]86 | x86_64 | m68k | s390*) ++ sw_64* | alpha* | i[34567]86 | x86_64 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; +diff -Nuar bash-5.1.8.org/configure.ac bash-5.1.8.sw/configure.ac +--- bash-5.1.8.org/configure.ac 2021-10-15 16:12:05.727193733 +0800 ++++ bash-5.1.8.sw/configure.ac 2021-10-15 16:32:26.167144759 +0800 +@@ -65,6 +65,7 @@ + case "${host_cpu}-${host_os}" in + # mostly obsolete platforms + alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux ++sw_64*-*) opt_bash_malloc=no ;; # sw_64 running osf/1 or linux + *[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays + *-osf1*) opt_bash_malloc=no ;; # other osf/1 machines + *-dgux*) opt_bash_malloc=no ;; # DG/UX machines +diff -Nuar bash-5.1.8.org/general.h bash-5.1.8.sw/general.h +--- bash-5.1.8.org/general.h 2021-10-15 16:12:05.726193734 +0800 ++++ bash-5.1.8.sw/general.h 2021-10-15 16:28:55.053153230 +0800 +@@ -57,7 +57,7 @@ + /* Hardly used anymore */ + #define pointer_to_int(x) (int)((char *)x - (char *)0) + +-#if defined (alpha) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__) ++#if (defined (alpha) || defined (sw_64)) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__) + extern char *strchr (), *strrchr (); + #endif + +diff -Nuar bash-5.1.8.org/lib/intl/dcigettext.c bash-5.1.8.sw/lib/intl/dcigettext.c +--- bash-5.1.8.org/lib/intl/dcigettext.c 2021-10-15 16:12:05.686193735 +0800 ++++ bash-5.1.8.sw/lib/intl/dcigettext.c 2021-10-15 16:28:45.480153615 +0800 +@@ -74,7 +74,7 @@ + #ifdef _LIBC + /* Guess whether integer division by zero raises signal SIGFPE. + Set to 1 only if you know for sure. In case of doubt, set to 0. */ +-# if defined __alpha__ || defined __arm__ || defined __i386__ \ ++# if defined __alpha__ || defined __sw_64__ || defined __arm__ || defined __i386__ \ + || defined __m68k__ || defined __s390__ + # define INTDIV0_RAISES_SIGFPE 1 + # else +diff -Nuar bash-5.1.8.org/m4/host-cpu-c-abi.m4 bash-5.1.8.sw/m4/host-cpu-c-abi.m4 +--- bash-5.1.8.org/m4/host-cpu-c-abi.m4 2021-10-15 16:12:05.726193734 +0800 ++++ bash-5.1.8.sw/m4/host-cpu-c-abi.m4 2021-10-15 16:26:05.539160033 +0800 +@@ -91,6 +91,12 @@ + ;; + + changequote(,)dnl ++ sw_64* ) ++changequote([,])dnl ++ gl_cv_host_cpu_c_abi=sw_64 ++ ;; ++ ++changequote(,)dnl + alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) + changequote([,])dnl + gl_cv_host_cpu_c_abi=alpha +@@ -355,6 +361,9 @@ + #ifndef __x86_64__ + #undef __x86_64__ + #endif ++#ifndef __sw_64__ ++#undef __sw_64__ ++#endif + #ifndef __alpha__ + #undef __alpha__ + #endif +diff -Nuar bash-5.1.8.org/m4/intdiv0.m4 bash-5.1.8.sw/m4/intdiv0.m4 +--- bash-5.1.8.org/m4/intdiv0.m4 2021-10-15 16:12:05.726193734 +0800 ++++ bash-5.1.8.sw/m4/intdiv0.m4 2021-10-15 16:25:19.697161872 +0800 +@@ -69,7 +69,7 @@ + # Guess based on the CPU. + changequote(,)dnl + case "$host_cpu" in +- alpha* | i[34567]86 | x86_64 | m68k | s390*) ++ sw_64* | alpha* | i[34567]86 | x86_64 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; +diff -Nuar bash-5.1.8.org/support/config.guess bash-5.1.8.sw/support/config.guess +--- bash-5.1.8.org/support/config.guess 2021-10-15 16:12:05.690193735 +0800 ++++ bash-5.1.8.sw/support/config.guess 2021-10-15 16:21:57.441169989 +0800 +@@ -924,6 +924,14 @@ + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; ++ sw_64:Linux:*:*) ++ case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi ++ echo "$UNAME_MACHINE"-sunway-linux-"$LIBC" ++ exit ;; + alpha:Linux:*:*) + case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in + EV5) UNAME_MACHINE=alphaev5 ;; +diff -Nuar bash-5.1.8.org/support/config.sub bash-5.1.8.sw/support/config.sub +--- bash-5.1.8.org/support/config.sub 2021-10-15 16:12:05.690193735 +0800 ++++ bash-5.1.8.sw/support/config.sub 2021-10-15 16:18:49.228177541 +0800 +@@ -1160,6 +1160,7 @@ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ ++ | sw_64 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ diff --git a/bash.spec b/bash.spec index b15a5b30bdfc0a9b88907115ef209c0075874ce9..df4493afeb1f887440593335a4af6012e0c19f5c 100644 --- a/bash.spec +++ b/bash.spec @@ -1,6 +1,6 @@ Name: bash Version: 5.1.8 -Release: 2 +Release: 4 Summary: It is the Bourne Again Shell License: GPLv3 URL: https://www.gnu.org/software/bash @@ -23,6 +23,7 @@ Patch134: bash-4.3-memleak-lc_all.patch Patch137: bugfix-Forbidden-non-root-user-to-clear-history.patch Patch138: enable-dot-logout-and-source-bashrc-through-ssh.patch Patch139: cd-alias.patch +Patch140: bash-5.1-sw.patch BuildRequires: gcc bison texinfo autoconf ncurses-devel # Required for bash tests @@ -116,6 +117,12 @@ make check %exclude %{_infodir}/dir %changelog +* Mon Aug 15 2022 panxiaohe - 5.1.8-4 +- fix bugfix-Forbidden-non-root-user-to-clear-history.patch + +* Wed Jul 20 2022 wuzx - 5.1.8-3 +- add sw64 patch + * Wed Jul 6 2022 zoulin - 5.1.8-2 - Type:enhancement - ID:NA @@ -140,14 +147,14 @@ make check - SUG:NA - DESC:upgrade to 5.1 -* Thu Mar 30 2021 shenyangyang - 5.0-17 +* Tue Mar 30 2021 shenyangyang - 5.0-17 - Type:bugfix - ID:NA - SUG:NA - DESC:Rebuild for openEuler-rpm-config moving /usr/lib/rpm/openEuler/xxxx to /usr/lib/xxxx -* Wed Jan 6 2020 Liquor - 5.0-16 +* Wed Jan 6 2021 Liquor - 5.0-16 - Type:bugfix - ID:NA - SUG:NA diff --git a/bugfix-Forbidden-non-root-user-to-clear-history.patch b/bugfix-Forbidden-non-root-user-to-clear-history.patch index 932e20c00f7e3059617db040655f4dc882601dd5..7c97f4d2e436dd5c47a3d226d291e409494a351c 100644 --- a/bugfix-Forbidden-non-root-user-to-clear-history.patch +++ b/bugfix-Forbidden-non-root-user-to-clear-history.patch @@ -4,23 +4,66 @@ Date: Mon, 2 Sep 2019 22:30:32 -0400 Subject: [PATCH] bugfix-Forbidden-non-root-user-to-clear-history --- - lib/readline/history.c | 4 ++++ - 1 file changed, 4 insertions(+) + bashhist.c | 5 +++-- + lib/readline/history.c | 8 +++++++- + lib/readline/history.h | 2 +- + 3 files changed, 11 insertions(+), 4 deletions(-) +diff --git a/bashhist.c b/bashhist.c +index d2155dc..e61bde6 100644 +--- a/bashhist.c ++++ b/bashhist.c +@@ -345,8 +345,9 @@ load_history () + void + bash_clear_history () + { +- clear_history (); +- history_lines_this_session = 0; ++ int ret = clear_history (); ++ if (ret == 0) ++ history_lines_this_session = 0; + /* XXX - reset history_lines_read_from_file? */ + } + diff --git a/lib/readline/history.c b/lib/readline/history.c -index 67158b1..8bc6a00 100644 +index 67158b1..3c1652b 100644 --- a/lib/readline/history.c +++ b/lib/readline/history.c -@@ -594,6 +594,10 @@ void +@@ -590,9 +590,14 @@ history_is_stifled (void) + return (history_stifled); + } + +-void ++int clear_history (void) { - register int i; + uid_t uid = getuid(); + + if (uid) -+ return; ++ return 1; ++ + register int i; /* This loses because we cannot free the data. */ - for (i = 0; i < history_length; i++) +@@ -604,4 +609,5 @@ clear_history (void) + + history_offset = history_length = 0; + history_base = 1; /* reset history base to default */ ++ return 0; + } +diff --git a/lib/readline/history.h b/lib/readline/history.h +index cc3de29..78f8f52 100644 +--- a/lib/readline/history.h ++++ b/lib/readline/history.h +@@ -110,7 +110,7 @@ extern histdata_t free_history_entry PARAMS((HIST_ENTRY *)); + extern HIST_ENTRY *replace_history_entry PARAMS((int, const char *, histdata_t)); + + /* Clear the history list and start over. */ +-extern void clear_history PARAMS((void)); ++extern int clear_history PARAMS((void)); + + /* Stifle the history list, remembering only MAX number of entries. */ + extern void stifle_history PARAMS((int)); -- -2.19.1 +2.27.0 +