Re: redirecting a file descriptor to an array variable? Possible? How? RFE?

2015-11-19 Thread konsolebox
On Thu, Nov 19, 2015 at 4:29 AM, Linda Walsh  wrote:
> However one cannot
> categorically say that a NUL byte can't be used as an argument.

Likely only in an escaped format, or just as a single byte or character.

> Solving
> other places where it doesn't work might make it so that it *would* work...

Most parts of bash interpret, store and handle parameters (internal
data; not shell arguments) as C-strings (null-terminated) (as an
example, see make_variable_value() in variables.c, or savestring() in
general.h).  It's the key to understanding why NUL bytes doesn't work
most of the time in bash.  If you would want it to interpret them as
strings like C++ strings or Ruby strings, it would need a big
overhaul.  You would also think about possible compliance issues,
compatibility issues, complexities and vulnerabilities.  It's great
but not easy.



OLDPWD unset when bash starts

2015-11-19 Thread John Wiersba
From: jrw32...@yahoo.com
To: bug-bash@gnu.org,b...@packages.debian.org
Subject: OLDPWD unset when bash starts

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='l$
uname output: Linux john-mint-mate-17 3.13.0-37-generic #64-Ubuntu SMP Mon Sep $
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 11
Release Status: release

Description:

Why does bash clear OLDPWD when a child script is started?

OLDPWD is exported and passed to any children, but bash apparently clears 
OLDPWD whenever a child script is started:  Can bash be fixed to preserve the 
value of any OLDPWD in its initial environment, like it does with PWD?


This appears to happen on all 3.x and 4.x versions of bash.
Repeat-By:

$ cd /etc
$ cd
$ perl -e 'print "<$ENV{OLDPWD}>\n"'

$ ksh -c 'echo "<$OLDPWD>"'

$ bash -c 'echo "<$OLDPWD>"'
<>