From: Chet Ramey Date: Wed, 17 Jun 2015 12:34:54 +0000 (-0400) Subject: commit bash-20150612 snapshot X-Git-Tag: bash-4.4-alpha~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd6a350e7e6467ba2b239ec37d2b4a54f5ee5def;p=thirdparty%2Fbash.git commit bash-20150612 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index a19d4292a..02868ac79 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -8807,3 +8807,66 @@ doc/{bash.1,bashref.texi} - ulimit: clarify that -c and -f are in increments of 512 bytes when in posix mode. Fix from Robin Johnson via + + 6/9 + --- +execute_cmd.c + - execute_in_subshell: don't call restore_default_signal for the exit + trap, reset_signal_handlers already does the right thing and keeps + the trap string around; no need to kill trap string. Bug report + from Miroslav Koskar + + 6/11 + ---- +nojobs.c + - find_proc_slot: now takes pid as an argument to avoid finding old + procs when pids wrap around + - add_pid: pass pid to find_proc_slot to avoid multiple instances of + the same pid in the list when pids wrap around. Fixes bug reported + by Roy Keene + +execute_cmd.c + - REAP: test for job_control == 0 also to determine whether or not + to call reap_dead_jobs, since shells without job control enabled + don't report on background process status + +doc/bash.1,lib/readline/doc/hsuser.texi + - history: clarify documentation of -a option to note that it will not + append the same line to the history file more than once. Fixes + problem reported by Reuben Thomas + + 6/12 + ---- +execute_cmd.c + - execute_in_subshell: don't bother decrementing subshell_level before + this returns; the caller will just exit. This means that + $BASH_SUBSHELL will have consistent values in the subshell and any + subsequent exit trap. Fixes bug reported by Miroslav Koskar + + - shell_execve: before longjmp to subshell_top_level, call reset_parser + to free up any input line and stack of pushed strings + +parse.y + - mk_alexpansion: if the last character of the alias is a shell + metacharacter, don't add a space to the string following the alias + value, since that will change the meaning of the command. THIS IS + NOT BACKWARDS COMPATIBLE AND MAY REQUIRE REVERTING. Inspired by an + email message from Jilles Tjoelker to austin + group + + 6/13 + ---- +subst.c + - dequote_string: don't turn strings consisting of a single CTLESC + into empty strings; return them unmodified. The idea is that there + is nothing to quote. This means that something like + c=$'\001' + x=$c + results in x containing '\001' when IFS=$'\001'. See if this will + cause problems by adding a debugging statement in the code + + + + + + diff --git a/MANIFEST b/MANIFEST index 75a274c28..7982cb417 100644 --- a/MANIFEST +++ b/MANIFEST @@ -799,6 +799,7 @@ tests/COPYRIGHT f tests/test-glue-functions f tests/alias.tests f tests/alias1.sub f +tests/alias2.sub f tests/alias.right f tests/appendop.tests f tests/appendop1.sub f @@ -945,6 +946,7 @@ tests/exec7.sub f tests/exec8.sub f tests/exec9.sub f tests/exec10.sub f +tests/exec11.sub f tests/exp.tests f tests/exp.right f tests/exp1.sub f @@ -953,6 +955,7 @@ tests/exp3.sub f tests/exp4.sub f tests/exp5.sub f tests/exp6.sub f +tests/exp7.sub f tests/exportfunc.tests f tests/exportfunc.right f tests/exportfunc1.sub f diff --git a/doc/bash.1 b/doc/bash.1 index 9e4fcc25a..97152c582 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Fri Jun 5 14:38:09 EDT 2015 +.\" Last Change: Thu Jun 11 16:26:00 EDT 2015 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2015 June 5" "GNU Bash 4.4" +.TH BASH 1 "2015 June 11" "GNU Bash 4.4" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -8285,8 +8285,9 @@ Clear the history list by deleting all the entries. Delete the history entry at position \fIoffset\fP. .TP .B \-a -Append the ``new'' history lines (history lines entered since the -beginning of the current \fBbash\fP session) to the history file. +Append the ``new'' history lines to the history file. +These are history lines entered since the beginning of the current +\fBbash\fP session, but not already appended to the history file. .TP .B \-n Read the history lines not already read from the history diff --git a/doc/version.texi b/doc/version.texi index cde1b581f..244d4afef 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2015 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Fri Jun 5 14:34:45 EDT 2015 +@set LASTCHANGE Thu Jun 11 16:25:43 EDT 2015 @set EDITION 4.4 @set VERSION 4.4 -@set UPDATED 5 June 2015 +@set UPDATED 11 June 2015 @set UPDATED-MONTH June 2015 diff --git a/execute_cmd.c b/execute_cmd.c index cdfb91775..fd77fad36 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -630,7 +630,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, if (paren_pid == 0) { /* We want to run the exit trap for forced {} subshells, and we - want to note this before execute_in_subshell modifies the + want to note this before execute_in_subshell[B modifies the COMMAND struct. Need to keep in mind that execute_in_subshell runs the exit trap for () subshells itself. */ /* This handles { command; } & */ @@ -1553,7 +1553,9 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close) if (user_subshell) { stdin_redir = stdin_redirects (command->redirects); - restore_default_signal (EXIT_TRAP); +#if 0 + restore_default_signal (EXIT_TRAP); /* XXX - reset_signal_handlers above */ +#endif } /* If this is an asynchronous command (command &), we want to @@ -1637,7 +1639,9 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close) return_code = run_exit_trap (); } - subshell_level--; +#if 0 + subshell_level--; /* don't bother, caller will just exit */ +#endif return (return_code); /* NOTREACHED */ } @@ -2645,10 +2649,13 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close) return exec_result; } +/* The test used to be only for interactive_shell, but we don't want to report + job status when the shell is not interactive or when job control isn't + enabled. */ #define REAP() \ do \ { \ - if (!interactive_shell) \ + if (job_control == 0 || interactive_shell == 0) \ reap_dead_jobs (); \ } \ while (0) @@ -5500,6 +5507,8 @@ shell_execve (command, args, env) clear_fifo_list (); /* pipe fds are what they are now */ #endif + reset_parser (); + sh_longjmp (subshell_top_level, 1); /*NOTREACHED*/ } diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi index 69a501634..3aa6cfa24 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -202,9 +202,9 @@ Delete the history entry at position @var{offset}. displayed. @item -a -Append the new -history lines (history lines entered since the beginning of the -current Bash session) to the history file. +Append the new history lines to the history file. +These are history lines entered since the beginning of the current +Bash session, but not already appended to the history file. @item -n Append the history lines not already read from the history file diff --git a/nojobs.c b/nojobs.c index c3bcb0909..467adf482 100644 --- a/nojobs.c +++ b/nojobs.c @@ -126,7 +126,7 @@ static int wait_sigint_received; static long child_max = -1L; static void alloc_pid_list __P((void)); -static int find_proc_slot __P((void)); +static int find_proc_slot __P((pid_t)); static int find_index_by_pid __P((pid_t)); static int find_status_by_pid __P((pid_t)); static int process_exit_status __P((WAIT)); @@ -170,12 +170,13 @@ alloc_pid_list () /* Return the offset within the PID_LIST array of an empty slot. This can create new slots if all of the existing slots are taken. */ static int -find_proc_slot () +find_proc_slot (pid) + pid_t pid; { register int i; for (i = 0; i < pid_list_size; i++) - if (pid_list[i].pid == NO_PID) + if (pid_list[i].pid == NO_PID || pid_list[i].pid == pid) return (i); if (i == pid_list_size) @@ -331,7 +332,7 @@ add_pid (pid, async) { int slot; - slot = find_proc_slot (); + slot = find_proc_slot (pid); pid_list[slot].pid = pid; pid_list[slot].status = -1; diff --git a/parse.y b/parse.y index e16f07a7c..75627f8f8 100644 --- a/parse.y +++ b/parse.y @@ -2776,7 +2776,7 @@ mk_alexpansion (s) strcpy (r, s); /* If the last character in the alias is a newline, don't add a trailing space to the expansion. Works with shell_getc above. */ - if (r[l - 1] != ' ' && r[l - 1] != '\n') + if (r[l - 1] != ' ' && r[l - 1] != '\n' && shellmeta(r[l - 1]) == 0) r[l++] = ' '; r[l] = '\0'; return r; diff --git a/po/nb.po b/po/nb.po index bc9e906e6..538b0114c 100644 --- a/po/nb.po +++ b/po/nb.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: bash-4.3-rc2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-01-23 16:04-0500\n" -"PO-Revision-Date: 2015-06-02 09:39+0100\n" +"PO-Revision-Date: 2015-06-12 13:45+0100\n" "Last-Translator: Åka Sikrom \n" "Language-Team: Norwegian Bokmaal \n" "Language: Norwegian bokmål\n" @@ -22,17 +22,17 @@ msgstr "" #: arrayfunc.c:51 msgid "bad array subscript" -msgstr "feil i rekke-underskript" +msgstr "feil i tabell-underskript" #: arrayfunc.c:356 builtins/declare.def:566 #, c-format msgid "%s: cannot convert indexed to associative array" -msgstr "%s: indeksert rekke kan ikke konverteres til assosiativ rekke" +msgstr "%s: indeksert tabell kan ikke konverteres til assosiativ tabell" #: arrayfunc.c:539 #, c-format msgid "%s: invalid associative array key" -msgstr "%s: ugyldig nøkkel for assosiativ rekke" +msgstr "%s: ugyldig nøkkel for assosiativ tabell" #: arrayfunc.c:541 #, c-format @@ -42,7 +42,7 @@ msgstr "%s: kan ikke tildeles ikke-numerisk indeks" #: arrayfunc.c:586 #, c-format msgid "%s: %s: must use subscript when assigning associative array" -msgstr "%s: %s: underskript må brukes ved tildeling av assosiative rekker" +msgstr "%s: %s: underskript må brukes ved tildeling av assosiative tabeller" #: bashhist.c:388 #, c-format @@ -321,7 +321,7 @@ msgstr "kan bare brukes i funksjoner" #: builtins/declare.def:315 builtins/declare.def:509 #, c-format msgid "%s: reference variable cannot be an array" -msgstr "%s: referansevariabler kan ikke være rekker (arrays)" +msgstr "%s: referansevariabler kan ikke være tabeller (arrays)" #: builtins/declare.def:324 #, c-format @@ -340,12 +340,12 @@ msgstr "%s: skrivebeskyttet funksjon" #: builtins/declare.def:553 #, c-format msgid "%s: cannot destroy array variables in this way" -msgstr "%s: rekkevariabler kan ikke ødelegges på denne måten" +msgstr "%s: tabellvariabler kan ikke ødelegges på denne måten" #: builtins/declare.def:560 builtins/read.def:733 #, c-format msgid "%s: cannot convert associative to indexed array" -msgstr "%s: assosiative rekker kan ikke konverteres til indekserte rekker" +msgstr "%s: assosiative tabeller kan ikke konverteres til indekserte tabeller" #: builtins/enable.def:137 builtins/enable.def:145 msgid "dynamic loading not available" @@ -536,7 +536,7 @@ msgstr "forventet uttrykk" #: builtins/mapfile.def:172 #, c-format msgid "%s: not an indexed array" -msgstr "%s: ikke en indeksert rekke" +msgstr "%s: ikke en indeksert tabell" #: builtins/mapfile.def:259 builtins/read.def:302 #, c-format @@ -556,7 +556,7 @@ msgstr "%s: ugyldig linjeantall" #: builtins/mapfile.def:287 #, c-format msgid "%s: invalid array origin" -msgstr "%s: ugyldig rekkeopphav" +msgstr "%s: ugyldig tabellopphav" #: builtins/mapfile.def:304 #, c-format @@ -565,11 +565,11 @@ msgstr "%s: ugyldig tilbakekallsmengde" #: builtins/mapfile.def:336 msgid "empty array variable name" -msgstr "tomt navn på rekkevariabel" +msgstr "tomt navn på tabellvariabel" #: builtins/mapfile.def:357 msgid "array variable support required" -msgstr "støtte for rekkevariabler kreves" +msgstr "støtte for tabellvariabler kreves" #: builtins/printf.def:402 #, c-format @@ -779,7 +779,7 @@ msgstr "%s: klarte ikke å fjerne verdi fra skrivebeskyttet %s" #: builtins/set.def:854 #, c-format msgid "%s: not an array variable" -msgstr "%s: ikke en rekkevariabel" +msgstr "%s: ikke en tabellvariabel" #: builtins/setattr.def:187 #, c-format @@ -1769,7 +1769,7 @@ msgstr "ugyldig substitutt: %2$s mangler avsluttende «%1$s»" #: subst.c:2847 #, c-format msgid "%s: cannot assign list to array member" -msgstr "%s: klarte ikke å knytte liste til rekkemedlem" +msgstr "%s: klarte ikke å knytte liste til tabellmedlem" #: subst.c:5065 subst.c:5081 msgid "cannot make pipe for process substitution" @@ -2149,7 +2149,7 @@ msgstr "let arg [arg …]" #: builtins.c:136 msgid "read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]" -msgstr "read [-ers] [-a rekke] [-d adskill] [-i tekst] [-n ntegn] [-N ntegn] [-p ledetekst] [-t tidsavbrudd] [-u fd] [navn …]" +msgstr "read [-ers] [-a tabell] [-d adskill] [-i tekst] [-n ntegn] [-N ntegn] [-p ledetekst] [-t tidsavbrudd] [-u fd] [navn …]" #: builtins.c:138 msgid "return [n]" @@ -2317,11 +2317,11 @@ msgstr "compopt [-o|+o valg] [-DE] [navn …]" #: builtins.c:240 msgid "mapfile [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]" -msgstr "mapfile [-n antall] [-O opphav] [-s antall] [-t] [-u fd] [-C tilbakekall] [-c mengde] [rekke]" +msgstr "mapfile [-n antall] [-O opphav] [-s antall] [-t] [-u fd] [-C tilbakekall] [-c mengde] [tabell]" #: builtins.c:242 msgid "readarray [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]" -msgstr "readarray [-n antall] [-O opphav] [-s antall] [-t] [-u fd] [-C tilbakekall] [-c mengde] [rekke]" +msgstr "readarray [-n antall] [-O opphav] [-s antall] [-t] [-u fd] [-C tilbakekall] [-c mengde] [tabell]" #: builtins.c:254 msgid "" @@ -2744,8 +2744,8 @@ msgstr "" " -p\tvis attributter og verdi av hvert valgt NAVN\n" " \n" " Valg som justerer attributter:\n" -" -a\tgjør valgte NAVN til indekserte rekker (hvis det støttes)\n" -" -A\tgjrø valgte NAVN til assosiative rekker (hvis det støttes)\n" +" -a\tgjør valgte NAVN til indekserte tabeller (hvis det støttes)\n" +" -A\tgjør valgte NAVN til assosiative tabeller (hvis det støttes)\n" " -i\tgi valgte NAVN attributten «integer» (heltall)\n" " -l\tkonverter valgte NAVN til små bokstaver\n" " -n\tgjør valgt NAVN til en referanse til variabelen med egen verdi som navn\n" @@ -3565,8 +3565,8 @@ msgstr "" " Hvis ingen NAVN er oppgitt, legges lest linje i variabelen REPLY.\n" " \n" " Valg:\n" -" -a rekke\tknytt leste ord til sekvens-indekser i \n" -" \t\trekkevariabelen REKKE, talt fra null\n" +" -a tabell\tknytt leste ord til sekvens-indekser i \n" +" \t\ttabellvariabelen TABELL, talt fra null\n" " -d skill\tfortsett frem til første SKILLetegn, i stedet for frem til linjeskift\n" " -e\t\tbruk Readline til å hente linja i et interaktivt skall\n" " -i tekst\tBruk valgt TEKST med Readline\n" @@ -3872,8 +3872,8 @@ msgstr "" " variabelen markeres som skrivebeskyttet.\n" " \n" " Valg:\n" -" -a\thenvis til indekserte rekkevariabler\n" -" -A\thenvis til assosiative rekkevariabler\n" +" -a\thenvis til indekserte tabellvariabler\n" +" -A\thenvis til assosiative tabellvariabler\n" " -f\thenvis til skallfunksjoner\n" " -p\tvis en liste over alle skrivebeskyttede variabler eller funksjoner,\n" " avhengig av hvorvidt «-f» er valgt\n" @@ -4633,7 +4633,7 @@ msgstr "" "Lag en medprosess med valgt NAVN.\n" " \n" " Kjør valgt KOMMANDO synkront, med standard inn- og utdata for kommandoen\n" -" som er tilkoblet via et datarør til fildeskriptorer med indeks 0 og 1 i en rekkevariabel \n" +" som er tilkoblet via et datarør til fildeskriptorer med indeks 0 og 1 i en tabellvariabel \n" " med oppgitt NAVN i kjørende skall.\n" "\v StandardNAVN er «COPROC».\n" " \n" @@ -5254,15 +5254,15 @@ msgid "" " Returns success unless an invalid option is given or ARRAY is readonly or\n" " not an indexed array." msgstr "" -"Legg linjer fra standard inndata i en indeksert rekkevariabel.\n" +"Legg linjer fra standard inndata i en indeksert tabellvariabel.\n" " \n" -" Legg linjer fra standard inndata i indeksert rekkevariabel REKKE, eller\n" +" Legg linjer fra standard inndata i indeksert tabellvariabel TABELL, eller\n" " fra fildeskriptor FD ved bruk av «-u». Variabelen MAPFILE er\n" -" standard REKKE.\n" +" standard TABELL.\n" " \n" " Valg:\n" " -n antall\tIkke kopier flere enn valgt ANTALL linjer. Hvis ANTALL er 0, kopieres alle linjer.\n" -" -O oppr\tTildel til REKKE ved indeks-OPPRinnelse. Standard indeks er 0.\n" +" -O oppr\tTildel til TABELL ved indeks-OPPRinnelse. Standard indeks er 0.\n" " -s antall \tForkast valgt ANTALL linjer i starten.\n" " -t\t\tFjern etterfølgende linjeskift fra hver lest linje.\n" " -u fd\t\tLes linjer fra fildeskriptor FD i stedet for standard inndata.\n" @@ -5270,17 +5270,17 @@ msgstr "" " -c antall\tVelg antall linjer som skal leses mellom hvert TILBAKEKALL.\n" " \n" " Argumenter:\n" -" ARRAY\t\tRekkevariabel-navn som skal brukes i fildata.\n" +" ARRAY\t\tTabellvariabel-navn som skal brukes i fildata.\n" " \n" " Hvis «-C» er valgt men ikke «-c», brukes standardantallet 5000. Når\n" -" TILBAKEKALL vurderes, argumenteres det i tillegg med indeks av neste rekkeelement\n" +" TILBAKEKALL vurderes, argumenteres det i tillegg med indeks av neste tabellelement\n" " samt linjenummeret som skal tildeles aktuelt element.\n" " \n" -" Hvis ingen eksplisitt opprinnelse er gitt, tømmes REKKE før den får tildelt noe.\n" +" Hvis ingen eksplisitt opprinnelse er gitt, tømmes TABELL før den får tildelt noe.\n" " \n" " Avslutningsstatus:\n" -" Vellykket, med mindre brukeren tar et ugyldig valg eller REKKE enten er\n" -" skrivebeskyttet eller en ikke-indeksert rekke." +" Vellykket, med mindre brukeren tar et ugyldig valg eller TABELL enten er\n" +" skrivebeskyttet eller en ikke-indeksert tabell." #: builtins.c:2049 msgid "" @@ -5288,6 +5288,6 @@ msgid "" " \n" " A synonym for `mapfile'." msgstr "" -"Legg linjer fra en fil inn i en rekkevariabel.\n" +"Legg linjer fra en fil inn i en tabellvariabel.\n" " \n" " Dette er synonymt med «mapfile»." diff --git a/subst.c b/subst.c index 62308a578..c1314a574 100644 --- a/subst.c +++ b/subst.c @@ -3750,6 +3750,11 @@ dequote_string (string) char *result, *send; DECLARE_MBSTATE; +#if defined (DEBUG) +if (string[0] == CTLESC && string[1] == 0) + itrace("dequote_string: string with bare CTLESC"); +#endif + slen = strlen (string); t = result = (char *)xmalloc (slen + 1); @@ -3760,6 +3765,14 @@ dequote_string (string) return (result); } + /* A string consisting of only a single CTLESC should pass through unchanged */ + if (string[0] == CTLESC && string[1] == 0) + { + result[0] = CTLESC; + result[1] = '\0'; + return (result); + } + /* If no character in the string can be quoted, don't bother examining each character. Just return a copy of the string passed to us. */ if (strchr (string, CTLESC) == NULL) diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 3efcf32d6..72ec06a2c 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/chet/bash/bash-current +BUILD_DIR=/usr/local/build/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR diff --git a/tests/alias.right b/tests/alias.right index a37080ceb..cab07a988 100644 --- a/tests/alias.right +++ b/tests/alias.right @@ -10,3 +10,11 @@ OK OK OK OK +one +two +three +four +one +two +three +four diff --git a/tests/alias.tests b/tests/alias.tests index a97d5ff45..d1ba97b30 100644 --- a/tests/alias.tests +++ b/tests/alias.tests @@ -37,3 +37,4 @@ foo bar unalias foo bar baz ${THIS_SH} ./alias1.sub +${THIS_SH} ./alias2.sub diff --git a/tests/alias2.sub b/tests/alias2.sub new file mode 100644 index 000000000..e72a380b8 --- /dev/null +++ b/tests/alias2.sub @@ -0,0 +1,22 @@ +THIS=alias2 +FN=$THIS.script + +cat > $FN <<'EOF' +# +(echo "$1") +EOF +chmod u+x $FN + +shopt -s expand_aliases + +alias foo1='$FN one; source $FN two; source $FN three; $FN four' + +alias foo2='$FN one +source $FN two +source $FN three +$FN four' + +foo1 +foo2 + +rm -f $FN diff --git a/tests/exec.right b/tests/exec.right index 19c8583ef..3c2a7fcdc 100644 --- a/tests/exec.right +++ b/tests/exec.right @@ -67,4 +67,17 @@ PATH = /usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:. cannot find cat in $TMPDIR with hash cannot find cat with empty $PATH with hash PATH = /usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:. +trap -- 'echo foo $BASH_SUBSHELL' EXIT +trap -- 'echo USR1 $BASHPID' SIGUSR1 +between +trap -- 'echo foo $BASH_SUBSHELL' EXIT +trap -- 'echo USR1 $BASHPID' SIGUSR1 +between 2 +trap -- 'echo foo $BASH_SUBSHELL' EXIT +trap -- 'echo USR1 $BASHPID' SIGUSR1 +in subshell: 1 +in subshell pipeline: 1 +group pipeline: 1 +EXIT-group.1 +foo 0 after diff --git a/tests/exec11.sub b/tests/exec11.sub new file mode 100644 index 000000000..9631c6723 --- /dev/null +++ b/tests/exec11.sub @@ -0,0 +1,14 @@ +trap 'echo USR1 $BASHPID' USR1 +trap 'echo foo $BASH_SUBSHELL' 0 + +trap | cat +echo between +( trap ) +echo between 2 +{ trap; } | cat + +( echo in subshell: $BASH_SUBSHELL ) +( echo in subshell pipeline: $BASH_SUBSHELL ) | cat + +{ echo group pipeline: $BASH_SUBSHELL; + trap 'echo EXIT-group.$BASH_SUBSHELL' EXIT; } | cat diff --git a/tests/execscript b/tests/execscript index f886f2b0b..f9c7aca58 100644 --- a/tests/execscript +++ b/tests/execscript @@ -113,6 +113,7 @@ ${THIS_SH} -i ./exec8.sub ${THIS_SH} ./exec9.sub ${THIS_SH} ./exec10.sub +${THIS_SH} ./exec11.sub true | `echo true` & diff --git a/tests/exp.right b/tests/exp.right index 3c5fb8a5d..bff55bdc4 100644 --- a/tests/exp.right +++ b/tests/exp.right @@ -210,3 +210,9 @@ argv[1] = argv[2] = argv[1] = argv[2] = +argv[1] = <^A> +argv[1] = <3> +argv[2] = <^C> +argv[3] = <^C> +argv[4] = <^C> +argv[1] = <^A> diff --git a/tests/exp.tests b/tests/exp.tests index 53eeaa85d..54bf722e8 100644 --- a/tests/exp.tests +++ b/tests/exp.tests @@ -402,3 +402,4 @@ ${THIS_SH} ./exp4.sub ${THIS_SH} ./exp5.sub ${THIS_SH} ./exp6.sub +${THIS_SH} ./exp7.sub diff --git a/tests/exp7.sub b/tests/exp7.sub new file mode 100644 index 000000000..0a4acc3c9 --- /dev/null +++ b/tests/exp7.sub @@ -0,0 +1,11 @@ +IFS=$'\001' +c=$'\001' +c2=$'\003' + +IFS=$c # this is the problem line, IFS should end up being \001 +recho "$IFS" +set -- $c2$c$c2$c$c2 +recho $# "$1" "$2" "$3" + +x=$c +recho "$x"