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
This commit is contained in:
OBS User autobuild 2010-07-19 11:22:40 +00:00 committed by Git OBS Bridge
parent c2991c1d02
commit 5877f747fd
4 changed files with 12 additions and 198 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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 <bfox@gnu.org>
Chet Ramey <chet@ins.cwru.edu>
%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
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
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
@ -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