]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20110121 snapshot
authorChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2011 03:14:43 +0000 (22:14 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2011 03:14:43 +0000 (22:14 -0500)
13 files changed:
CHANGES
CHANGES-4.2
CHANGES-4.2~
CHANGES~
CWRU/CWRU.chlog
CWRU/CWRU.chlog~
doc/FAQ
doc/FAQ-4.2
doc/FAQ-4.2~
doc/FAQ~
execute_cmd.c
variables.c
variables.c~

diff --git a/CHANGES b/CHANGES
index 4a392b1f4030b7e3c48b89bcaf0449fc7ade2a1f..43e95971bcd2df4c6dac010280b394c1f41c8254 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,9 +8,12 @@ a.  Changes to bash_directory_completion_hook so that it's assigned to the
     name passed to opendir without modifying the directory name the user
     typed.
 
-b.  Fix bug in select builtin that caused it to not terminate correctly if
+b.  Fixed bug in select builtin that caused it to not terminate correctly if
     the read timed out due to $TMOUT.
 
+c.  Fixed a problem that resulted in non-repeatable sequences of random
+    numbers when RANDOM=0.
+
 ------------------------------------------------------------------------------
 This document details the changes between this version, bash-4.2-rc1,
 and the previous version, bash-4.2-beta.
index 9bff1f685dade2c7895d86fe605218083f1d9280..09cb4ac3561fbd09b9983361d43c9d4c6a82446d 100644 (file)
@@ -8,9 +8,12 @@ a.  Changes to bash_directory_completion_hook so that it's assigned to the
     name passed to opendir without modifying the directory name the user
     typed.
 
-b.  Fix bug in select builtin that caused it to not terminate correctly if
+b.  Fixed bug in select builtin that caused it to not terminate correctly if
     the read timed out due to $TMOUT.
 
+c.  Fixed a problem that resulted in non-repeatable sequences of random
+    numbers when RANDOM=0.
+
 ------------------------------------------------------------------------------
 This document details the changes between this version, bash-4.2-rc1,
 and the previous version, bash-4.2-beta.
index a7229e813389cc3dc1f0ab4d4ba69a5a81014d4d..9bff1f685dade2c7895d86fe605218083f1d9280 100644 (file)
@@ -8,6 +8,9 @@ a.  Changes to bash_directory_completion_hook so that it's assigned to the
     name passed to opendir without modifying the directory name the user
     typed.
 
+b.  Fix bug in select builtin that caused it to not terminate correctly if
+    the read timed out due to $TMOUT.
+
 ------------------------------------------------------------------------------
 This document details the changes between this version, bash-4.2-rc1,
 and the previous version, bash-4.2-beta.
index a52b7d66dc6728085d70e9ebb8668e4447153c43..4a392b1f4030b7e3c48b89bcaf0449fc7ade2a1f 100644 (file)
--- a/CHANGES~
+++ b/CHANGES~
@@ -8,6 +8,9 @@ a.  Changes to bash_directory_completion_hook so that it's assigned to the
     name passed to opendir without modifying the directory name the user
     typed.
 
+b.  Fix bug in select builtin that caused it to not terminate correctly if
+    the read timed out due to $TMOUT.
+
 ------------------------------------------------------------------------------
 This document details the changes between this version, bash-4.2-rc1,
 and the previous version, bash-4.2-beta.
index 4434462c6674a898bfdc6f114d208b3497ab265a..02ad0dec9085bdd64abd8d350538ad59141d2524 100644 (file)
@@ -10994,3 +10994,18 @@ execute_cmd.c
        - short-circuit select builtin if read_builtin returns anything but
          EXECUTION_SUCCESS, not just EXECUTION_FAILURE.  Fixes bug reported
          by Pierre Gaston <pierre.gaston@gmail.com>
+
+                                  1/19
+                                  ----
+execute_cmd.c
+       - change execute_simple_command to save and restore the values of
+         executing_builtin and executing_command_builtin before discarding
+         the unwind-protect frame.  Bug and fix from Werner Fink
+         <werner@suse.de>
+
+                                  1/24
+                                  ----
+variables.c
+       - change brand to set rseed to a known, constant value if it's 0,
+         so the sequence is known.  Fixes issue reported by Olivier
+         Mehani <shtrom@ssji.net>
index 191f2781c8f51546e7eecc8cb319c845df2b3071..281ac5a5567e921cf31ebf139aec61c9e54e7c7d 100644 (file)
@@ -10987,3 +10987,18 @@ lib/sh/strftime.c
 
 configure.in
        - change release level to rc2
+
+                                  1/17
+                                  ----
+execute_cmd.c
+       - short-circuit select builtin if read_builtin returns anything but
+         EXECUTION_SUCCESS, not just EXECUTION_FAILURE.  Fixes bug reported
+         by Pierre Gaston <pierre.gaston@gmail.com>
+
+                                  1/19
+                                  ----
+execute_cmd.c
+       - change execute_simple_command to save and restore the values of
+         executing_builtin and executing_command_builtin before discarding
+         the unwind-protect frame.  Bug and fix from Werner Fink
+         <werner@suse.de>
diff --git a/doc/FAQ b/doc/FAQ
index e17610a73d5d82fc38c22617208ebb412b7d4664..8b0f2deee3890fa0a097da49dbd5247fc87031d7 100644 (file)
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -980,7 +980,7 @@ There are a few incompatibilities between version 4.2 and previous
 versions.  They are detailed in the file COMPAT in the bash distribution.
 That file is not meant to be all-encompassing; send mail to
 bash-maintainers@gnu.org (or bug-bash@gnu.org if you would like
-community discussion) if if you find something that's not mentioned there.
+community discussion) if you find something that's not mentioned there.
 
 Section C:  Differences from other Unix shells
 
index e17610a73d5d82fc38c22617208ebb412b7d4664..8b0f2deee3890fa0a097da49dbd5247fc87031d7 100644 (file)
@@ -980,7 +980,7 @@ There are a few incompatibilities between version 4.2 and previous
 versions.  They are detailed in the file COMPAT in the bash distribution.
 That file is not meant to be all-encompassing; send mail to
 bash-maintainers@gnu.org (or bug-bash@gnu.org if you would like
-community discussion) if if you find something that's not mentioned there.
+community discussion) if you find something that's not mentioned there.
 
 Section C:  Differences from other Unix shells
 
index fc34029306285751ba960aab2a2367e97834793d..e17610a73d5d82fc38c22617208ebb412b7d4664 100644 (file)
@@ -396,77 +396,77 @@ Bash-4.2 contains the following new features (see the manual page for
 complete descriptions and the CHANGES and NEWS files in the bash-4.2
 distribution):
 
-a.  `exec -a foo' now sets $0 to `foo' in an executable shell script without a
+  `exec -a foo' now sets $0 to `foo' in an executable shell script without a
     leading #!.
 
-b.  Subshells begun to execute command substitutions or run shell functions or
+  Subshells begun to execute command substitutions or run shell functions or
     builtins in subshells do not reset trap strings until a new trap is
     specified.  This allows $(trap) to display the caller's traps and the
     trap strings to persist until a new trap is set.
 
-c.  `trap -p' will now show signals ignored at shell startup, though their
+  `trap -p' will now show signals ignored at shell startup, though their
     disposition still cannot be modified.
 
-d.  $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
+  $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
 
-e.  declare/typeset has a new `-g' option, which creates variables in the
+  declare/typeset has a new `-g' option, which creates variables in the
     global scope even when run in a shell function.
 
-f.  test/[/[[ have a new -v variable unary operator, which returns success if
+  test/[/[[ have a new -v variable unary operator, which returns success if
     `variable' has been set.
 
-g.  Posix parsing changes to allow `! time command' and multiple consecutive
+  Posix parsing changes to allow `! time command' and multiple consecutive
     instances of `!' (which toggle) and `time' (which have no cumulative
     effect).
 
-h.  Posix change to allow `time' as a command by itself to print the elapsed
+  Posix change to allow `time' as a command by itself to print the elapsed
     user, system, and real times for the shell and its children.
 
-j.  $((...)) is always parsed as an arithmetic expansion first, instead of as
+  $((...)) is always parsed as an arithmetic expansion first, instead of as
     a potential nested command substitution, as Posix requires.
 
-k.  A new FUNCNEST variable to allow the user to control the maximum shell
+  A new FUNCNEST variable to allow the user to control the maximum shell
     function nesting (recursive execution) level.
 
-l.  The mapfile builtin now supplies a third argument to the callback command:
+  The mapfile builtin now supplies a third argument to the callback command:
     the line about to be assigned to the supplied array index.
 
-m.  The printf builtin has as new %(fmt)T specifier, which allows time values
+  The printf builtin has as new %(fmt)T specifier, which allows time values
     to use strftime-like formatting.
 
-n.  There is a new `compat41' shell option.
+  There is a new `compat41' shell option.
 
-o.  The cd builtin has a new Posix-mandated `-e' option.
+o   The cd builtin has a new Posix-mandated `-e' option.
 
-p.  Negative subscripts to indexed arrays, previously errors, now are treated
+  Negative subscripts to indexed arrays, previously errors, now are treated
     as offsets from the maximum assigned index + 1.
 
-q.  Negative length specifications in the ${var:offset:length} expansion,
+  Negative length specifications in the ${var:offset:length} expansion,
     previously errors, are now treated as offsets from the end of the variable.
 
-r.  Parsing change to allow `time -p --'.
+  Parsing change to allow `time -p --'.
 
-s.  Posix-mode parsing change to not recognize `time' as a keyword if the
+  Posix-mode parsing change to not recognize `time' as a keyword if the
     following token begins with a `-'.  This means no more Posix-mode
     `time -p'.  Posix interpretation 267.
 
-t.  There is a new `lastpipe' shell option that runs the last command of a
+  There is a new `lastpipe' shell option that runs the last command of a
     pipeline in the current shell context.  The lastpipe option has no
     effect if job control is enabled.
 
-u.  History expansion no longer expands the `$!' variable expansion.
+  History expansion no longer expands the `$!' variable expansion.
 
-v.  Posix mode shells no longer exit if a variable assignment error occurs
+  Posix mode shells no longer exit if a variable assignment error occurs
     with an assignment preceding a command that is not a special builtin.
 
-w.  Non-interactive mode shells exit if -u is enabled an an attempt is made
+  Non-interactive mode shells exit if -u is enabled an an attempt is made
     to use an unset variable with the % or # expansions, the `//', `^', or
     `,' expansions, or the parameter length expansion.
 
-x.  Posix-mode shells use the argument passed to `.' as-is if a $PATH search
+  Posix-mode shells use the argument passed to `.' as-is if a $PATH search
     fails, effectively searching the current directory.  Posix-2008 change.
 
-A short feature history dating from Bash-2.0:
+A short feature history dating back to Bash-2.0:
 
 Bash-4.1 contained the following new features:
 
index bef81060a320ccb8617602eb2aa58c6947899a89..e17610a73d5d82fc38c22617208ebb412b7d4664 100644 (file)
--- a/doc/FAQ~
+++ b/doc/FAQ~
@@ -1,4 +1,4 @@
-This is the Bash FAQ, version 4.11, for Bash version 4.1.
+This is the Bash FAQ, version 4.12, for Bash version 4.2.
 
 This document contains a set of frequently-asked questions concerning
 Bash, the GNU Bourne-Again Shell.  Bash is a freely-available command
@@ -36,8 +36,8 @@ A10) What is the bash `posix mode'?
 
 Section B:  The latest version
 
-B1) What's new in version 4.1?
-B2) Are there any user-visible incompatibilities between bash-4.1 and
+B1) What's new in version 4.2?
+B2) Are there any user-visible incompatibilities between bash-4.2 and
     previous bash versions?
 
 Section C:  Differences from other Unix shells
@@ -144,26 +144,26 @@ of Case Western Reserve University.
 
 A2)  What's the latest version?
 
-The latest version is 4.1, first made available on 31 December, 2009.
+The latest version is 4.2, first made available on NN December, 2010.
 
 A3)  Where can I get it?
 
 Bash is the GNU project's shell, and so is available from the
 master GNU archive site, ftp.gnu.org, and its mirrors.  The
 latest version is also available for FTP from ftp.cwru.edu.
-The following URLs tell how to get version 4.1:
+The following URLs tell how to get version 4.2:
 
-ftp://ftp.gnu.org/pub/gnu/bash/bash-4.1.tar.gz
-ftp://ftp.cwru.edu/pub/bash/bash-4.1.tar.gz
+ftp://ftp.gnu.org/pub/gnu/bash/bash-4.2.tar.gz
+ftp://ftp.cwru.edu/pub/bash/bash-4.2.tar.gz
 
 Formatted versions of the documentation are available with the URLs:
 
-ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-4.1.tar.gz
-ftp://ftp.cwru.edu/pub/bash/bash-doc-4.1.tar.gz
+ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-4.2.tar.gz
+ftp://ftp.cwru.edu/pub/bash/bash-doc-4.2.tar.gz
 
 Any patches for the current version are available with the URL:
 
-ftp://ftp.cwru.edu/pub/bash/bash-4.1-patches/
+ftp://ftp.cwru.edu/pub/bash/bash-4.2-patches/
 
 A4)  On what machines will bash run?
 
@@ -219,7 +219,7 @@ Mark began to work with bash-2.05, but I don't know the current status.
 
 Bash-3.0 compiles and runs with no modifications under Microsoft's Services
 for Unix (SFU), once known as Interix.  I do not anticipate any problems
-with building bash-4.1, but will gladly accept any patches that are needed.
+with building bash-4.2, but will gladly accept any patches that are needed.
 
 A6) How can I build bash with gcc? 
 
@@ -388,14 +388,88 @@ They are also listed in a section in the Bash Reference Manual
 
 Section B:  The latest version
 
-B1) What's new in version 4.1?
+B1) What's new in version 4.2?
 
-Bash-4.1 is the first revision to the fourth major release of bash.
+Bash-4.2 is the second revision to the fourth major release of bash.
 
-Bash-4.1 contains the following new features (see the manual page for
-complete descriptions and the CHANGES and NEWS files in the bash-4.1
+Bash-4.2 contains the following new features (see the manual page for
+complete descriptions and the CHANGES and NEWS files in the bash-4.2
 distribution):
 
+o   `exec -a foo' now sets $0 to `foo' in an executable shell script without a
+    leading #!.
+
+o   Subshells begun to execute command substitutions or run shell functions or
+    builtins in subshells do not reset trap strings until a new trap is
+    specified.  This allows $(trap) to display the caller's traps and the
+    trap strings to persist until a new trap is set.
+
+o   `trap -p' will now show signals ignored at shell startup, though their
+    disposition still cannot be modified.
+
+o   $'...', echo, and printf understand \uXXXX and \UXXXXXXXX escape sequences.
+
+o   declare/typeset has a new `-g' option, which creates variables in the
+    global scope even when run in a shell function.
+
+o   test/[/[[ have a new -v variable unary operator, which returns success if
+    `variable' has been set.
+
+o   Posix parsing changes to allow `! time command' and multiple consecutive
+    instances of `!' (which toggle) and `time' (which have no cumulative
+    effect).
+
+o   Posix change to allow `time' as a command by itself to print the elapsed
+    user, system, and real times for the shell and its children.
+
+o   $((...)) is always parsed as an arithmetic expansion first, instead of as
+    a potential nested command substitution, as Posix requires.
+
+o   A new FUNCNEST variable to allow the user to control the maximum shell
+    function nesting (recursive execution) level.
+
+o   The mapfile builtin now supplies a third argument to the callback command:
+    the line about to be assigned to the supplied array index.
+
+o   The printf builtin has as new %(fmt)T specifier, which allows time values
+    to use strftime-like formatting.
+
+o   There is a new `compat41' shell option.
+
+o   The cd builtin has a new Posix-mandated `-e' option.
+
+o   Negative subscripts to indexed arrays, previously errors, now are treated
+    as offsets from the maximum assigned index + 1.
+
+o   Negative length specifications in the ${var:offset:length} expansion,
+    previously errors, are now treated as offsets from the end of the variable.
+
+o   Parsing change to allow `time -p --'.
+
+o   Posix-mode parsing change to not recognize `time' as a keyword if the
+    following token begins with a `-'.  This means no more Posix-mode
+    `time -p'.  Posix interpretation 267.
+
+o   There is a new `lastpipe' shell option that runs the last command of a
+    pipeline in the current shell context.  The lastpipe option has no
+    effect if job control is enabled.
+
+o   History expansion no longer expands the `$!' variable expansion.
+
+o   Posix mode shells no longer exit if a variable assignment error occurs
+    with an assignment preceding a command that is not a special builtin.
+
+o   Non-interactive mode shells exit if -u is enabled an an attempt is made
+    to use an unset variable with the % or # expansions, the `//', `^', or
+    `,' expansions, or the parameter length expansion.
+
+o   Posix-mode shells use the argument passed to `.' as-is if a $PATH search
+    fails, effectively searching the current directory.  Posix-2008 change.
+
+A short feature history dating back to Bash-2.0:
+
+Bash-4.1 contained the following new features:
+
 o   Here-documents within $(...) command substitutions may once more be
     delimited by the closing right paren, instead of requiring a newline.
 
@@ -502,8 +576,6 @@ o   New bindable readline variable: enable-meta-key.  Controls whether or not
     readline sends the smm/rmm sequences if the terminal indicates it has a
     meta key that enables eight-bit characters.
 
-A short feature history dating from Bash-2.0:
-
 Bash-4.0 contained the following new features:
 
 o   When using substring expansion on the positional parameters, a starting
@@ -901,10 +973,10 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
 lots of code now smaller and faster
 test suite greatly expanded
 
-B2) Are there any user-visible incompatibilities between bash-4.1 and
+B2) Are there any user-visible incompatibilities between bash-4.2 and
     previous bash versions?
 
-There are a few incompatibilities between version 4.1 and previous
+There are a few incompatibilities between version 4.2 and previous
 versions.  They are detailed in the file COMPAT in the bash distribution.
 That file is not meant to be all-encompassing; send mail to
 bash-maintainers@gnu.org (or bug-bash@gnu.org if you would like
@@ -1118,7 +1190,7 @@ C3)  Which new features in ksh-93 are not in bash, and which are?
 
 This list is current through ksh93t+ (05/05/2009)
 
-New things in ksh-93 not in bash-4.1:
+New things in ksh-93 not in bash-4.2:
        floating point arithmetic and variables
        math library functions
        ${!name[sub]} name of subscript for associative array
@@ -1140,7 +1212,7 @@ New things in ksh-93 not in bash-4.1:
        `fc' has been renamed to `hist'
        `.' can execute shell functions
        getopts -a
-       printf %B, %H, %P, %R, %T, %Z modifiers, output base for %d, `=' flag
+       printf %B, %H, %P, %R, %Z modifiers, output base for %d, `=' flag
        read -n/-N differ/-v
        set -o showme/-o multiline (bash default)
        `sleep' and `getconf' builtins (bash has loadable versions)
@@ -1148,16 +1220,14 @@ New things in ksh-93 not in bash-4.1:
        [[ -R name ]] (checks whether or not name is a nameref)
        typeset -C/-S/-T/-X/-h/-s
        experimental `type' definitions (a la typedef) using typeset
-       negative subscripts for indexed array variables
        array expansions ${array[sub1..sub2]} and ${!array[sub1..sub2]}
        associative array assignments using `;' as element separator
        command substitution $(n<#) expands to current byte offset for fd N
        new '${ ' form of command substitution, executed in current shell
        new >;/<>;/<#pat/<##pat/<#/># redirections
        brace expansion printf-like formats 
-       [[ -v var ]] operators (checks whether or not var is set)
 
-New things in ksh-93 present in bash-4.1:
+New things in ksh-93 present in bash-4.2:
        associative arrays
        [n]<&word- and [n]>&word- redirections (combination dup and close)
         for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
@@ -1165,6 +1235,7 @@ New things in ksh-93 present in bash-4.1:
        expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]},
                    ${!param*}
        compound array assignment
+       negative subscripts for indexed array variables
        the `!' reserved word
        loadable builtins -- but ksh uses `builtin' while bash uses `enable'
        new $'...' and $"..." quoting
@@ -1174,6 +1245,7 @@ New things in ksh-93 present in bash-4.1:
        `command', `builtin', `disown' builtins
        echo -e
        exec -c/-a
+       printf %T modifier
        read -A (bash uses read -a)
         read -t/-d
        trap -p
@@ -1193,6 +1265,7 @@ New things in ksh-93 present in bash-4.1:
        negative offsets in ${param:offset:length}
        redirection operators preceded with {varname} to store fd number in varname
        DEBUG can force skipping following command
+       [[ -v var ]] operator (checks whether or not var is set)
 
 Section D:  Why does bash do some things differently than other Unix shells?
 
@@ -1778,7 +1851,8 @@ compat40 set
        - the < and > operators to the [[ command do not consider the current
          locale when comparing strings
        - interrupting a command list such as "a ; b ; c" causes the execution
-         of the entire list to be aborted
+         of the entire list to be aborted (in versions before bash-4.0,
+         interrupting one command in a list caused the next to be executed)
 
 Section F:  Things to watch out for on certain Unix versions
 
index f1b5ba496726ccd7f062012efb4f0658d342fa49..3e33f3f6fef1d45a494b42e1922426eee7da3bad 100644 (file)
@@ -3645,6 +3645,7 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
   pid_t old_last_async_pid;
   sh_builtin_func_t *builtin;
   SHELL_VAR *func;
+  volatile int old_builtin, old_command_builtin;
 
   result = EXECUTION_SUCCESS;
   special_builtin_failed = builtin_is_special = 0;
@@ -3895,6 +3896,8 @@ run_builtin:
     {
       if (builtin)
         {
+         old_builtin = executing_builtin;
+         old_command_builtin = executing_command_builtin;
          unwind_protect_int (executing_builtin);       /* modified in execute_builtin */
          unwind_protect_int (executing_command_builtin);       /* ditto */
         }
@@ -3979,6 +3982,11 @@ run_builtin:
   bind_lastarg (lastarg);
   FREE (command_line);
   dispose_words (words);
+  if (builtin)
+    {
+      executing_builtin = old_builtin;
+      executing_command_builtin = old_command_builtin;
+    }
   discard_unwind_frame ("simple-command");
   this_command_name = (char *)NULL;    /* points to freed memory now */
   return (result);
index 5ff8afd43dde71d121ade93a8844236eec038b33..3c20c3c00bd475b1396c1446e70d5521d14b3182 100644 (file)
@@ -1240,8 +1240,9 @@ brand ()
      October 1988, p. 1195. filtered through FreeBSD */
   long h, l;
 
+  /* Can't seed with 0. */
   if (rseed == 0)
-    seedrand ();
+    rseed = 123459876;
   h = rseed / 127773;
   l = rseed % 127773;
   rseed = 16807 * l - 2836 * h;
index 23cdd4873eeb93c79af2b12d86be6b75c7912358..5ff8afd43dde71d121ade93a8844236eec038b33 100644 (file)
@@ -3310,7 +3310,7 @@ push_temp_var (data)
     }
   v->attributes |= var->attributes;
 
-  if (find_special_var (var->name))
+  if (find_special_var (var->name) >= 0)
     tempvar_list[tvlist_ind++] = savestring (var->name);
 
   dispose_variable (var);
@@ -3327,7 +3327,7 @@ propagate_temp_var (data)
     push_temp_var (data);
   else
     {
-      if (find_special_var (var->name))
+      if (find_special_var (var->name) >= 0)
        tempvar_list[tvlist_ind++] = savestring (var->name);
       dispose_variable (var);
     }