Bash-4.3-beta2 available for FTP

2013-10-06 Thread Chet Ramey
The second beta release of bash-4.3 is now available with the URL

ftp://ftp.cwru.edu/pub/bash/bash-4.3-beta2.tar.gz

This tar file does not include the formatted documentation (you
should be able to generate it yourself).

This release fixes many outstanding bugs in bash-4.2 and introduces several
new features.  The most significant bug fix is the reworking of signal
handling to avoid running signal and trap handlers in a signal handler
context.  This led to issues with glibc, which uses internal locks
extensively and handles longjmps from user code very poorly.

The most notable new features are the `globasciiranges' shell option, which
forces the pattern matching code to treat [a-z] as if in the C locale;
nameref variables and the changes to allow assigning, referencing, and
unsetting them; improvements to the `direxpand' option introduced in bash-4.2
patch 29; and allowing negative subscripts when assigning and referencing
indexed array elements.

There is one incompatible change between bash-4.2 and bash-4.3.  Bash now
performs quote removal on the replacement string in pattern substitution
(${param/pat/rep}), since the shell treats quotes as special.  If you
have to quote single quotes to get them to be treated literally, the shell
should perform quote removal on them.

`bashbug' may be used to report bugs with this version.  It will send
mail to c...@po.cwru.edu if the shell's `release status' is alpha or
beta.

As always, thanks for your help.

Chet

+== CHANGES ==+
This document details the changes between this version, bash-4.3-beta2, and the
previous version, bash-4.3-beta.

1.  Changes to Bash

a.  Fixed a bug that caused assignment to an unset variable using a negative
subscript to result in a segmentation fault.

b.  Fixed a bug that caused assignment to a string variable using a negative
subscript to use the incorrect index.

c.  Fixed a bug that caused some strings to be interpreted as invalid
extended globbing expressions when used with the help builtin.

d.  Fixed a bug that caused an attempt to trap a signal whose disposition
cannot be changed to reference uninitialized memory.

e.  Command completion now skips assignment statements preceding a command
name and completes the command.

f.  Fixed a bug that caused `compgen -f' in a non-interactive shell to dump
core under certain circumstances.

g.  Fixed a bug that caused the `read -N' to misbehave when the input stream
contains 0xff.

2.  Changes to Readline

a.  Changed message when an incremental search fails to include "failed" in
the prompt and display the entire search string instead of just the last
matching portion.

b.  Fixed a bug that caused an arrow key typed to an incremental search prompt
to process the key sequence incorrectly.

c.  Additional key bindings for arrow keys on MinGW.

3.  New Features in Bash

a.  The help builtin now attempts substring matching (as it did through
bash-4.2) if exact string matching fails.

b.  The fc builtin now interprets -0 as the current command line.

c.  Completing directory names containing shell variables now adds a trailing
slash if the expanded result is a directory.

4.  New Features in Readline

a.  rl_change_environment: new application-settable variable that controls
whether or not Readline modifies the environment (currently readline
modifies only LINES and COLUMNS).


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Command substitution and exiting from deeply nested subshells

2013-10-06 Thread Carlos Pita
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib
-D_FORTIFY_SOURCE=2 -march=i686 -mtune=generic -O2 -pipe
-fstack-protector --param=ssp-buffer-size=4
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux netbook 3.11.1-1-ARCH #1 SMP PREEMPT Sat Sep 14
20:31:35 CEST 2013 i686 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.2
Patch Level: 45
Release Status: release

Description:
  I'm not completely sure whether this is a bug or not but it seems
not possible to immediately exit a shell when an error happens at 2+
levels of subshell nesting.  Specifically, there is a command at the
top-level shell waiting for the results of a command substitution.
This second command in the first subshell is in turn waiting for the
results of another command substitution. This innermost command fails
but the awaiting commands still finish their execution as if the error
never happened. I've tested this with set -e, set -E, an ERR trap,
explicit exits at each subshell, but to no avail. Below is an example
to reproduce it.

Repeat-By:

trap 'exit 1' ERR

set -e -E

function xxx {
  echo xxx1
  exit 1
  echo xxx2
}

function yyy {
  echo $(xxx) yyy
}

yyy

# => xxx1 yyy
# I wouldn't expect the echo to print any output or execute at all.