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