]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20150612 snapshot
authorChet Ramey <chet.ramey@case.edu>
Wed, 17 Jun 2015 12:34:54 +0000 (08:34 -0400)
committerChet Ramey <chet.ramey@case.edu>
Wed, 17 Jun 2015 12:34:54 +0000 (08:34 -0400)
20 files changed:
CWRU/CWRU.chlog
MANIFEST
doc/bash.1
doc/version.texi
execute_cmd.c
lib/readline/doc/hsuser.texi
nojobs.c
parse.y
po/nb.po
subst.c
tests/RUN-ONE-TEST
tests/alias.right
tests/alias.tests
tests/alias2.sub [new file with mode: 0644]
tests/exec.right
tests/exec11.sub [new file with mode: 0644]
tests/execscript
tests/exp.right
tests/exp.tests
tests/exp7.sub [new file with mode: 0644]

index a19d4292add7a61589b187d822dba24d74d070e0..02868ac79d4f0ce145050cb5db2bfe4a6311c0d0 100644 (file)
@@ -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 <robbat2@gentoo.org> via
          <vapier@gentoo.org>
+
+                                   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 <mk@mkoskar.com>
+
+                                  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 <rkeene@rkeene.org>
+
+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 <rrt@sc3d.org>
+
+                                  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
+         <mk@mkoskar.com>
+       - 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 <jilles@stack.nl> 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
+
+
+
+
+
+         
index 75a274c286c6214e28368bb2367aae4e06b116ec..7982cb4172105242462eb42b882c00c79b3ed841 100644 (file)
--- 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
index 9e4fcc25a0e9b1db0d83564a43625c0f35c8142d..97152c58222c1a80dc6f4757621a3cae6e7d4b5e 100644 (file)
@@ -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
index cde1b581f0a9e0d1c08d643af9339fb52be4f894..244d4afef24be8723641637e4589ece02a7f9edd 100644 (file)
@@ -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
index cdfb91775bcb4b78b4fa8e6f9db8f4fc83233f59..fd77fad36cee570339ffb17d89d27681fbb84352 100644 (file)
@@ -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*/
 }
index 69a5016342fd17e840dc8f84edd937a7f44b66ac..3aa6cfa2453384b7a888355664d40532c6dd9fed 100644 (file)
@@ -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
index c3bcb0909bac529e5881f7d3445c21756397a574..467adf482c7ee56a89e1c80fb1da81204fd23191 100644 (file)
--- 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 e16f07a7c6a585dec966b61ce4d6fca70fde2e4e..75627f8f817fbdcd4cab88633e3c66db65410424 100644 (file)
--- 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;
index bc9e906e6d3369a183b0284bdf0c6fdeb897960b..538b0114c6372b8b49ebaae17fd94134dbca2527 100644 (file)
--- 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 <a4@hush.com>\n"
 "Language-Team: Norwegian Bokmaal <i18n-nb@lister.ping.uio.no>\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 62308a578e93ef9991b38b9615720a76863bd794..c1314a574eee41cbf26d548e7be294d3e431d0ec 100644 (file)
--- 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)
index 3efcf32d68e9722024b6ca9d67f9e81b2aa5ac04..72ec06a2c1fd8dde92acea5e8ac773e35f1d061b 100755 (executable)
@@ -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
 
index a37080ceb2333b8713f52d457f872b12cdc9978e..cab07a98894cda14865ffd50cb0c60ebc85781f0 100644 (file)
@@ -10,3 +10,11 @@ OK
 OK
 OK
 OK
+one
+two
+three
+four
+one
+two
+three
+four
index a97d5ff4518f82bcbff6e1ab34d40cc5b5ec7357..d1ba97b30b0f15f181ef0f1fa13a7d97c2d80bb3 100644 (file)
@@ -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 (file)
index 0000000..e72a380
--- /dev/null
@@ -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
index 19c8583ef7b43bf2f5d6d4b57700e13cd2b1c6cf..3c2a7fcdce5a330385c3fc8d9f865ad67f653a28 100644 (file)
@@ -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 (file)
index 0000000..9631c67
--- /dev/null
@@ -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
index f886f2b0b09eeb051b82cb9c29ef4a1766537213..f9c7aca5835cf09618aa28e502b7ac571955b97d 100644 (file)
@@ -113,6 +113,7 @@ ${THIS_SH} -i ./exec8.sub
 ${THIS_SH} ./exec9.sub
 
 ${THIS_SH} ./exec10.sub
+${THIS_SH} ./exec11.sub
 
 true | `echo true` &
 
index 3c5fb8a5d108cf6f0c65e89d19cbf487e323b592..bff55bdc4c0a56479e7352922e5f66dd8923efb9 100644 (file)
@@ -210,3 +210,9 @@ argv[1] = <correct>
 argv[2] = <a>
 argv[1] = <correct>
 argv[2] = <a>
+argv[1] = <^A>
+argv[1] = <3>
+argv[2] = <^C>
+argv[3] = <^C>
+argv[4] = <^C>
+argv[1] = <^A>
index 53eeaa85dbe0b47209dbe58560d7775a052f7aeb..54bf722e88d612feaeb6a6d0273bc689bcd5d6bd 100644 (file)
@@ -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 (file)
index 0000000..0a4acc3
--- /dev/null
@@ -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"