Re: gnu parallel in the bash manual

2013-02-18 Thread DJ Mills
On Sun, Feb 17, 2013 at 4:54 PM, Chet Ramey  wrote:

> On 2/16/13 9:57 AM, Chris Down wrote:
>
> > Count me also in favour of removal of this section. At best the entire
> > section needs a complete rewrite, but why on earth we have a whole
> section
> > dedicated to a nonstandard external tool is kind of baffling.
>
> Consider the FSF's perspective.  The fact that it's not standard is not
> as important as the fact that it's a GNU tool, and that GNU tools should
> be promoting other GNU software when possible.
>
>
At the very least, then, I agree that it should be rewritten. If examples
are going to be given, they should follow proper practices.

- DJ


moving fd affect outer scope

2013-02-18 Thread Stephane Chazelas
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='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib  
-D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security -Wall
uname output: Linux sc 3.7-trunk-amd64 #1 SMP Debian 3.7.3-1~experimental.1 
x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Moving a file descriptor for a builtin command or a compound
command leaves the fd closed afterwards:

$ bash -c ': <&1-; echo test'
bash: line 0: echo: write error: Bad file descriptor

expected output: "test".

ksh93 had a similar bug but it was fixed in 1994:

94-06-30  A bug which caused 2<&1- when applied to a shell built-in
  to leave standard input closed has been fixed.

(don't know if it's a typo above (s/input/output/), if not it
might be a different bug)

In any case, ksh93u+ doesn't exhibit the same behavior as bash:

$ ksh -c ': <&1-; echo test'
test

The longer (standard) form works OK:

$ bash -c ': <&1 1<&-; echo test'
test

-- 
Stephane