.
OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=38
This commit is contained in:
parent
368c00d899
commit
8f76e24cba
46
bash-4.1-edit-parser-state.patch
Normal file
46
bash-4.1-edit-parser-state.patch
Normal file
@ -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);
|
70
bash-4.1-pipe.dif
Normal file
70
bash-4.1-pipe.dif
Normal file
@ -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
|
15
bash.changes
15
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
|
Tue May 25 12:35:03 CEST 2010 - werner@suse.de
|
||||||
|
|
||||||
|
@ -66,6 +66,8 @@ Patch40: bash-4.1-bash.bashrc.dif
|
|||||||
Patch41: bash-4.1-intr.dif
|
Patch41: bash-4.1-intr.dif
|
||||||
Patch42: bash-4.1-non_void.patch
|
Patch42: bash-4.1-non_void.patch
|
||||||
Patch43: bash-4.1-array.dif
|
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
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
%global _sysconfdir /etc
|
%global _sysconfdir /etc
|
||||||
%global _incdir %{_includedir}
|
%global _incdir %{_includedir}
|
||||||
@ -312,6 +314,8 @@ unset p
|
|||||||
%patch41 -p0 -b .intr
|
%patch41 -p0 -b .intr
|
||||||
%patch42 -p0 -b .non_void
|
%patch42 -p0 -b .non_void
|
||||||
%patch43 -p0 -b .array
|
%patch43 -p0 -b .array
|
||||||
|
%patch44 -p0 -b .pipe
|
||||||
|
%patch45 -p0 -b .parser
|
||||||
%patch0 -p0
|
%patch0 -p0
|
||||||
cd ../readline-%{rl_vers}
|
cd ../readline-%{rl_vers}
|
||||||
for p in ../readline-%{rl_vers}-patches/*; do
|
for p in ../readline-%{rl_vers}-patches/*; do
|
||||||
@ -481,7 +485,8 @@ cd ../bash-%{bash_vers}
|
|||||||
$READLINE
|
$READLINE
|
||||||
make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_generate"} \
|
make %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_generate"} \
|
||||||
all printenv recho zecho xcase
|
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 %{?do_profiling:CFLAGS="$CFLAGS %cflags_profile_feedback" clean} all
|
||||||
make -C examples/loadables/
|
make -C examples/loadables/
|
||||||
make documentation
|
make documentation
|
||||||
|
Loading…
Reference in New Issue
Block a user