]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20150306 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 9 Mar 2015 15:12:00 +0000 (11:12 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 9 Mar 2015 15:12:00 +0000 (11:12 -0400)
22 files changed:
CWRU/CWRU.chlog
INSTALL
POSIX
RBASH
arrayfunc.c
arrayfunc.h
builtins/declare.def
builtins/printf.def
builtins/read.def
builtins/set.def
examples/loadables/mkdir.c
jobs.c
lib/readline/display.c
lib/readline/signals.c
lib/sh/shquote.c
parse.y
pathexp.c
redir.c
subst.c
test.c
trap.c
variables.c

index fea517c336fdb6a624fdf50d97c1ddc138afdf6c..33571f7118a38f61b375a424969530efd2145b3e 100644 (file)
@@ -8052,3 +8052,54 @@ execute_cmd.c
          so a function that returns a non-zero value and triggers an ERR trap
          has the right value for LINENO. Any simple command in the function
          body can change it.  Bug report from Paul Donohue <gnu@paulsd.com>
+
+                                   3/5
+                                   ---
+lib/sh/shquote.c
+       - sh_backslash_quote: cast `c' to `unsigned char' before using as
+         index into backslash_table.  Report and fix from
+         alexeyv.90@gmail.com
+
+arrayfunc.[ch]
+       - valid_array_reference: added second `flags' argument for future use;
+         currently unused
+
+parse.y,{redir,subst,variables,test}.c
+builtins/{declare,printf,read,set}.def
+       - valid_array_reference: changed callers
+
+                                   3/7
+                                   ---
+lib/readline/signals.c
+       - _rl_handle_signal: if readline gets a SIGTSTP or SIGTTIN, block
+         SIGTTOU so a backgrounded readline can reset the terminal settings
+         appropriately, otherwise the terminal state and readline's idea
+         of it can get messed up.  Original report from Dave Wysochanski
+         <dwysocha@redhat.com> and Dave Anderson <anderson@redhat.com>
+
+trap.c
+       - run_pending_traps: don't allow recursive SIGWINCH trap invocations;
+         they're wasteful and trying to handle a stream of signals while a
+         user resizes the terminal can lead to malloc errors trying to save
+         and restore the_pipeline multiple times.  Problem reported most
+         recently by Martin M. S. Pederson (Fedora bash bug 1197768
+         https://bugzilla.redhat.com/show_bug.cgi?id=1197768)
+       - reset_or_restore_signal_handlers: set pending_traps to 0 for all
+         signals when forking a child. TENTATIVE fix
+
+jobs.c
+       - {save,restore}_pipeline: block SIGCHLD while manipulating the_pipeline
+         like cleanup_the_pipeline does. XXX - may not be necessary
+
+lib/readline/display.c
+       - rl_redisplay: fixed case where multibyte character in the prompt
+         (e.g., \u03bb) in the last screen column causes problems with line
+         wrapping because the newline marker is put in the middle of the
+         multibyte char.  Most recently reported on Ubuntu by
+         <sterpe@gmail.com>
+
+pathexp.c
+       - quote_string_for_globbing: if a bracket expression doesn't have a
+         closing right bracket, rescan it from just after the opening
+         bracket without treating it as a bracket expression.  Bug report
+         from Stephane Chazelas <stephane.chazelas@gmail.com>
diff --git a/INSTALL b/INSTALL
index ebe7ea1cc6472bec46d1b2fc81db9b49ed85d016..bb19bd9239f95b239915bec1e6a1d57db873fbec 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -5,37 +5,37 @@ These are installation instructions for Bash.
 
 The simplest way to compile Bash is:
 
-  1. `cd' to the directory containing the source code and type
-     `./configure' to configure Bash for your system.  If you're using
-     `csh' on an old version of System V, you might need to type `sh
-     ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
+  1. 'cd' to the directory containing the source code and type
+     './configure' to configure Bash for your system.  If you're using
+     'csh' on an old version of System V, you might need to type 'sh
+     ./configure' instead to prevent 'csh' from trying to execute
+     'configure' itself.
 
-     Running `configure' takes some time.  While running, it prints
+     Running 'configure' takes some time.  While running, it prints
      messages telling which features it is checking for.
 
-  2. Type `make' to compile Bash and build the `bashbug' bug reporting
+  2. Type 'make' to compile Bash and build the 'bashbug' bug reporting
      script.
 
-  3. Optionally, type `make tests' to run the Bash test suite.
+  3. Optionally, type 'make tests' to run the Bash test suite.
 
-  4. Type `make install' to install `bash' and `bashbug'.  This will
+  4. Type 'make install' to install 'bash' and 'bashbug'.  This will
      also install the manual pages and Info file.
 
-The `configure' shell script attempts to guess correct values for
+The 'configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package
-(the top directory, the `builtins', `doc', and `support' directories,
-each directory under `lib', and several others).  It also creates a
-`config.h' file containing system-dependent definitions.  Finally, it
-creates a shell script named `config.status' that you can run in the
-future to recreate the current configuration, a file `config.cache'
-that saves the results of its tests to speed up reconfiguring, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').  If at some point `config.cache' contains
-results you don't want to keep, you may remove or edit it.
-
-To find out more about the options and arguments that the `configure'
+those values to create a 'Makefile' in each directory of the package
+(the top directory, the 'builtins', 'doc', and 'support' directories,
+each directory under 'lib', and several others).  It also creates a
+'config.h' file containing system-dependent definitions.  Finally, it
+creates a shell script named 'config.status' that you can run in the
+future to recreate the current configuration, a file 'config.cache' that
+saves the results of its tests to speed up reconfiguring, and a file
+'config.log' containing compiler output (useful mainly for debugging
+'configure').  If at some point 'config.cache' contains results you
+don't want to keep, you may remove or edit it.
+
+To find out more about the options and arguments that the 'configure'
 script understands, type
 
      bash-2.04$ ./configure --help
@@ -43,32 +43,32 @@ script understands, type
 at the Bash prompt in your Bash source directory.
 
 If you need to do unusual things to compile Bash, please try to figure
-out how `configure' could check whether or not to do them, and mail
+out how 'configure' could check whether or not to do them, and mail
 diffs or instructions to <bash-maintainers@gnu.org> so they can be
 considered for the next release.
 
-The file `configure.ac' is used to create `configure' by a program
-called Autoconf.  You only need `configure.ac' if you want to change it
-or regenerate `configure' using a newer version of Autoconf.  If you do
+The file 'configure.ac' is used to create 'configure' by a program
+called Autoconf.  You only need 'configure.ac' if you want to change it
+or regenerate 'configure' using a newer version of Autoconf.  If you do
 this, make sure you are using Autoconf version 2.50 or newer.
 
 You can remove the program binaries and object files from the source
-code directory by typing `make clean'.  To also remove the files that
-`configure' created (so you can compile Bash for a different kind of
-computer), type `make distclean'.
+code directory by typing 'make clean'.  To also remove the files that
+'configure' created (so you can compile Bash for a different kind of
+computer), type 'make distclean'.
 
 Compilers and Options
 =====================
 
-Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
+Some systems require unusual options for compilation or linking that the
+'configure' script does not know about.  You can give 'configure'
 initial values for variables by setting them in the environment.  Using
 a Bourne-compatible shell, you can do that on the command line like
 this:
 
      CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
 
-On systems that have the `env' program, you can do it like this:
+On systems that have the 'env' program, you can do it like this:
 
      env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
 
@@ -79,343 +79,347 @@ Compiling For Multiple Architectures
 
 You can compile Bash for more than one kind of computer at the same
 time, by placing the object files for each architecture in their own
-directory.  To do this, you must use a version of `make' that supports
-the `VPATH' variable, such as GNU `make'.  `cd' to the directory where
-you want the object files and executables to go and run the `configure'
+directory.  To do this, you must use a version of 'make' that supports
+the 'VPATH' variable, such as GNU 'make'.  'cd' to the directory where
+you want the object files and executables to go and run the 'configure'
 script from the source directory.  You may need to supply the
-`--srcdir=PATH' argument to tell `configure' where the source files
-are.  `configure' automatically checks for the source code in the
-directory that `configure' is in and in `..'.
+'--srcdir=PATH' argument to tell 'configure' where the source files are.
+'configure' automatically checks for the source code in the directory
+that 'configure' is in and in '..'.
 
-If you have to use a `make' that does not supports the `VPATH'
-variable, you can compile Bash for one architecture at a time in the
-source code directory.  After you have installed Bash for one
-architecture, use `make distclean' before reconfiguring for another
-architecture.
+If you have to use a 'make' that does not supports the 'VPATH' variable,
+you can compile Bash for one architecture at a time in the source code
+directory.  After you have installed Bash for one architecture, use
+'make distclean' before reconfiguring for another architecture.
 
 Alternatively, if your system supports symbolic links, you can use the
-`support/mkclone' script to create a build tree which has symbolic
-links back to each file in the source directory.  Here's an example
-that creates a build directory in the current directory from a source
-directory `/usr/gnu/src/bash-2.0':
+'support/mkclone' script to create a build tree which has symbolic links
+back to each file in the source directory.  Here's an example that
+creates a build directory in the current directory from a source
+directory '/usr/gnu/src/bash-2.0':
 
      bash /usr/gnu/src/bash-2.0/support/mkclone -s /usr/gnu/src/bash-2.0 .
 
-The `mkclone' script requires Bash, so you must have already built Bash
+The 'mkclone' script requires Bash, so you must have already built Bash
 for at least one architecture before you can create build directories
 for other architectures.
 
 Installation Names
 ==================
 
-By default, `make install' will install into `/usr/local/bin',
-`/usr/local/man', etc.  You can specify an installation prefix other
-than `/usr/local' by giving `configure' the option `--prefix=PATH', or
-by specifying a value for the `DESTDIR' `make' variable when running
-`make install'.
+By default, 'make install' will install into '/usr/local/bin',
+'/usr/local/man', etc.  You can specify an installation prefix other
+than '/usr/local' by giving 'configure' the option '--prefix=PATH', or
+by specifying a value for the 'DESTDIR' 'make' variable when running
+'make install'.
 
-You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', `make install' will
-use PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+You can specify separate installation prefixes for architecture-specific
+files and architecture-independent files.  If you give 'configure' the
+option '--exec-prefix=PATH', 'make install' will use PATH as the prefix
+for installing programs and libraries.  Documentation and other data
+files will still use the regular prefix.
 
 Specifying the System Type
 ==========================
 
-There may be some features `configure' can not figure out
-automatically, but need to determine by the type of host Bash will run
-on.  Usually `configure' can figure that out, but if it prints a
-message saying it can not guess the host type, give it the
-`--host=TYPE' option.  `TYPE' can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
-`CPU-COMPANY-SYSTEM' (e.g., `i386-unknown-freebsd4.2').
+There may be some features 'configure' can not figure out automatically,
+but need to determine by the type of host Bash will run on.  Usually
+'configure' can figure that out, but if it prints a message saying it
+can not guess the host type, give it the '--host=TYPE' option.  'TYPE'
+can either be a short name for the system type, such as 'sun4', or a
+canonical name with three fields: 'CPU-COMPANY-SYSTEM' (e.g.,
+'i386-unknown-freebsd4.2').
 
-See the file `support/config.sub' for the possible values of each field.
+See the file 'support/config.sub' for the possible values of each field.
 
 Sharing Defaults
 ================
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.  `configure'
-looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: the Bash `configure' looks for a site script, but not all
-`configure' scripts do.
+If you want to set default values for 'configure' scripts to share, you
+can create a site shell script called 'config.site' that gives default
+values for variables like 'CC', 'cache_file', and 'prefix'.  'configure'
+looks for 'PREFIX/share/config.site' if it exists, then
+'PREFIX/etc/config.site' if it exists.  Or, you can set the
+'CONFIG_SITE' environment variable to the location of the site script.
+A warning: the Bash 'configure' looks for a site script, but not all
+'configure' scripts do.
 
 Operation Controls
 ==================
 
-`configure' recognizes the following options to control how it operates.
+'configure' recognizes the following options to control how it operates.
 
-`--cache-file=FILE'
+'--cache-file=FILE'
      Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
+     './config.cache'.  Set FILE to '/dev/null' to disable caching, for
+     debugging 'configure'.
 
-`--help'
-     Print a summary of the options to `configure', and exit.
+'--help'
+     Print a summary of the options to 'configure', and exit.
 
-`--quiet'
-`--silent'
-`-q'
+'--quiet'
+'--silent'
+'-q'
      Do not print messages saying which checks are being made.
 
-`--srcdir=DIR'
+'--srcdir=DIR'
      Look for the Bash source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
+     'configure' can determine that directory automatically.
 
-`--version'
-     Print the version of Autoconf used to generate the `configure'
+'--version'
+     Print the version of Autoconf used to generate the 'configure'
      script, and exit.
 
-`configure' also accepts some other, not widely used, boilerplate
-options.  `configure --help' prints the complete list.
+'configure' also accepts some other, not widely used, boilerplate
+options.  'configure --help' prints the complete list.
 
 Optional Features
 =================
 
-The Bash `configure' has a number of `--enable-FEATURE' options, where
+The Bash 'configure' has a number of '--enable-FEATURE' options, where
 FEATURE indicates an optional part of Bash.  There are also several
-`--with-PACKAGE' options, where PACKAGE is something like `bash-malloc'
-or `purify'.  To turn off the default use of a package, use
-`--without-PACKAGE'.  To configure Bash without a feature that is
-enabled by default, use `--disable-FEATURE'.
+'--with-PACKAGE' options, where PACKAGE is something like 'bash-malloc'
+or 'purify'.  To turn off the default use of a package, use
+'--without-PACKAGE'.  To configure Bash without a feature that is
+enabled by default, use '--disable-FEATURE'.
 
-Here is a complete list of the `--enable-' and `--with-' options that
-the Bash `configure' recognizes.
+Here is a complete list of the '--enable-' and '--with-' options that
+the Bash 'configure' recognizes.
 
-`--with-afs'
+'--with-afs'
      Define if you are using the Andrew File System from Transarc.
 
-`--with-bash-malloc'
-     Use the Bash version of `malloc' in the directory `lib/malloc'.
-     This is not the same `malloc' that appears in GNU libc, but an
-     older version originally derived from the 4.2 BSD `malloc'.  This
-     `malloc' is very fast, but wastes some space on each allocation.
-     This option is enabled by default.  The `NOTES' file contains a
+'--with-bash-malloc'
+     Use the Bash version of 'malloc' in the directory 'lib/malloc'.
+     This is not the same 'malloc' that appears in GNU libc, but an
+     older version originally derived from the 4.2 BSD 'malloc'.  This
+     'malloc' is very fast, but wastes some space on each allocation.
+     This option is enabled by default.  The 'NOTES' file contains a
      list of systems for which this should be turned off, and
-     `configure' disables this option automatically for a number of
+     'configure' disables this option automatically for a number of
      systems.
 
-`--with-curses'
+'--with-curses'
      Use the curses library instead of the termcap library.  This should
      be supplied if your system has an inadequate or incomplete termcap
      database.
 
-`--with-gnu-malloc'
-     A synonym for `--with-bash-malloc'.
+'--with-gnu-malloc'
+     A synonym for '--with-bash-malloc'.
 
-`--with-installed-readline[=PREFIX]'
+'--with-installed-readline[=PREFIX]'
      Define this to make Bash link with a locally-installed version of
-     Readline rather than the version in `lib/readline'.  This works
-     only with Readline 5.0 and later versions.  If PREFIX is `yes' or
-     not supplied, `configure' uses the values of the make variables
-     `includedir' and `libdir', which are subdirectories of `prefix' by
+     Readline rather than the version in 'lib/readline'.  This works
+     only with Readline 5.0 and later versions.  If PREFIX is 'yes' or
+     not supplied, 'configure' uses the values of the make variables
+     'includedir' and 'libdir', which are subdirectories of 'prefix' by
      default, to find the installed version of Readline if it is not in
      the standard system include and library directories.  If PREFIX is
-     `no', Bash links with the version in `lib/readline'.  If PREFIX is
-     set to any other value, `configure' treats it as a directory
+     'no', Bash links with the version in 'lib/readline'.  If PREFIX is
+     set to any other value, 'configure' treats it as a directory
      pathname and looks for the installed version of Readline in
-     subdirectories of that directory (include files in
-     PREFIX/`include' and the library in PREFIX/`lib').
+     subdirectories of that directory (include files in PREFIX/'include'
+     and the library in PREFIX/'lib').
 
-`--with-purify'
+'--with-purify'
      Define this to use the Purify memory allocation checker from
      Rational Software.
 
-`--enable-minimal-config'
+'--enable-minimal-config'
      This produces a shell with minimal features, close to the
      historical Bourne shell.
 
-There are several `--enable-' options that alter how Bash is compiled
+There are several '--enable-' options that alter how Bash is compiled
 and linked, rather than changing run-time features.
 
-`--enable-largefile'
+'--enable-largefile'
      Enable support for large files
      (http://www.sas.com/standards/large_file/x_open.20Mar96.html) if
      the operating system requires special compiler options to build
-     programs which can access large files.  This is enabled by
-     default, if the operating system provides large file support.
+     programs which can access large files.  This is enabled by default,
+     if the operating system provides large file support.
 
-`--enable-profiling'
+'--enable-profiling'
      This builds a Bash binary that produces profiling information to be
-     processed by `gprof' each time it is executed.
+     processed by 'gprof' each time it is executed.
 
-`--enable-static-link'
-     This causes Bash to be linked statically, if `gcc' is being used.
+'--enable-static-link'
+     This causes Bash to be linked statically, if 'gcc' is being used.
      This could be used to build a version to use as root's shell.
 
-The `minimal-config' option can be used to disable all of the following
-options, but it is processed first, so individual options may be
-enabled using `enable-FEATURE'.
+The 'minimal-config' option can be used to disable all of the following
+options, but it is processed first, so individual options may be enabled
+using 'enable-FEATURE'.
 
-All of the following options except for `disabled-builtins',
-`directpand-default', and `xpg-echo-default' are enabled by default,
+All of the following options except for 'disabled-builtins',
+'direxpand-default', and 'xpg-echo-default' are enabled by default,
 unless the operating system does not provide the necessary support.
 
-`--enable-alias'
-     Allow alias expansion and include the `alias' and `unalias'
+'--enable-alias'
+     Allow alias expansion and include the 'alias' and 'unalias'
      builtins (*note Aliases::).
 
-`--enable-arith-for-command'
-     Include support for the alternate form of the `for' command that
-     behaves like the C language `for' statement (*note Looping
+'--enable-arith-for-command'
+     Include support for the alternate form of the 'for' command that
+     behaves like the C language 'for' statement (*note Looping
      Constructs::).
 
-`--enable-array-variables'
+'--enable-array-variables'
      Include support for one-dimensional array shell variables (*note
      Arrays::).
 
-`--enable-bang-history'
-     Include support for `csh'-like history substitution (*note History
+'--enable-bang-history'
+     Include support for 'csh'-like history substitution (*note History
      Interaction::).
 
-`--enable-brace-expansion'
-     Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ).
+'--enable-brace-expansion'
+     Include 'csh'-like brace expansion ( 'b{a,b}c' ==> 'bac bbc' ).
      See *note Brace Expansion::, for a complete description.
 
-`--enable-casemod-attributes'
-     Include support for case-modifying attributes in the `declare'
+'--enable-casemod-attributes'
+     Include support for case-modifying attributes in the 'declare'
      builtin and assignment statements.  Variables with the UPPERCASE
      attribute, for example, will have their values converted to
      uppercase upon assignment.
 
-`--enable-casemod-expansion'
+'--enable-casemod-expansion'
      Include support for case-modifying word expansions.
 
-`--enable-command-timing'
-     Include support for recognizing `time' as a reserved word and for
-     displaying timing statistics for the pipeline following `time'
+'--enable-command-timing'
+     Include support for recognizing 'time' as a reserved word and for
+     displaying timing statistics for the pipeline following 'time'
      (*note Pipelines::).  This allows pipelines as well as shell
      builtins and functions to be timed.
 
-`--enable-cond-command'
-     Include support for the `[[' conditional command.  (*note
+'--enable-cond-command'
+     Include support for the '[[' conditional command.  (*note
      Conditional Constructs::).
 
-`--enable-cond-regexp'
+'--enable-cond-regexp'
      Include support for matching POSIX regular expressions using the
-     `=~' binary operator in the `[[' conditional command.  (*note
+     '=~' binary operator in the '[[' conditional command.  (*note
      Conditional Constructs::).
 
-`--enable-coprocesses'
-     Include support for coprocesses and the `coproc' reserved word
+'--enable-coprocesses'
+     Include support for coprocesses and the 'coproc' reserved word
      (*note Pipelines::).
 
-`--enable-debugger'
+'--enable-debugger'
      Include support for the bash debugger (distributed separately).
 
-`--enable-direxpand-default'
-     Cause the `direxpand' shell option (*note The Shopt Builtin::) to
+'--enable-direxpand-default'
+     Cause the 'direxpand' shell option (*note The Shopt Builtin::) to
      be enabled by default when the shell starts.  It is normally
      disabled by default.
 
-`--enable-directory-stack'
-     Include support for a `csh'-like directory stack and the `pushd',
-     `popd', and `dirs' builtins (*note The Directory Stack::).
+'--enable-directory-stack'
+     Include support for a 'csh'-like directory stack and the 'pushd',
+     'popd', and 'dirs' builtins (*note The Directory Stack::).
 
-`--enable-disabled-builtins'
-     Allow builtin commands to be invoked via `builtin xxx' even after
-     `xxx' has been disabled using `enable -n xxx'.  See *note Bash
-     Builtins::, for details of the `builtin' and `enable' builtin
+'--enable-disabled-builtins'
+     Allow builtin commands to be invoked via 'builtin xxx' even after
+     'xxx' has been disabled using 'enable -n xxx'.  See *note Bash
+     Builtins::, for details of the 'builtin' and 'enable' builtin
      commands.
 
-`--enable-dparen-arithmetic'
-     Include support for the `((...))' command (*note Conditional
+'--enable-dparen-arithmetic'
+     Include support for the '((...))' command (*note Conditional
      Constructs::).
 
-`--enable-extended-glob'
+'--enable-extended-glob'
      Include support for the extended pattern matching features
      described above under *note Pattern Matching::.
 
-`--enable-extended-glob-default'
+'--enable-extended-glob-default'
      Set the default value of the EXTGLOB shell option described above
      under *note The Shopt Builtin:: to be enabled.
 
-`--enable-glob-asciirange-default'
+'--enable-function-import'
+     Include support for importing function definitions exported by
+     another instance of the shell from the environment.  This option is
+     enabled by default.
+
+'--enable-glob-asciirange-default'
      Set the default value of the GLOBASCIIRANGES shell option described
-     above under *note The Shopt Builtin:: to be enabled.  This
-     controls the behavior of character ranges when used in pattern
-     matching bracket expressions.
+     above under *note The Shopt Builtin:: to be enabled.  This controls
+     the behavior of character ranges when used in pattern matching
+     bracket expressions.
 
-`--enable-help-builtin'
-     Include the `help' builtin, which displays help on shell builtins
+'--enable-help-builtin'
+     Include the 'help' builtin, which displays help on shell builtins
      and variables (*note Bash Builtins::).
 
-`--enable-history'
-     Include command history and the `fc' and `history' builtin
-     commands (*note Bash History Facilities::).
+'--enable-history'
+     Include command history and the 'fc' and 'history' builtin commands
+     (*note Bash History Facilities::).
 
-`--enable-job-control'
-     This enables the job control features (*note Job Control::), if
-     the operating system supports them.
+'--enable-job-control'
+     This enables the job control features (*note Job Control::), if the
+     operating system supports them.
 
-`--enable-multibyte'
+'--enable-multibyte'
      This enables support for multibyte characters if the operating
      system provides the necessary support.
 
-`--enable-net-redirections'
+'--enable-net-redirections'
      This enables the special handling of filenames of the form
-     `/dev/tcp/HOST/PORT' and `/dev/udp/HOST/PORT' when used in
+     '/dev/tcp/HOST/PORT' and '/dev/udp/HOST/PORT' when used in
      redirections (*note Redirections::).
 
-`--enable-process-substitution'
+'--enable-process-substitution'
      This enables process substitution (*note Process Substitution::) if
      the operating system provides the necessary support.
 
-`--enable-progcomp'
+'--enable-progcomp'
      Enable the programmable completion facilities (*note Programmable
      Completion::).  If Readline is not enabled, this option has no
      effect.
 
-`--enable-prompt-string-decoding'
+'--enable-prompt-string-decoding'
      Turn on the interpretation of a number of backslash-escaped
-     characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt
+     characters in the '$PS1', '$PS2', '$PS3', and '$PS4' prompt
      strings.  See *note Controlling the Prompt::, for a complete list
      of prompt string escape sequences.
 
-`--enable-readline'
+'--enable-readline'
      Include support for command-line editing and history with the Bash
      version of the Readline library (*note Command Line Editing::).
 
-`--enable-restricted'
+'--enable-restricted'
      Include support for a "restricted shell".  If this is enabled,
-     Bash, when called as `rbash', enters a restricted mode.  See *note
+     Bash, when called as 'rbash', enters a restricted mode.  See *note
      The Restricted Shell::, for a description of restricted mode.
 
-`--enable-select'
-     Include the `select' compound command, which allows the generation
+'--enable-select'
+     Include the 'select' compound command, which allows the generation
      of simple menus (*note Conditional Constructs::).
 
-`--enable-separate-helpfiles'
-     Use external files for the documentation displayed by the `help'
+'--enable-separate-helpfiles'
+     Use external files for the documentation displayed by the 'help'
      builtin instead of storing the text internally.
 
-`--enable-single-help-strings'
-     Store the text displayed by the `help' builtin as a single string
+'--enable-single-help-strings'
+     Store the text displayed by the 'help' builtin as a single string
      for each help topic.  This aids in translating the text to
-     different languages.  You may need to disable this if your
-     compiler cannot handle very long string literals.
+     different languages.  You may need to disable this if your compiler
+     cannot handle very long string literals.
 
-`--enable-strict-posix-default'
+'--enable-strict-posix-default'
      Make Bash POSIX-conformant by default (*note Bash POSIX Mode::).
 
-`--enable-usg-echo-default'
-     A synonym for `--enable-xpg-echo-default'.
-
-`--enable-xpg-echo-default'
-     Make the `echo' builtin expand backslash-escaped characters by
-     default, without requiring the `-e' option.  This sets the default
-     value of the `xpg_echo' shell option to `on', which makes the Bash
-     `echo' behave more like the version specified in the Single Unix
-     Specification, version 3.  *Note Bash Builtins::, for a
-     description of the escape sequences that `echo' recognizes.
-
-The file `config-top.h' contains C Preprocessor `#define' statements
-for options which are not settable from `configure'.  Some of these are
-not meant to be changed; beware of the consequences if you do.  Read
-the comments associated with each definition for more information about
-its effect.
+'--enable-usg-echo-default'
+     A synonym for '--enable-xpg-echo-default'.
+
+'--enable-xpg-echo-default'
+     Make the 'echo' builtin expand backslash-escaped characters by
+     default, without requiring the '-e' option.  This sets the default
+     value of the 'xpg_echo' shell option to 'on', which makes the Bash
+     'echo' behave more like the version specified in the Single Unix
+     Specification, version 3.  *Note Bash Builtins::, for a description
+     of the escape sequences that 'echo' recognizes.
+
+The file 'config-top.h' contains C Preprocessor '#define' statements for
+options which are not settable from 'configure'.  Some of these are not
+meant to be changed; beware of the consequences if you do.  Read the
+comments associated with each definition for more information about its
+effect.
diff --git a/POSIX b/POSIX
index fe830f0ef5cd6ee53c8e468769d1e4fae78e4b0e..1f1bb5206939a51fde30cc5edba4269217ee38ee 100644 (file)
--- a/POSIX
+++ b/POSIX
+
 6.11 Bash POSIX Mode
 ====================
 
-Starting Bash with the `--posix' command-line option or executing `set
+Starting Bash with the '--posix' command-line option or executing 'set
 -o posix' while Bash is running will cause Bash to conform more closely
 to the POSIX standard by changing the behavior to match that specified
 by POSIX in areas where the Bash default differs.
 
-When invoked as `sh', Bash enters POSIX mode after reading the startup
+When invoked as 'sh', Bash enters POSIX mode after reading the startup
 files.
 
-The following list is what's changed when `POSIX mode' is in effect:
+The following list is what's changed when 'POSIX mode' is in effect:
 
   1. When a command in the hash table no longer exists, Bash will
-     re-search `$PATH' to find the new location.  This is also
-     available with `shopt -s checkhash'.
+     re-search '$PATH' to find the new location.  This is also available
+     with 'shopt -s checkhash'.
 
   2. The message printed by the job control code and builtins when a job
-     exits with a non-zero status is `Done(status)'.
+     exits with a non-zero status is 'Done(status)'.
 
   3. The message printed by the job control code and builtins when a job
-     is stopped is `Stopped(SIGNAME)', where SIGNAME is, for example,
-     `SIGTSTP'.
+     is stopped is 'Stopped(SIGNAME)', where SIGNAME is, for example,
+     'SIGTSTP'.
 
-  4. The `bg' builtin uses the required format to describe each job
+  4. The 'bg' builtin uses the required format to describe each job
      placed in the background, which does not include an indication of
      whether the job is the current or previous job.
 
   5. Reserved words appearing in a context where reserved words are
      recognized do not undergo alias expansion.
 
-  6. The POSIX `PS1' and `PS2' expansions of `!' to the history number
-     and `!!' to `!' are enabled, and parameter expansion is performed
-     on the values of `PS1' and `PS2' regardless of the setting of the
-     `promptvars' option.
+  6. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
+     and '!!' to '!' are enabled, and parameter expansion is performed
+     on the values of 'PS1' and 'PS2' regardless of the setting of the
+     'promptvars' option.
 
-  7. The POSIX startup files are executed (`$ENV') rather than the
+  7. The POSIX startup files are executed ('$ENV') rather than the
      normal Bash files.
 
   8. Tilde expansion is only performed on assignments preceding a
      command name, rather than on all assignment statements on the line.
 
-  9. The `command' builtin does not prevent builtins that take
+  9. The 'command' builtin does not prevent builtins that take
      assignment statements as arguments from expanding them as
      assignment statements; when not in POSIX mode, assignment builtins
      lose their assignment statement expansion properties when preceded
-     by `command'.
+     by 'command'.
 
10. The default history file is `~/.sh_history' (this is the default
-     value of `$HISTFILE').
 10. The default history file is '~/.sh_history' (this is the default
+     value of '$HISTFILE').
 
11. The output of `kill -l' prints all the signal names on a single
-     line, separated by spaces, without the `SIG' prefix.
 11. The output of 'kill -l' prints all the signal names on a single
+     line, separated by spaces, without the 'SIG' prefix.
 
12. The `kill' builtin does not accept signal names with a `SIG'
 12. The 'kill' builtin does not accept signal names with a 'SIG'
      prefix.
 
13. Non-interactive shells exit if FILENAME in `.' FILENAME is not
 13. Non-interactive shells exit if FILENAME in '.'  FILENAME is not
      found.
 
- 14. Non-interactive shells exit if a syntax error in an arithmetic
 14. Non-interactive shells exit if a syntax error in an arithmetic
      expansion results in an invalid expression.
 
- 15. Non-interactive shells exit if there is a syntax error in a script
-     read with the `.' or `source' builtins, or in a string processed by
-     the `eval' builtin.
 15. Non-interactive shells exit if there is a syntax error in a script
+     read with the '.' or 'source' builtins, or in a string processed by
+     the 'eval' builtin.
 
- 16. Redirection operators do not perform filename expansion on the word
-     in the redirection unless the shell is interactive.
+  16. Redirection operators do not perform filename expansion on the
+     word in the redirection unless the shell is interactive.
 
- 17. Redirection operators do not perform word splitting on the word in
 17. Redirection operators do not perform word splitting on the word in
      the redirection.
 
18. Function names must be valid shell `name's.  That is, they may not
 18. Function names must be valid shell 'name's.  That is, they may not
      contain characters other than letters, digits, and underscores, and
      may not start with a digit.  Declaring a function with an invalid
      name causes a fatal syntax error in non-interactive shells.
 
- 19. Function names may not be the same as one of the POSIX special
 19. Function names may not be the same as one of the POSIX special
      builtins.
 
- 20. POSIX special builtins are found before shell functions during
 20. POSIX special builtins are found before shell functions during
      command lookup.
 
- 21. The `time' reserved word may be used by itself as a command.  When
+  21. Literal tildes that appear as the first character in elements of
+     the 'PATH' variable are not expanded as described above under *note
+     Tilde Expansion::.
+
+  22. The 'time' reserved word may be used by itself as a command.  When
      used in this way, it displays timing statistics for the shell and
-     its completed children.  The `TIMEFORMAT' variable controls the
+     its completed children.  The 'TIMEFORMAT' variable controls the
      format of the timing information.
 
22. When parsing and expanding a ${...} expansion that appears within
 23. When parsing and expanding a ${...} expansion that appears within
      double quotes, single quotes are no longer special and cannot be
      used to quote a closing brace or other special character, unless
      the operator is one of those defined to perform pattern removal.
      In this case, they do not have to appear as matched pairs.
 
- 23. The parser does not recognize `time' as a reserved word if the next
-     token begins with a `-'.
+  24. The parser does not recognize 'time' as a reserved word if the
+     next token begins with a '-'.
 
24. If a POSIX special builtin returns an error status, a
 25. If a POSIX special builtin returns an error status, a
      non-interactive shell exits.  The fatal errors are those listed in
      the POSIX standard, and include things like passing incorrect
      options, redirection errors, variable assignment errors for
      assignments preceding the command name, and so on.
 
25. A non-interactive shell exits with an error status if a variable
 26. A non-interactive shell exits with an error status if a variable
      assignment error occurs when no command name follows the assignment
      statements.  A variable assignment error occurs, for example, when
      trying to assign a value to a readonly variable.
 
26. A non-interactive shell exits with an error status if a variable
 27. A non-interactive shell exits with an error status if a variable
      assignment error occurs in an assignment statement preceding a
      special builtin, but not with any other simple command.
 
- 27. A non-interactive shell exits with an error status if the iteration
-     variable in a `for' statement or the selection variable in a
-     `select' statement is a readonly variable.
+  28. A non-interactive shell exits with an error status if the
+     iteration variable in a 'for' statement or the selection variable
+     in a 'select' statement is a readonly variable.
 
28. Process substitution is not available.
 29. Process substitution is not available.
 
29. While variable indirection is available, it may not be applied to
-     the `#' and `?' special parameters.
 30. While variable indirection is available, it may not be applied to
+     the '#' and '?' special parameters.
 
30. Assignment statements preceding POSIX special builtins persist in
 31. Assignment statements preceding POSIX special builtins persist in
      the shell environment after the builtin completes.
 
- 31. Assignment statements preceding shell function calls persist in the
-     shell environment after the function returns, as if a POSIX
+  32. Assignment statements preceding shell function calls persist in
+     the shell environment after the function returns, as if a POSIX
      special builtin command had been executed.
 
32. The `export' and `readonly' builtin commands display their output
 33. The 'export' and 'readonly' builtin commands display their output
      in the format required by POSIX.
 
- 33. The `trap' builtin displays signal names without the leading `SIG'.
+  34. The 'trap' builtin displays signal names without the leading
+     'SIG'.
 
34. The `trap' builtin doesn't check the first argument for a possible
 35. The 'trap' builtin doesn't check the first argument for a possible
      signal specification and revert the signal handling to the original
      disposition if it is, unless that argument consists solely of
      digits and is a valid signal number.  If users want to reset the
-     handler for a given signal to the original disposition, they
-     should use `-' as the first argument.
+     handler for a given signal to the original disposition, they should
+     use '-' as the first argument.
 
35. The `.' and `source' builtins do not search the current directory
-     for the filename argument if it is not found by searching `PATH'.
 36. The '.' and 'source' builtins do not search the current directory
+     for the filename argument if it is not found by searching 'PATH'.
 
36. Subshells spawned to execute command substitutions inherit the
-     value of the `-e' option from the parent shell.  When not in POSIX
-     mode, Bash clears the `-e' option in such subshells.
 37. Subshells spawned to execute command substitutions inherit the
+     value of the '-e' option from the parent shell.  When not in POSIX
+     mode, Bash clears the '-e' option in such subshells.
 
37. Alias expansion is always enabled, even in non-interactive shells.
 38. Alias expansion is always enabled, even in non-interactive shells.
 
38. When the `alias' builtin displays alias definitions, it does not
-     display them with a leading `alias ' unless the `-p' option is
 39. When the 'alias' builtin displays alias definitions, it does not
+     display them with a leading 'alias ' unless the '-p' option is
      supplied.
 
39. When the `set' builtin is invoked without options, it does not
 40. When the 'set' builtin is invoked without options, it does not
      display shell function names and definitions.
 
40. When the `set' builtin is invoked without options, it displays
 41. When the 'set' builtin is invoked without options, it displays
      variable values without quotes, unless they contain shell
      metacharacters, even if the result contains nonprinting characters.
 
41. When the `cd' builtin is invoked in LOGICAL mode, and the pathname
-     constructed from `$PWD' and the directory name supplied as an
-     argument does not refer to an existing directory, `cd' will fail
 42. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
+     constructed from '$PWD' and the directory name supplied as an
+     argument does not refer to an existing directory, 'cd' will fail
      instead of falling back to PHYSICAL mode.
 
42. The `pwd' builtin verifies that the value it prints is the same as
 43. The 'pwd' builtin verifies that the value it prints is the same as
      the current directory, even if it is not asked to check the file
-     system with the `-P' option.
+     system with the '-P' option.
 
43. When listing the history, the `fc' builtin does not include an
 44. When listing the history, the 'fc' builtin does not include an
      indication of whether or not a history entry has been modified.
 
44. The default editor used by `fc' is `ed'.
 45. The default editor used by 'fc' is 'ed'.
 
- 45. The `type' and `command' builtins will not report a non-executable
-     file as having been found, though the shell will attempt to
-     execute such a file if it is the only so-named file found in
-     `$PATH'.
+  46. The 'type' and 'command' builtins will not report a non-executable
+     file as having been found, though the shell will attempt to execute
+     such a file if it is the only so-named file found in '$PATH'.
 
46. The `vi' editing mode will invoke the `vi' editor directly when
-     the `v' command is run, instead of checking `$VISUAL' and
-     `$EDITOR'.
 47. The 'vi' editing mode will invoke the 'vi' editor directly when
+     the 'v' command is run, instead of checking '$VISUAL' and
+     '$EDITOR'.
 
47. When the `xpg_echo' option is enabled, Bash does not attempt to
-     interpret any arguments to `echo' as options.  Each argument is
 48. When the 'xpg_echo' option is enabled, Bash does not attempt to
+     interpret any arguments to 'echo' as options.  Each argument is
      displayed, after escape characters are converted.
 
48. The `ulimit' builtin uses a block size of 512 bytes for the `-c'
-     and `-f' options.
 49. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
+     and '-f' options.
 
49. The arrival of `SIGCHLD'  when a trap is set on `SIGCHLD' does not
-     interrupt the `wait' builtin and cause it to return immediately.
 50. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
+     interrupt the 'wait' builtin and cause it to return immediately.
      The trap command is run once for each child that exits.
 
50. The `read' builtin may be interrupted by a signal for which a trap
 51. The 'read' builtin may be interrupted by a signal for which a trap
      has been set.  If Bash receives a trapped signal while executing
-     `read', the trap handler executes and `read' returns an exit
-     status greater than 128.
-
+     'read', the trap handler executes and 'read' returns an exit status
+     greater than 128.
 
 There is other POSIX behavior that Bash does not implement by default
 even when in POSIX mode.  Specifically:
 
-  1. The `fc' builtin checks `$EDITOR' as a program to edit history
-     entries if `FCEDIT' is unset, rather than defaulting directly to
-     `ed'.  `fc' uses `ed' if `EDITOR' is unset.
-
-  2. As noted above, Bash requires the `xpg_echo' option to be enabled
-     for the `echo' builtin to be fully conformant.
+  1. The 'fc' builtin checks '$EDITOR' as a program to edit history
+     entries if 'FCEDIT' is unset, rather than defaulting directly to
+     'ed'.  'fc' uses 'ed' if 'EDITOR' is unset.
 
+  2. As noted above, Bash requires the 'xpg_echo' option to be enabled
+     for the 'echo' builtin to be fully conformant.
 
 Bash can be configured to be POSIX-conformant by default, by specifying
-the `--enable-strict-posix-default' to `configure' when building (*note
+the '--enable-strict-posix-default' to 'configure' when building (*note
 Optional Features::).
 
diff --git a/RBASH b/RBASH
index 0e5c10b3e8ea59df105b5e975dd8f8c2b9e43d16..6b0aa358bb7ebb76d8375399828951bbedd4c657 100644 (file)
--- a/RBASH
+++ b/RBASH
@@ -1,49 +1,38 @@
+
 6.10 The Restricted Shell
 =========================
 
-If Bash is started with the name `rbash', or the `--restricted' or `-r'
+If Bash is started with the name 'rbash', or the '--restricted' or '-r'
 option is supplied at invocation, the shell becomes restricted.  A
 restricted shell is used to set up an environment more controlled than
-the standard shell.  A restricted shell behaves identically to `bash'
+the standard shell.  A restricted shell behaves identically to 'bash'
 with the exception that the following are disallowed or not performed:
 
-   * Changing directories with the `cd' builtin.
-
-   * Setting or unsetting the values of the `SHELL', `PATH', `ENV', or
-     `BASH_ENV' variables.
-
+   * Changing directories with the 'cd' builtin.
+   * Setting or unsetting the values of the 'SHELL', 'PATH', 'ENV', or
+     'BASH_ENV' variables.
    * Specifying command names containing slashes.
-
-   * Specifying a filename containing a slash as an argument to the `.'
+   * Specifying a filename containing a slash as an argument to the '.'
      builtin command.
-
-   * Specifying a filename containing a slash as an argument to the `-p'
-     option to the `hash' builtin command.
-
+   * Specifying a filename containing a slash as an argument to the '-p'
+     option to the 'hash' builtin command.
    * Importing function definitions from the shell environment at
      startup.
-
-   * Parsing the value of `SHELLOPTS' from the shell environment at
+   * Parsing the value of 'SHELLOPTS' from the shell environment at
      startup.
-
-   * Redirecting output using the `>', `>|', `<>', `>&', `&>', and `>>'
+   * Redirecting output using the '>', '>|', '<>', '>&', '&>', and '>>'
      redirection operators.
-
-   * Using the `exec' builtin to replace the shell with another command.
-
-   * Adding or deleting builtin commands with the `-f' and `-d' options
-     to the `enable' builtin.
-
-   * Using the `enable' builtin command to enable disabled shell
+   * Using the 'exec' builtin to replace the shell with another command.
+   * Adding or deleting builtin commands with the '-f' and '-d' options
+     to the 'enable' builtin.
+   * Using the 'enable' builtin command to enable disabled shell
      builtins.
-
-   * Specifying the `-p' option to the `command' builtin.
-
-   * Turning off restricted mode with `set +r' or `set +o restricted'.
+   * Specifying the '-p' option to the 'command' builtin.
+   * Turning off restricted mode with 'set +r' or 'set +o restricted'.
 
 These restrictions are enforced after any startup files are read.
 
 When a command that is found to be a shell script is executed (*note
-Shell Scripts::), `rbash' turns off any restrictions in the shell
+Shell Scripts::), 'rbash' turns off any restrictions in the shell
 spawned to execute the script.
 
index 6dab71ca6a6832f52b890365b46946b43a93e35d..cb7333939c2b0dae5aa69d591c60957fde8325ec 100644 (file)
@@ -830,8 +830,9 @@ print_assoc_assignment (var, quoted)
 
 /* Return 1 if NAME is a properly-formed array reference v[sub]. */
 int
-valid_array_reference (name)
+valid_array_reference (name, flags)
      char *name;
+     int flags;
 {
   char *t;
   int r, len;
index 26f4879af3d48149d6c74a3895fd6648dccb1311..5b755329ff12df17d2cd6ffbabe21d9802ac2535 100644 (file)
@@ -57,7 +57,7 @@ extern void print_array_assignment __P((SHELL_VAR *, int));
 extern void print_assoc_assignment __P((SHELL_VAR *, int));
 
 extern arrayind_t array_expand_index __P((SHELL_VAR *, char *, int));
-extern int valid_array_reference __P((char *));
+extern int valid_array_reference __P((char *, int));
 extern char *array_value __P((char *, int, int, int *, arrayind_t *));
 extern char *get_array_value __P((char *, int, int *, arrayind_t *));
 
index 79d7a0c75cabdd5d838d0986c1413a217f6e145f..69c4703dfcd5974ac2c48ad892ea08fa7f28bcab 100644 (file)
@@ -325,7 +325,7 @@ declare_internal (list, local_var)
       if (flags_on & att_nameref)
        {
 #if defined (ARRAY_VARIABLES)
-         if (valid_array_reference (name))
+         if (valid_array_reference (name, 0))
            {
              builtin_error (_("%s: reference variable cannot be an array"), name);
              assign_error++;
@@ -350,7 +350,7 @@ declare_internal (list, local_var)
       if (t = strchr (name, '['))      /* ] */
        {
          /* If offset != 0 we have already validated any array reference */
-         if (offset == 0 && valid_array_reference (name) == 0)
+         if (offset == 0 && valid_array_reference (name, 0) == 0)
            {
              sh_invalidid (name);
              assign_error++;
index b01958ec88bfb81305bcb4d91e5a247ba6cdd96d..9b9d3909016dd98f756e6471685cbe0a6b0ba535 100644 (file)
@@ -255,7 +255,7 @@ printf_builtin (list)
        case 'v':
          vname = list_optarg;
 #if defined (ARRAY_VARS)
-         if (legal_identifier (vname) || valid_array_reference (vname))
+         if (legal_identifier (vname) || valid_array_reference (vname, 0))
 #else
          if (legal_identifier (vname))
 #endif
@@ -1265,7 +1265,7 @@ bind_printf_variable (name, value, flags)
   SHELL_VAR *v;
 
 #if defined (ARRAY_VARS)
-  if (valid_array_reference (name) == 0)
+  if (valid_array_reference (name, 0) == 0)
     v = bind_variable (name, value, flags);
   else
     v = assign_array_element (name, value, flags);
index a878387c7ec3640b557f5096b4d27ed021e1c75b..7f8243a92327f4dfdac5a9bfc27a346caee0a61e 100644 (file)
@@ -335,7 +335,7 @@ read_builtin (list)
   /* Convenience: check early whether or not the first of possibly several
      variable names is a valid identifier, and bail early if so. */
 #if defined (ARRAY_VARS)
-  if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word) == 0)
+  if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, 0) == 0)
 #else
   if (list && legal_identifier (list->word->word) == 0)
 #endif
@@ -816,7 +816,7 @@ assign_vars:
     {
       varname = list->word->word;
 #if defined (ARRAY_VARS)
-      if (legal_identifier (varname) == 0 && valid_array_reference (varname) == 0)
+      if (legal_identifier (varname) == 0 && valid_array_reference (varname, 0) == 0)
 #else
       if (legal_identifier (varname) == 0)
 #endif
@@ -864,7 +864,7 @@ assign_vars:
 
   /* Now assign the rest of the line to the last variable argument. */
 #if defined (ARRAY_VARS)
-  if (legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word) == 0)
+  if (legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, 0) == 0)
 #else
   if (legal_identifier (list->word->word) == 0)
 #endif
@@ -927,7 +927,7 @@ bind_read_variable (name, value)
   SHELL_VAR *v;
 
 #if defined (ARRAY_VARS)
-  if (valid_array_reference (name) == 0)
+  if (valid_array_reference (name, 0) == 0)
     v = bind_variable (name, value, 0);
   else
     v = assign_array_element (name, value, 0);
index c2934f5415ff4e9048417c5bdce9f21f066b6ed2..87632a72057934b2be1d9124d109aba3b07318a8 100644 (file)
@@ -835,7 +835,7 @@ unset_builtin (list)
 
 #if defined (ARRAY_VARS)
       unset_array = 0;
-      if (!unset_function && valid_array_reference (name))
+      if (!unset_function && valid_array_reference (name, 0))
        {
          t = strchr (name, '[');
          *t++ = '\0';
index f5c105eedac5f5d7734b2476e9c0fa873be3d70c..39ae07f9ae94a90afe767c7b1b5adabf8378bde3 100644 (file)
@@ -52,7 +52,7 @@ int
 mkdir_builtin (list)
      WORD_LIST *list;
 {
-  int opt, pflag, omode, rval, octal, nmode, parent_mode, um;
+  int opt, pflag, omode, rval, nmode, parent_mode;
   char *mode;
   WORD_LIST *l;
 
@@ -90,7 +90,6 @@ mkdir_builtin (list)
          builtin_error ("invalid file mode: %s", mode);
          return (EXECUTION_FAILURE);
        }
-      octal = 1;
     }
   else if (mode)
     {
@@ -101,7 +100,6 @@ mkdir_builtin (list)
          builtin_error ("invalid file mode: %s", mode);
          return (EXECUTION_FAILURE);
        }
-      octal = 0;
     }
 
   /* Make the new mode */
diff --git a/jobs.c b/jobs.c
index c33ace25f2c3a06108d74f9d6d4deec4cfc2cd44..5db74ee94bcf3898ef4a69c66f42d4c0e0bdef22 100644 (file)
--- a/jobs.c
+++ b/jobs.c
@@ -435,10 +435,14 @@ void
 save_pipeline (clear)
      int clear;
 {
+  sigset_t set, oset;
+
+  BLOCK_CHILD (set, oset);
   saved_pipeline = the_pipeline;
   if (clear)
     the_pipeline = (PROCESS *)NULL;
   saved_already_making_children = already_making_children;
+  UNBLOCK_CHILD (oset);
 }
 
 void
@@ -446,10 +450,14 @@ restore_pipeline (discard)
      int discard;
 {
   PROCESS *old_pipeline;
+  sigset_t set, oset;
 
+  BLOCK_CHILD (set, oset);
   old_pipeline = the_pipeline;
   the_pipeline = saved_pipeline;
   already_making_children = saved_already_making_children;
+  UNBLOCK_CHILD (oset);
+
   if (discard && old_pipeline)
     discard_pipeline (old_pipeline);
 }
index 02931a7cdf9701da6629d22be3adfa0c03c4bc72..3c0b7aaee08286880750142cd96bca965f704aef 100644 (file)
@@ -755,7 +755,7 @@ rl_redisplay ()
      contents of the command line? */
   while (lpos >= _rl_screenwidth)
     {
-      int z;
+      int z, p;
       /* fix from Darin Johnson <darin@acuson.com> for prompt string with
          invisible characters that is longer than the screen width.  The
          prompt_invis_chars_first_line variable could be made into an array
@@ -777,7 +777,15 @@ rl_redisplay ()
                  break;
                }
              else if (z == _rl_screenwidth)
-               break;
+               {
+                 /* If we are in the middle or at the end of a multibyte
+                    character, we want to move to the start, then find out
+                    where it ends so we know where to insert the newline.
+                    If this isn't a multibyte character, its the same as num++ */
+                 p = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
+                 num = _rl_find_next_mbchar (local_prompt, p, 1, MB_FIND_ANY);
+                 break;
+               }
              num++;
            }
           temp = num;
index 61f02f9f77603f5b01694b844087664f6f7f1d5f..e4f88f903da9432eb457ba7aeaa6921354b3cc91 100644 (file)
@@ -215,13 +215,23 @@ _rl_handle_signal (sig)
       rl_free_line_state ();
       /* FALLTHROUGH */
 
-    case SIGTERM:
-    case SIGHUP:
 #if defined (SIGTSTP)
     case SIGTSTP:
-    case SIGTTOU:
     case SIGTTIN:
+#  if defined (HAVE_POSIX_SIGNALS)
+      /* Block SIGTTOU so we can restore the terminal settings to something
+        sane without stopping on SIGTTOU if we have been placed into the
+        background.  Even trying to get the current terminal pgrp with
+        tcgetpgrp() will generate SIGTTOU, so we don't bother.  Don't bother
+        doing this if we've been stopped on SIGTTOU; it's aready too late. */
+      sigemptyset (&set);
+      sigaddset (&set, SIGTTOU);
+      sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL);
+#  endif
+    case SIGTTOU:
 #endif /* SIGTSTP */
+    case SIGTERM:
+    case SIGHUP:
 #if defined (SIGALRM)
     case SIGALRM:
 #endif
@@ -232,6 +242,10 @@ _rl_handle_signal (sig)
       rl_cleanup_after_signal ();
 
 #if defined (HAVE_POSIX_SIGNALS)
+      /* Unblock SIGTTOU blocked above */
+      if (sig == SIGTTIN || sig == SIGTSTP)
+       sigprocmask (SIG_UNBLOCK, &set, (sigset_t *)NULL);
+
       sigemptyset (&set);
       sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
       sigdelset (&set, sig);
index 40d09935b2c9d0a4ec4b9a8c94ac00b2ac47d6b4..e009b37672e6cdfa3bbc50a7758f8d6d9f78fdb0 100644 (file)
@@ -253,7 +253,7 @@ sh_backslash_quote (string, table, flags)
          continue;
        }
 #endif
-      if (backslash_table[c] == 1)
+      if (backslash_table[(unsigned char)c] == 1)
        *r++ = '\\';
       else if (c == '#' && s == string)                        /* comment char */
        *r++ = '\\';
diff --git a/parse.y b/parse.y
index c6797fc7d88c07fa6098b586b5a9f68cfc0d3af1..074d2639a002a9a54d23eed14bdb370237ae6aee 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -4934,7 +4934,7 @@ got_token:
       /* can use token; already copied to the_word */
       token[token_index-1] = '\0';
 #if defined (ARRAY_VARS)
-      if (legal_identifier (token+1) || valid_array_reference (token+1))
+      if (legal_identifier (token+1) || valid_array_reference (token+1, 0))
 #else
       if (legal_identifier (token+1))
 #endif
index d45ab30ecad900fd1655714703ae6cdeb1e7ee51..21fc148dba713c0bcd0a7f86671994e7cc485b82 100644 (file)
--- a/pathexp.c
+++ b/pathexp.c
@@ -184,6 +184,7 @@ quote_string_for_globbing (pathname, qflags)
   char *temp;
   register int i, j;
   int brack, cclass, collsym, equiv, c, last_was_backslash;
+  int savei, savej;
 
   temp = (char *)xmalloc (2 * strlen (pathname) + 1);
 
@@ -226,6 +227,8 @@ quote_string_for_globbing (pathname, qflags)
        {
          brack = 1;
          temp[j++] = pathname[i++];    /* open bracket */
+         savej = j;
+         savei = i;
          c = pathname[i++];    /* c == char after open bracket */
          do
            {
@@ -282,7 +285,19 @@ quote_string_for_globbing (pathname, qflags)
              else
                temp[j++] = c;
            }
-         while ((c = pathname[i++]) != ']');
+         while (((c = pathname[i++]) != ']') && c != 0);
+
+         /* If we don't find the closing bracket before we hit the end of
+            the string, rescan string without treating it as a bracket
+            expression (has implications for backslash and special ERE
+            chars) */
+         if (c == 0)
+           {
+             i = savei - 1;    /* -1 for autoincrement above */
+             j = savej;
+             continue;
+           }
+
          temp[j++] = c;        /* closing right bracket */
          i--;                  /* increment will happen above in loop */
          continue;             /* skip double assignment below */
diff --git a/redir.c b/redir.c
index 2765a55471c9fd73aa225a246a75343c5a742b43..e490bbb3cd529a8989fb35a45a12625751929679 100644 (file)
--- a/redir.c
+++ b/redir.c
@@ -1379,7 +1379,7 @@ redir_varvalue (redir)
   w = redir->redirector.filename->word;                /* shorthand */
   /* XXX - handle set -u here? */
 #if defined (ARRAY_VARS)
-  if (vr = valid_array_reference (w))
+  if (vr = valid_array_reference (w, 0))
     v = array_variable_part (w, &sub, &len);
   else
 #endif
diff --git a/subst.c b/subst.c
index 2ad7d8ff31b399333ee65700d1621c5846038844..1b12fd73319fa8ee4add584971f3076a7ca70c1e 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -6010,7 +6010,7 @@ valid_brace_expansion_word (name, var_is_special)
   else if (var_is_special)
     return 1;
 #if defined (ARRAY_VARS)
-  else if (valid_array_reference (name))
+  else if (valid_array_reference (name, 0))
     return 1;
 #endif /* ARRAY_VARS */
   else if (legal_identifier (name))
@@ -6054,7 +6054,7 @@ chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at)
 
   /* Now check for ${array[@]} and ${array[*]} */
 #if defined (ARRAY_VARS)
-  else if (valid_array_reference (name))
+  else if (valid_array_reference (name, 0))
     {
       temp1 = mbschr (name, '[');
       if (temp1 && temp1[1] == '@' && temp1[2] == ']')
@@ -6127,7 +6127,7 @@ parameter_brace_expand_word (name, var_is_special, quoted, pflags, indp)
       free (tt);
     }
 #if defined (ARRAY_VARS)
-  else if (valid_array_reference (name))
+  else if (valid_array_reference (name, 0))
     {
 expand_arrayref:
       /* XXX - does this leak if name[@] or name[*]? */
@@ -6188,7 +6188,7 @@ expand_arrayref:
       temp = nameref_cell (var);
 #if defined (ARRAY_VARS)
       /* Handle expanding nameref whose value is x[n] */
-      if (temp && *temp && valid_array_reference (temp))
+      if (temp && *temp && valid_array_reference (temp, 0))
        {
          name = temp;
          goto expand_arrayref;
@@ -6402,7 +6402,7 @@ parameter_brace_expand_rhs (name, value, c, quoted, qdollaratp, hasdollarat)
     }
     
 #if defined (ARRAY_VARS)
-  if (valid_array_reference (vname))
+  if (valid_array_reference (vname, 0))
     assign_array_element (vname, t1, 0);
   else
 #endif /* ARRAY_VARS */
@@ -6459,7 +6459,7 @@ valid_length_expression (name)
          ((sh_syntaxtab[(unsigned char) name[1]] & CSPECVAR) && name[2] == '\0') ||  /* special param */
          (DIGIT (name[1]) && all_digits (name + 1)) || /* ${#11} */
 #if defined (ARRAY_VARS)
-         valid_array_reference (name + 1) ||                   /* ${#a[7]} */
+         valid_array_reference (name + 1, 0) ||                /* ${#a[7]} */
 #endif
          legal_identifier (name + 1));                         /* ${#PS1} */
 }
@@ -6509,7 +6509,7 @@ parameter_brace_expand_length (name)
       FREE (t);
     }
 #if defined (ARRAY_VARS)
-  else if (valid_array_reference (name + 1))
+  else if (valid_array_reference (name + 1, 0))
     number = array_length_reference (name + 1);
 #endif /* ARRAY_VARS */
   else
@@ -6784,7 +6784,7 @@ get_var_and_type (varname, value, ind, quoted, flags, varp, valp)
   *varp = (SHELL_VAR *)NULL;
 
 #if defined (ARRAY_VARS)
-  if (valid_array_reference (vname))
+  if (valid_array_reference (vname, 0))
     {
       v = array_variable_part (vname, &temp, (int *)0);
       /* If we want to signal array_value to use an already-computed index,
@@ -7733,7 +7733,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
 #if defined (ARRAY_VARS)      
   /* Process ${!ARRAY[@]} and ${!ARRAY[*]} expansion. */ /* [ */
   if (want_indir && string[sindex - 1] == RBRACE &&
-      string[sindex - 2] == ']' && valid_array_reference (name+1))
+      string[sindex - 2] == ']' && valid_array_reference (name+1, 0))
     {
       char *x, *x1;
 
@@ -7802,7 +7802,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
     }
 
 #if defined (ARRAY_VARS)
-  if (valid_array_reference (name))
+  if (valid_array_reference (name, 0))
     chk_atstar (name, quoted, quoted_dollar_atp, contains_dollar_at);
 #endif
 
@@ -8470,7 +8470,7 @@ comsub:
        {
          temp = nameref_cell (var);
 #if defined (ARRAY_VARS)
-         if (temp && *temp && valid_array_reference (temp))
+         if (temp && *temp && valid_array_reference (temp, 0))
            {
              tdesc = parameter_brace_expand_word (temp, SPECIAL_VAR (temp, 0), quoted, pflags, (arrayind_t *)NULL);
              if (tdesc == &expand_wdesc_error || tdesc == &expand_wdesc_fatal)
diff --git a/test.c b/test.c
index 86e8b0a7bc5eb6e7c2c30fccad8f4095b7d8a524..95e10a0248065cd7d9857c8068d8326d24f6fd09 100644 (file)
--- a/test.c
+++ b/test.c
@@ -624,7 +624,7 @@ unary_test (op, arg)
     case 'v':
       v = find_variable (arg);
 #if defined (ARRAY_VARS)
-      if (v == 0 && valid_array_reference (arg))
+      if (v == 0 && valid_array_reference (arg, 0))
        {
          char *t;
          t = array_value (arg, 0, 0, (int *)0, (arrayind_t *)0);
diff --git a/trap.c b/trap.c
index a12bb9e2137af8e3a9c60304e6f5c1c45be3f1f5..a77186431f1f2181dc95efc5ea9468d3fe27977d 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -296,8 +296,9 @@ run_pending_traps ()
 #if defined (DEBUG)
       internal_warning ("run_pending_traps: recursive invocation while running trap for signal %d", running_trap-1);
 #endif
-#if 0
-      return;                  /* no recursive trap invocations */
+#if defined (SIGWINCH)
+      if (running_trap == SIGWINCH+1 && pending_traps[SIGWINCH])
+       return;                 /* no recursive SIGWINCH trap invocations */
 #else
       ;
 #endif
@@ -1160,6 +1161,7 @@ reset_or_restore_signal_handlers (reset)
        }
       else if (sigmodes[i] & SIG_SPECIAL)
        (*reset) (i);
+      pending_traps[i] = 0;    /* XXX */
     }
 
   /* Command substitution and other child processes don't inherit the
index cbe780637166f30e56bbb0b7d7ce700aaa0fbd29..c992410bb40b7e9f38d296b5101d0ba0ff560408 100644 (file)
@@ -2602,7 +2602,7 @@ bind_variable_internal (name, value, table, hflags, aflags)
       newval = nameref_cell (entry);
 #if defined (ARRAY_VARS)
       /* declare -n foo=x[2] */
-      if (valid_array_reference (newval))
+      if (valid_array_reference (newval, 0))
         /* XXX - should it be aflags? */
        entry = assign_array_element (newval, make_variable_value (entry, value, 0), aflags);
       else
@@ -2733,7 +2733,7 @@ bind_variable (name, value, flags)
                      if (nameref_cell (nv) == 0)
                        return (bind_variable_internal (nv->name, value, nvc->table, 0, flags));
 #if defined (ARRAY_VARS)
-                     else if (valid_array_reference (nameref_cell (nv)))
+                     else if (valid_array_reference (nameref_cell (nv), 0))
                        return (assign_array_element (nameref_cell (nv), value, flags));
                      else
 #endif
@@ -2800,7 +2800,7 @@ bind_variable_value (var, value, aflags)
     {
       t = make_variable_value (var, value, aflags);
 #if defined (ARRAY_VARS)
-      if ((aflags & ASS_NAMEREF) && (t == 0 || *t == 0 || (legal_identifier (t) == 0 && valid_array_reference (t) == 0)))
+      if ((aflags & ASS_NAMEREF) && (t == 0 || *t == 0 || (legal_identifier (t) == 0 && valid_array_reference (t, 0) == 0)))
 #else
       if ((aflags & ASS_NAMEREF) && (t == 0 || *t == 0 || legal_identifier (t) == 0))
 #endif
@@ -2844,7 +2844,7 @@ bind_int_variable (lhs, rhs)
 
   isint = isarr = implicitarray = 0;
 #if defined (ARRAY_VARS)
-  if (valid_array_reference (lhs))
+  if (valid_array_reference (lhs, 0))
     {
       isarr = 1;
       v = array_variable_part (lhs, (char **)0, (int *)0);