From 539b6c43ad7798b7b400ac9246ebe855661bd5fa Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 24 Jun 2010 10:05:26 +0000 Subject: [PATCH 1/9] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=38 --- bash-4.1-edit-parser-state.patch | 46 +++++++++++++++++++++ bash-4.1-pipe.dif | 70 ++++++++++++++++++++++++++++++++ bash.changes | 15 +++++++ bash.spec | 7 +++- 4 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 bash-4.1-edit-parser-state.patch create mode 100644 bash-4.1-pipe.dif diff --git a/bash-4.1-edit-parser-state.patch b/bash-4.1-edit-parser-state.patch new file mode 100644 index 00000000..ae9f4d75 --- /dev/null +++ b/bash-4.1-edit-parser-state.patch @@ -0,0 +1,46 @@ +|On 3/30/10 2:36 AM, Clark J. Wang wrote: +|> Good news: +|> +|> I met this problem again a few minutes ago. Then I looked back to find out +|> what I was doing. After some investigation I could stably reproduce this +|> problem by following steps (tested with bash 3.1.17, 3.2.39 and 4.1.0): +|> +|> bash$ alias xx='echo 142857' ### Make sure there isn't an external cmd +|> named `xx' +|> bash$ export EDITOR=vi +|> bash$ set -o vi +|> bash$ ### Press ESC to get out of vi's INSERT mode +|> bash$ ### Press v to invoke vi to input a cmd like `ls', save and exit, +|> the `ls' cmd runs. +|> bash$ xx +|> -bash: xx: command not found +|> bash$ xx +|> 142857 +|> bash$ +| +|Thanks for the report. This was exactly what I needed. The fix will be +|in the next release of bash. I've attached a patch for the curious or +|impatient. +| +|Chet +| +*** bashline.c 2010-03-26 12:15:37.000000000 -0400 +--- bashline.c 2010-03-30 23:25:22.000000000 -0400 +*************** +*** 864,867 **** +--- 864,868 ---- + char *command, *metaval; + int r, cclc, rrs, metaflag; ++ sh_parser_state_t ps; + + rrs = rl_readline_state; +*************** +*** 898,902 **** +--- 899,905 ---- + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); ++ save_parser_state (&ps); + r = parse_and_execute (command, (editing_mode == VI_EDITING_MODE) ? "v" : "C-xC-e", SEVAL_NOHIST); ++ restore_parser_state (&ps); + if (rl_prep_term_function) + (*rl_prep_term_function) (metaflag); diff --git a/bash-4.1-pipe.dif b/bash-4.1-pipe.dif new file mode 100644 index 00000000..32ad8f00 --- /dev/null +++ b/bash-4.1-pipe.dif @@ -0,0 +1,70 @@ +--- execute_cmd.c ++++ execute_cmd.c 2010-06-24 09:18:46.858925084 +0200 +@@ -1525,7 +1525,7 @@ static struct cpelement *cpl_search __P( + static struct cpelement *cpl_searchbyname __P((char *)); + static void cpl_prune __P((void)); + +-Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0 }; ++Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0, 0, 0 }; + + cplist_t coproc_list = {0, 0, 0}; + +@@ -2047,13 +2047,19 @@ execute_coproc (command, pipe_in, pipe_o + } + #endif + ++static void restore_stdin(int lstdin) ++{ ++ dup2(lstdin, 0); ++ close(lstdin); ++} ++ + static int + execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close) + COMMAND *command; + int asynchronous, pipe_in, pipe_out; + struct fd_bitmap *fds_to_close; + { +- int prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result; ++ int lstdin, prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result; + COMMAND *cmd; + struct fd_bitmap *fd_bitmap; + +@@ -2148,11 +2154,37 @@ execute_pipeline (command, asynchronous, + /* Now execute the rightmost command in the pipeline. */ + if (ignore_return && cmd) + cmd->flags |= CMD_IGNORE_RETURN; ++ ++ begin_unwind_frame ("pipe-file-descriptors"); ++ lstdin = -1; ++ if (!asynchronous && pipe_out == NO_PIPE && prev > 0) ++ { ++ lstdin = move_to_high_fd(0, 0, 255); ++ if (lstdin > 0) ++ { ++ dup2(prev, 0); ++ close(prev); ++ prev = NO_PIPE; ++ stop_pipeline (0, (COMMAND *)NULL); ++ add_unwind_protect (restore_stdin, lstdin); ++ } ++ } ++ if (prev >= 0) ++ add_unwind_protect (close, prev); ++ + exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close); + ++ if (lstdin > 0) ++ { ++ dup2(lstdin, 0); ++ close(lstdin); ++ } ++ + if (prev >= 0) + close (prev); + ++ discard_unwind_frame ("pipe-file-descriptors"); ++ + #if defined (JOB_CONTROL) + UNBLOCK_CHILD (oset); + #endif diff --git a/bash.changes b/bash.changes index d9b93875..83227e0c 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Thu Jun 24 11:34:48 CEST 2010 - werner@suse.de + +- Add fix from upstream: restore the parser state over changing + readline editing mode otherwise e.g. set alias before the + change are lost. + +------------------------------------------------------------------- +Thu Jun 24 10:40:09 CEST 2010 - werner@suse.de + +- Avoid running the last member of a pipe command sequence to run + in its own subshell, this makes know lines like the simple + echo 1 2 | read a b; echo $a $b + work as expected by the users + ------------------------------------------------------------------- Tue May 25 12:35:03 CEST 2010 - werner@suse.de diff --git a/bash.spec b/bash.spec index 40418196..ca3502b0 100644 --- a/bash.spec +++ b/bash.spec @@ -66,6 +66,8 @@ Patch40: bash-4.1-bash.bashrc.dif Patch41: bash-4.1-intr.dif Patch42: bash-4.1-non_void.patch Patch43: bash-4.1-array.dif +Patch44: bash-4.1-pipe.dif +Patch45: bash-4.1-edit-parser-state.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc %global _incdir %{_includedir} @@ -312,6 +314,8 @@ unset p %patch41 -p0 -b .intr %patch42 -p0 -b .non_void %patch43 -p0 -b .array +%patch44 -p0 -b .pipe +%patch45 -p0 -b .parser %patch0 -p0 cd ../readline-%{rl_vers} for p in ../readline-%{rl_vers}-patches/*; do @@ -481,7 +485,8 @@ cd ../bash-%{bash_vers} $READLINE make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_generate"} \ all printenv recho zecho xcase - env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_LIBRARY_PATH make TESTSCRIPT=%{SOURCE4} check + TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1 + env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_LIBRARY_PATH TMPDIR=$TMPDIR make TESTSCRIPT=%{SOURCE4} check make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_feedback" clean} all make -C examples/loadables/ make documentation From ff7dd2e10b3dd1b0e46d502f9ae2b0adf9f724cf Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 24 Jun 2010 10:45:08 +0000 Subject: [PATCH 2/9] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=39 --- bash.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bash.spec b/bash.spec index ca3502b0..70b6fd84 100644 --- a/bash.spec +++ b/bash.spec @@ -18,7 +18,10 @@ Name: bash -BuildRequires: bison fdupes ncurses-devel +BuildRequires: bison ncurses-devel +%if %suse_version > 1020 +BuildRequires: fdupes +%endif License: GPLv2+ Group: System/Shells %define bash_vers 4.1 @@ -558,7 +561,9 @@ EOF touch -t 199605181720.50 %{buildroot}%{_sysconfdir}/skel/.bash_history chmod 600 %{buildroot}%{_sysconfdir}/skel/.bash_history %find_lang bash +%if %suse_version > 1020 %fdupes -s %{buildroot}%{_datadir}/bash/helpfiles +%endif %post -n bash-doc %install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz From f991935ec67e4425d3be03b935e0ceb29cf5f88d Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 24 Jun 2010 10:48:50 +0000 Subject: [PATCH 3/9] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=40 --- bash.spec | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/bash.spec b/bash.spec index 70b6fd84..b21bae1c 100644 --- a/bash.spec +++ b/bash.spec @@ -347,13 +347,29 @@ cd ../readline-%{rl_vers} cflags () { local flag=$1; shift - case "${RPM_OPT_FLAGS}" in + local var=$1; shift + test -n "${flag}" -a -n "${var}" || return + case "${!var}" in *${flag}*) return esac - if test -n "$1" && gcc -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then - local var=$1; shift - eval $var=\${$var:+\$$var\ }$flag - fi + case "$flag" in + -Wl,*) + set -o noclobber + echo 'int main () { return 0; }' > ldtest.c + if ${CC:-gcc} -Werror $flag -o /dev/null -xc ldtest.c > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + set +o noclobber + rm -f ldtest.c + ;; + *) + if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + esac } echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 - if ./test64 ; then From 3a40388ba6b77a0e46755dbefd33126f37cc7f1b Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 24 Jun 2010 10:54:18 +0000 Subject: [PATCH 4/9] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=41 --- bash.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bash.spec b/bash.spec index b21bae1c..f500e347 100644 --- a/bash.spec +++ b/bash.spec @@ -26,9 +26,11 @@ License: GPLv2+ Group: System/Shells %define bash_vers 4.1 %define rl_vers 6.1 +%if %suse_version > 1020 Recommends: bash-doc = %bash_vers Recommends: bash-lang = %bash_vers Suggests: command-not-found +%endif AutoReqProv: on Version: 4.1 Release: 6 @@ -212,7 +214,9 @@ Group: System/Libraries Provides: bash:/%{_lib}/libreadline.so.%{rl_major} Version: 6.1 Release: 6 +%if %suse_version > 1020 Recommends: readline-doc = %{version} +%endif # bug437293 %ifarch ppc64 Obsoletes: readline-64bit @@ -243,7 +247,9 @@ Version: 6.1 Release: 6 Requires: libreadline6 = %{version} Requires: ncurses-devel +%if %suse_version > 1020 Recommends: readline-doc = %{version} +%endif AutoReqProv: on # bug437293 %ifarch ppc64 From 4153b17265fffefea7686fe33f746974cebbb4f4 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 24 Jun 2010 11:33:39 +0000 Subject: [PATCH 5/9] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=42 --- bash.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bash.spec b/bash.spec index f500e347..9573eb39 100644 --- a/bash.spec +++ b/bash.spec @@ -117,8 +117,18 @@ Authors: -------- Brian Fox Chet Ramey - +%if %{defined lang_package} %lang_package(bash) +%else +%package -n bash-lang +License: GPLv2+ +Summary: Languages for package bash +Group: System/Localization +Provides: bash-lang = %{version} +Requires: bash = %{version} +%description -n bash-lang +Provides translations to the package bash +%endif %package -n bash-devel License: GPLv2+ Summary: Include Files mandatory for Development of bash loadable builtins From b9112d2a88a6be6638177bdf2fd12713ca1dcc5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Sat, 17 Jul 2010 01:39:23 +0000 Subject: [PATCH 6/9] Accepting request 43135 from home:elvigia:branches:Base:System Copy from home:elvigia:branches:Base:System/bash via accept of submit request 43135 revision 2. Request was accepted with message: Reviewed ok OBS-URL: https://build.opensuse.org/request/show/43135 OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=43 --- bash.changes | 6 ++++++ bash.spec | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bash.changes b/bash.changes index 83227e0c..02cd7a11 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Jul 17 01:27:17 UTC 2010 - cristian.rodriguez@opensuse.org + +- Do not package static libraries +- Fix Recommends/Suggests + ------------------------------------------------------------------- Thu Jun 24 11:34:48 CEST 2010 - werner@suse.de diff --git a/bash.spec b/bash.spec index 9573eb39..ca6440e6 100644 --- a/bash.spec +++ b/bash.spec @@ -27,9 +27,10 @@ Group: System/Shells %define bash_vers 4.1 %define rl_vers 6.1 %if %suse_version > 1020 -Recommends: bash-doc = %bash_vers Recommends: bash-lang = %bash_vers +Recommends: bash-completion Suggests: command-not-found +Suggests: bash-doc = %bash_vers %endif AutoReqProv: on Version: 4.1 @@ -414,7 +415,7 @@ cd ../readline-%{rl_vers} CFLAGS_FOR_BUILD="$CFLAGS" LDFLAGS_FOR_BUILD="$LDFLAGS" export CC_FOR_BUILD CFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD CFLAGS LDFLAGS CC - ./configure --build=%{_target_cpu}-suse-linux \ + ./configure --disable-static --build=%{_target_cpu}-suse-linux \ --prefix=%{_prefix} \ --with-curses \ --mandir=%{_mandir} \ @@ -671,9 +672,7 @@ ldd -u -r %{buildroot}%{_libdir}/libreadline.so || true %files -n readline-devel %defattr(-,root,root) %{_incdir}/readline/ -%{_libdir}/libhistory.a %{_libdir}/libhistory.so -%{_libdir}/libreadline.a %{_libdir}/libreadline.so %doc %{_mandir}/man3/readline.3.gz From c2991c1d02f3e3a794156eafd0ee9507d12f72f0 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 19 Jul 2010 07:55:59 +0000 Subject: [PATCH 7/9] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=44 --- bash.changes | 6 ++++++ bash.spec | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bash.changes b/bash.changes index 02cd7a11..93e6ab3e 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jul 19 09:54:50 CEST 2010 - werner@suse.de + +- Comment out recommendation of bash-completion, as I'd like + no to see the bugs of bash-completion in my bugzilla + ------------------------------------------------------------------- Sat Jul 17 01:27:17 UTC 2010 - cristian.rodriguez@opensuse.org diff --git a/bash.spec b/bash.spec index ca6440e6..30205426 100644 --- a/bash.spec +++ b/bash.spec @@ -28,7 +28,9 @@ Group: System/Shells %define rl_vers 6.1 %if %suse_version > 1020 Recommends: bash-lang = %bash_vers -Recommends: bash-completion +# The package bash-completion is a source of +# bugs which will hit at most this package +#Recommends: bash-completion Suggests: command-not-found Suggests: bash-doc = %bash_vers %endif From 5877f747fd9a7a410dc784245000a1944b68a7da Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Mon, 19 Jul 2010 11:22:40 +0000 Subject: [PATCH 8/9] Accepting request 43232 from Base:System checked in (request 43232) OBS-URL: https://build.opensuse.org/request/show/43232 OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=45 --- bash-4.1-edit-parser-state.patch | 46 --------------------- bash-4.1-pipe.dif | 70 -------------------------------- bash.changes | 27 ------------ bash.spec | 67 ++++++------------------------ 4 files changed, 12 insertions(+), 198 deletions(-) delete mode 100644 bash-4.1-edit-parser-state.patch delete mode 100644 bash-4.1-pipe.dif diff --git a/bash-4.1-edit-parser-state.patch b/bash-4.1-edit-parser-state.patch deleted file mode 100644 index ae9f4d75..00000000 --- a/bash-4.1-edit-parser-state.patch +++ /dev/null @@ -1,46 +0,0 @@ -|On 3/30/10 2:36 AM, Clark J. Wang wrote: -|> Good news: -|> -|> I met this problem again a few minutes ago. Then I looked back to find out -|> what I was doing. After some investigation I could stably reproduce this -|> problem by following steps (tested with bash 3.1.17, 3.2.39 and 4.1.0): -|> -|> bash$ alias xx='echo 142857' ### Make sure there isn't an external cmd -|> named `xx' -|> bash$ export EDITOR=vi -|> bash$ set -o vi -|> bash$ ### Press ESC to get out of vi's INSERT mode -|> bash$ ### Press v to invoke vi to input a cmd like `ls', save and exit, -|> the `ls' cmd runs. -|> bash$ xx -|> -bash: xx: command not found -|> bash$ xx -|> 142857 -|> bash$ -| -|Thanks for the report. This was exactly what I needed. The fix will be -|in the next release of bash. I've attached a patch for the curious or -|impatient. -| -|Chet -| -*** bashline.c 2010-03-26 12:15:37.000000000 -0400 ---- bashline.c 2010-03-30 23:25:22.000000000 -0400 -*************** -*** 864,867 **** ---- 864,868 ---- - char *command, *metaval; - int r, cclc, rrs, metaflag; -+ sh_parser_state_t ps; - - rrs = rl_readline_state; -*************** -*** 898,902 **** ---- 899,905 ---- - if (rl_deprep_term_function) - (*rl_deprep_term_function) (); -+ save_parser_state (&ps); - r = parse_and_execute (command, (editing_mode == VI_EDITING_MODE) ? "v" : "C-xC-e", SEVAL_NOHIST); -+ restore_parser_state (&ps); - if (rl_prep_term_function) - (*rl_prep_term_function) (metaflag); diff --git a/bash-4.1-pipe.dif b/bash-4.1-pipe.dif deleted file mode 100644 index 32ad8f00..00000000 --- a/bash-4.1-pipe.dif +++ /dev/null @@ -1,70 +0,0 @@ ---- execute_cmd.c -+++ execute_cmd.c 2010-06-24 09:18:46.858925084 +0200 -@@ -1525,7 +1525,7 @@ static struct cpelement *cpl_search __P( - static struct cpelement *cpl_searchbyname __P((char *)); - static void cpl_prune __P((void)); - --Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0 }; -+Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0, 0, 0 }; - - cplist_t coproc_list = {0, 0, 0}; - -@@ -2047,13 +2047,19 @@ execute_coproc (command, pipe_in, pipe_o - } - #endif - -+static void restore_stdin(int lstdin) -+{ -+ dup2(lstdin, 0); -+ close(lstdin); -+} -+ - static int - execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close) - COMMAND *command; - int asynchronous, pipe_in, pipe_out; - struct fd_bitmap *fds_to_close; - { -- int prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result; -+ int lstdin, prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result; - COMMAND *cmd; - struct fd_bitmap *fd_bitmap; - -@@ -2148,11 +2154,37 @@ execute_pipeline (command, asynchronous, - /* Now execute the rightmost command in the pipeline. */ - if (ignore_return && cmd) - cmd->flags |= CMD_IGNORE_RETURN; -+ -+ begin_unwind_frame ("pipe-file-descriptors"); -+ lstdin = -1; -+ if (!asynchronous && pipe_out == NO_PIPE && prev > 0) -+ { -+ lstdin = move_to_high_fd(0, 0, 255); -+ if (lstdin > 0) -+ { -+ dup2(prev, 0); -+ close(prev); -+ prev = NO_PIPE; -+ stop_pipeline (0, (COMMAND *)NULL); -+ add_unwind_protect (restore_stdin, lstdin); -+ } -+ } -+ if (prev >= 0) -+ add_unwind_protect (close, prev); -+ - exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close); - -+ if (lstdin > 0) -+ { -+ dup2(lstdin, 0); -+ close(lstdin); -+ } -+ - if (prev >= 0) - close (prev); - -+ discard_unwind_frame ("pipe-file-descriptors"); -+ - #if defined (JOB_CONTROL) - UNBLOCK_CHILD (oset); - #endif diff --git a/bash.changes b/bash.changes index 93e6ab3e..d9b93875 100644 --- a/bash.changes +++ b/bash.changes @@ -1,30 +1,3 @@ -------------------------------------------------------------------- -Mon Jul 19 09:54:50 CEST 2010 - werner@suse.de - -- Comment out recommendation of bash-completion, as I'd like - no to see the bugs of bash-completion in my bugzilla - -------------------------------------------------------------------- -Sat Jul 17 01:27:17 UTC 2010 - cristian.rodriguez@opensuse.org - -- Do not package static libraries -- Fix Recommends/Suggests - -------------------------------------------------------------------- -Thu Jun 24 11:34:48 CEST 2010 - werner@suse.de - -- Add fix from upstream: restore the parser state over changing - readline editing mode otherwise e.g. set alias before the - change are lost. - -------------------------------------------------------------------- -Thu Jun 24 10:40:09 CEST 2010 - werner@suse.de - -- Avoid running the last member of a pipe command sequence to run - in its own subshell, this makes know lines like the simple - echo 1 2 | read a b; echo $a $b - work as expected by the users - ------------------------------------------------------------------- Tue May 25 12:35:03 CEST 2010 - werner@suse.de diff --git a/bash.spec b/bash.spec index 30205426..40418196 100644 --- a/bash.spec +++ b/bash.spec @@ -18,22 +18,14 @@ Name: bash -BuildRequires: bison ncurses-devel -%if %suse_version > 1020 -BuildRequires: fdupes -%endif +BuildRequires: bison fdupes ncurses-devel License: GPLv2+ Group: System/Shells %define bash_vers 4.1 %define rl_vers 6.1 -%if %suse_version > 1020 +Recommends: bash-doc = %bash_vers Recommends: bash-lang = %bash_vers -# The package bash-completion is a source of -# bugs which will hit at most this package -#Recommends: bash-completion Suggests: command-not-found -Suggests: bash-doc = %bash_vers -%endif AutoReqProv: on Version: 4.1 Release: 6 @@ -74,8 +66,6 @@ Patch40: bash-4.1-bash.bashrc.dif Patch41: bash-4.1-intr.dif Patch42: bash-4.1-non_void.patch Patch43: bash-4.1-array.dif -Patch44: bash-4.1-pipe.dif -Patch45: bash-4.1-edit-parser-state.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc %global _incdir %{_includedir} @@ -120,18 +110,8 @@ Authors: -------- Brian Fox Chet Ramey -%if %{defined lang_package} + %lang_package(bash) -%else -%package -n bash-lang -License: GPLv2+ -Summary: Languages for package bash -Group: System/Localization -Provides: bash-lang = %{version} -Requires: bash = %{version} -%description -n bash-lang -Provides translations to the package bash -%endif %package -n bash-devel License: GPLv2+ Summary: Include Files mandatory for Development of bash loadable builtins @@ -227,9 +207,7 @@ Group: System/Libraries Provides: bash:/%{_lib}/libreadline.so.%{rl_major} Version: 6.1 Release: 6 -%if %suse_version > 1020 Recommends: readline-doc = %{version} -%endif # bug437293 %ifarch ppc64 Obsoletes: readline-64bit @@ -260,9 +238,7 @@ Version: 6.1 Release: 6 Requires: libreadline6 = %{version} Requires: ncurses-devel -%if %suse_version > 1020 Recommends: readline-doc = %{version} -%endif AutoReqProv: on # bug437293 %ifarch ppc64 @@ -336,8 +312,6 @@ unset p %patch41 -p0 -b .intr %patch42 -p0 -b .non_void %patch43 -p0 -b .array -%patch44 -p0 -b .pipe -%patch45 -p0 -b .parser %patch0 -p0 cd ../readline-%{rl_vers} for p in ../readline-%{rl_vers}-patches/*; do @@ -366,29 +340,13 @@ cd ../readline-%{rl_vers} cflags () { local flag=$1; shift - local var=$1; shift - test -n "${flag}" -a -n "${var}" || return - case "${!var}" in + case "${RPM_OPT_FLAGS}" in *${flag}*) return esac - case "$flag" in - -Wl,*) - set -o noclobber - echo 'int main () { return 0; }' > ldtest.c - if ${CC:-gcc} -Werror $flag -o /dev/null -xc ldtest.c > /dev/null 2>&1 ; then - eval $var=\${$var:+\$$var\ }$flag - fi - set +o noclobber - rm -f ldtest.c - ;; - *) - if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then - eval $var=\${$var:+\$$var\ }$flag - fi - if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then - eval $var=\${$var:+\$$var\ }$flag - fi - esac + if test -n "$1" && gcc -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then + local var=$1; shift + eval $var=\${$var:+\$$var\ }$flag + fi } echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 - if ./test64 ; then @@ -417,7 +375,7 @@ cd ../readline-%{rl_vers} CFLAGS_FOR_BUILD="$CFLAGS" LDFLAGS_FOR_BUILD="$LDFLAGS" export CC_FOR_BUILD CFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD CFLAGS LDFLAGS CC - ./configure --disable-static --build=%{_target_cpu}-suse-linux \ + ./configure --build=%{_target_cpu}-suse-linux \ --prefix=%{_prefix} \ --with-curses \ --mandir=%{_mandir} \ @@ -523,8 +481,7 @@ cd ../bash-%{bash_vers} $READLINE make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_generate"} \ all printenv recho zecho xcase - TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1 - env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_LIBRARY_PATH TMPDIR=$TMPDIR make TESTSCRIPT=%{SOURCE4} check + env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_LIBRARY_PATH make TESTSCRIPT=%{SOURCE4} check make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_feedback" clean} all make -C examples/loadables/ make documentation @@ -596,9 +553,7 @@ EOF touch -t 199605181720.50 %{buildroot}%{_sysconfdir}/skel/.bash_history chmod 600 %{buildroot}%{_sysconfdir}/skel/.bash_history %find_lang bash -%if %suse_version > 1020 %fdupes -s %{buildroot}%{_datadir}/bash/helpfiles -%endif %post -n bash-doc %install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz @@ -674,7 +629,9 @@ ldd -u -r %{buildroot}%{_libdir}/libreadline.so || true %files -n readline-devel %defattr(-,root,root) %{_incdir}/readline/ +%{_libdir}/libhistory.a %{_libdir}/libhistory.so +%{_libdir}/libreadline.a %{_libdir}/libreadline.so %doc %{_mandir}/man3/readline.3.gz From 5adf2442cf5913b632882763ac81be215ea68819 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Mon, 19 Jul 2010 11:22:41 +0000 Subject: [PATCH 9/9] Updating link to change in openSUSE:Factory/bash revision 59.0 OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=799bb46df522d38fe4c41e8edbb76cd6 --- bash-4.1-edit-parser-state.patch | 46 +++++++++++++++++ bash-4.1-pipe.dif | 70 ++++++++++++++++++++++++++ bash.changes | 27 ++++++++++ bash.spec | 84 ++++++++++++++++++++++++-------- 4 files changed, 208 insertions(+), 19 deletions(-) create mode 100644 bash-4.1-edit-parser-state.patch create mode 100644 bash-4.1-pipe.dif diff --git a/bash-4.1-edit-parser-state.patch b/bash-4.1-edit-parser-state.patch new file mode 100644 index 00000000..ae9f4d75 --- /dev/null +++ b/bash-4.1-edit-parser-state.patch @@ -0,0 +1,46 @@ +|On 3/30/10 2:36 AM, Clark J. Wang wrote: +|> Good news: +|> +|> I met this problem again a few minutes ago. Then I looked back to find out +|> what I was doing. After some investigation I could stably reproduce this +|> problem by following steps (tested with bash 3.1.17, 3.2.39 and 4.1.0): +|> +|> bash$ alias xx='echo 142857' ### Make sure there isn't an external cmd +|> named `xx' +|> bash$ export EDITOR=vi +|> bash$ set -o vi +|> bash$ ### Press ESC to get out of vi's INSERT mode +|> bash$ ### Press v to invoke vi to input a cmd like `ls', save and exit, +|> the `ls' cmd runs. +|> bash$ xx +|> -bash: xx: command not found +|> bash$ xx +|> 142857 +|> bash$ +| +|Thanks for the report. This was exactly what I needed. The fix will be +|in the next release of bash. I've attached a patch for the curious or +|impatient. +| +|Chet +| +*** bashline.c 2010-03-26 12:15:37.000000000 -0400 +--- bashline.c 2010-03-30 23:25:22.000000000 -0400 +*************** +*** 864,867 **** +--- 864,868 ---- + char *command, *metaval; + int r, cclc, rrs, metaflag; ++ sh_parser_state_t ps; + + rrs = rl_readline_state; +*************** +*** 898,902 **** +--- 899,905 ---- + if (rl_deprep_term_function) + (*rl_deprep_term_function) (); ++ save_parser_state (&ps); + r = parse_and_execute (command, (editing_mode == VI_EDITING_MODE) ? "v" : "C-xC-e", SEVAL_NOHIST); ++ restore_parser_state (&ps); + if (rl_prep_term_function) + (*rl_prep_term_function) (metaflag); diff --git a/bash-4.1-pipe.dif b/bash-4.1-pipe.dif new file mode 100644 index 00000000..32ad8f00 --- /dev/null +++ b/bash-4.1-pipe.dif @@ -0,0 +1,70 @@ +--- execute_cmd.c ++++ execute_cmd.c 2010-06-24 09:18:46.858925084 +0200 +@@ -1525,7 +1525,7 @@ static struct cpelement *cpl_search __P( + static struct cpelement *cpl_searchbyname __P((char *)); + static void cpl_prune __P((void)); + +-Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0 }; ++Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0, 0, 0 }; + + cplist_t coproc_list = {0, 0, 0}; + +@@ -2047,13 +2047,19 @@ execute_coproc (command, pipe_in, pipe_o + } + #endif + ++static void restore_stdin(int lstdin) ++{ ++ dup2(lstdin, 0); ++ close(lstdin); ++} ++ + static int + execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close) + COMMAND *command; + int asynchronous, pipe_in, pipe_out; + struct fd_bitmap *fds_to_close; + { +- int prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result; ++ int lstdin, prev, fildes[2], new_bitmap_size, dummyfd, ignore_return, exec_result; + COMMAND *cmd; + struct fd_bitmap *fd_bitmap; + +@@ -2148,11 +2154,37 @@ execute_pipeline (command, asynchronous, + /* Now execute the rightmost command in the pipeline. */ + if (ignore_return && cmd) + cmd->flags |= CMD_IGNORE_RETURN; ++ ++ begin_unwind_frame ("pipe-file-descriptors"); ++ lstdin = -1; ++ if (!asynchronous && pipe_out == NO_PIPE && prev > 0) ++ { ++ lstdin = move_to_high_fd(0, 0, 255); ++ if (lstdin > 0) ++ { ++ dup2(prev, 0); ++ close(prev); ++ prev = NO_PIPE; ++ stop_pipeline (0, (COMMAND *)NULL); ++ add_unwind_protect (restore_stdin, lstdin); ++ } ++ } ++ if (prev >= 0) ++ add_unwind_protect (close, prev); ++ + exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close); + ++ if (lstdin > 0) ++ { ++ dup2(lstdin, 0); ++ close(lstdin); ++ } ++ + if (prev >= 0) + close (prev); + ++ discard_unwind_frame ("pipe-file-descriptors"); ++ + #if defined (JOB_CONTROL) + UNBLOCK_CHILD (oset); + #endif diff --git a/bash.changes b/bash.changes index d9b93875..93e6ab3e 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,30 @@ +------------------------------------------------------------------- +Mon Jul 19 09:54:50 CEST 2010 - werner@suse.de + +- Comment out recommendation of bash-completion, as I'd like + no to see the bugs of bash-completion in my bugzilla + +------------------------------------------------------------------- +Sat Jul 17 01:27:17 UTC 2010 - cristian.rodriguez@opensuse.org + +- Do not package static libraries +- Fix Recommends/Suggests + +------------------------------------------------------------------- +Thu Jun 24 11:34:48 CEST 2010 - werner@suse.de + +- Add fix from upstream: restore the parser state over changing + readline editing mode otherwise e.g. set alias before the + change are lost. + +------------------------------------------------------------------- +Thu Jun 24 10:40:09 CEST 2010 - werner@suse.de + +- Avoid running the last member of a pipe command sequence to run + in its own subshell, this makes know lines like the simple + echo 1 2 | read a b; echo $a $b + work as expected by the users + ------------------------------------------------------------------- Tue May 25 12:35:03 CEST 2010 - werner@suse.de diff --git a/bash.spec b/bash.spec index 40418196..629eda9c 100644 --- a/bash.spec +++ b/bash.spec @@ -18,17 +18,25 @@ Name: bash -BuildRequires: bison fdupes ncurses-devel +BuildRequires: bison ncurses-devel +%if %suse_version > 1020 +BuildRequires: fdupes +%endif License: GPLv2+ Group: System/Shells %define bash_vers 4.1 %define rl_vers 6.1 -Recommends: bash-doc = %bash_vers +%if %suse_version > 1020 Recommends: bash-lang = %bash_vers +# The package bash-completion is a source of +# bugs which will hit at most this package +#Recommends: bash-completion Suggests: command-not-found +Suggests: bash-doc = %bash_vers +%endif AutoReqProv: on Version: 4.1 -Release: 6 +Release: 7 Summary: The GNU Bourne-Again Shell Url: http://www.gnu.org/software/bash/bash.html Source0: ftp://ftp.gnu.org/gnu/bash/bash-%{bash_vers}.tar.bz2 @@ -66,6 +74,8 @@ Patch40: bash-4.1-bash.bashrc.dif Patch41: bash-4.1-intr.dif Patch42: bash-4.1-non_void.patch Patch43: bash-4.1-array.dif +Patch44: bash-4.1-pipe.dif +Patch45: bash-4.1-edit-parser-state.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc %global _incdir %{_includedir} @@ -94,7 +104,7 @@ Group: Documentation/Man Provides: bash:%{_infodir}/bash.info.gz PreReq: %install_info_prereq Version: 4.1 -Release: 6 +Release: 7 AutoReqProv: on %if %suse_version > 1120 BuildArch: noarch @@ -110,14 +120,27 @@ Authors: -------- Brian Fox Chet Ramey - +%if %{defined lang_package} %lang_package(bash) +%else + +%package -n bash-lang +License: GPLv2+ +Summary: Languages for package bash +Group: System/Localization +Provides: bash-lang = %{version} +Requires: bash = %{version} + +%description -n bash-lang +Provides translations to the package bash +%endif + %package -n bash-devel License: GPLv2+ Summary: Include Files mandatory for Development of bash loadable builtins Group: Development/Languages/C and C++ Version: 4.1 -Release: 6 +Release: 7 AutoReqProv: on %description -n bash-devel @@ -137,7 +160,7 @@ License: GPLv2+ Summary: Loadable bash builtins Group: System/Shells Version: 4.1 -Release: 6 +Release: 7 AutoReqProv: on %description -n bash-loadables @@ -206,8 +229,10 @@ Summary: The Readline Library Group: System/Libraries Provides: bash:/%{_lib}/libreadline.so.%{rl_major} Version: 6.1 -Release: 6 +Release: 7 +%if %suse_version > 1020 Recommends: readline-doc = %{version} +%endif # bug437293 %ifarch ppc64 Obsoletes: readline-64bit @@ -235,10 +260,12 @@ Summary: Include Files and Libraries mandatory for Development Group: Development/Libraries/C and C++ Provides: bash:%{_libdir}/libreadline.a Version: 6.1 -Release: 6 +Release: 7 Requires: libreadline6 = %{version} Requires: ncurses-devel +%if %suse_version > 1020 Recommends: readline-doc = %{version} +%endif AutoReqProv: on # bug437293 %ifarch ppc64 @@ -264,7 +291,7 @@ Group: System/Libraries Provides: readline:%{_infodir}/readline.info.gz PreReq: %install_info_prereq Version: 6.1 -Release: 6 +Release: 7 AutoReqProv: on %if %suse_version > 1120 BuildArch: noarch @@ -312,6 +339,8 @@ unset p %patch41 -p0 -b .intr %patch42 -p0 -b .non_void %patch43 -p0 -b .array +%patch44 -p0 -b .pipe +%patch45 -p0 -b .parser %patch0 -p0 cd ../readline-%{rl_vers} for p in ../readline-%{rl_vers}-patches/*; do @@ -340,13 +369,29 @@ cd ../readline-%{rl_vers} cflags () { local flag=$1; shift - case "${RPM_OPT_FLAGS}" in + local var=$1; shift + test -n "${flag}" -a -n "${var}" || return + case "${!var}" in *${flag}*) return esac - if test -n "$1" && gcc -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then - local var=$1; shift - eval $var=\${$var:+\$$var\ }$flag - fi + case "$flag" in + -Wl,*) + set -o noclobber + echo 'int main () { return 0; }' > ldtest.c + if ${CC:-gcc} -Werror $flag -o /dev/null -xc ldtest.c > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + set +o noclobber + rm -f ldtest.c + ;; + *) + if ${CC:-gcc} -Werror $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + if ${CXX:-g++} -Werror $flag -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1 ; then + eval $var=\${$var:+\$$var\ }$flag + fi + esac } echo 'int main () { return !(sizeof(void*) >= 8); }' | gcc -x c -o test64 - if ./test64 ; then @@ -375,7 +420,7 @@ cd ../readline-%{rl_vers} CFLAGS_FOR_BUILD="$CFLAGS" LDFLAGS_FOR_BUILD="$LDFLAGS" export CC_FOR_BUILD CFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD CFLAGS LDFLAGS CC - ./configure --build=%{_target_cpu}-suse-linux \ + ./configure --disable-static --build=%{_target_cpu}-suse-linux \ --prefix=%{_prefix} \ --with-curses \ --mandir=%{_mandir} \ @@ -481,7 +526,8 @@ cd ../bash-%{bash_vers} $READLINE make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_generate"} \ all printenv recho zecho xcase - env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_LIBRARY_PATH make TESTSCRIPT=%{SOURCE4} check + TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1 + env -i HOME=$PWD TERM=$TERM LD_LIBRARY_PATH=$LD_LIBRARY_PATH TMPDIR=$TMPDIR make TESTSCRIPT=%{SOURCE4} check make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_feedback" clean} all make -C examples/loadables/ make documentation @@ -553,7 +599,9 @@ EOF touch -t 199605181720.50 %{buildroot}%{_sysconfdir}/skel/.bash_history chmod 600 %{buildroot}%{_sysconfdir}/skel/.bash_history %find_lang bash +%if %suse_version > 1020 %fdupes -s %{buildroot}%{_datadir}/bash/helpfiles +%endif %post -n bash-doc %install_info --info-dir=%{_infodir} %{_infodir}/bash.info.gz @@ -629,9 +677,7 @@ ldd -u -r %{buildroot}%{_libdir}/libreadline.so || true %files -n readline-devel %defattr(-,root,root) %{_incdir}/readline/ -%{_libdir}/libhistory.a %{_libdir}/libhistory.so -%{_libdir}/libreadline.a %{_libdir}/libreadline.so %doc %{_mandir}/man3/readline.3.gz