bash-source closes file descriptor before reading from it on Darwin

2013-09-18 Thread Andrew de Andrade
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: darwin12.4.0
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='darwin12.4.0' -DCONF_MACHTYPE='i386-apple-darwin12.4.0'
-DCONF_VENDOR='apple'
-DLOCALEDIR='/usr/local/Cellar/bash/4.2.45/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib
-I./lib/intl -I/private/tmp/bash-NnFr/bash-4.2/lib/intl  -g -O2
uname output: Darwin Andrews-MacBook-Air.local 12.4.0 Darwin Kernel Version
12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64
x86_64
Machine Type: i386-apple-darwin12.4.0

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

Description:
When using source with process substitution, where the command
 writes to stdout, source closes the file descriptor created by
the process substitution before reading from it.

AFAIK this only occurs on Darwin. This impacts bash-completion
used by npm and node-tabtab.
 https://github.com/isaacs/npm/blob/master/lib/completion.js#L163

Repeat-By:
Create a script or executable that writes another script to
stdout. Execute that command like so...
 source <(my_command)
... then check if the script written to stdout was actually
sourced.


Re: bash-source closes file descriptor before reading from it on Darwin

2013-09-18 Thread Chet Ramey
On 9/17/13 8:47 PM, Andrew de Andrade wrote:

> Bash Version: 4.2
> Patch Level: 45
> Release Status: release
> 
> Description:
> When using source with process substitution, where the command
>  writes to stdout, source closes the file descriptor created by
> the process substitution before reading from it.
> 
> AFAIK this only occurs on Darwin. This impacts bash-completion
> used by npm and node-tabtab.
>  https://github.com/isaacs/npm/blob/master/lib/completion.js#L163
> 
> Repeat-By:
> Create a script or executable that writes another script to
> stdout. Execute that command like so...
>  source <(my_command)
> ... then check if the script written to stdout was actually
> sourced.

Can you give me something that will allow me to reproduce the problem
more easily?  I can't reproduce it with something like this:

foo()
{
echo "bar()"$'\n'"{ echo in bar;"$'\n'"}"
echo echo one
echo echo two
echo echo three
echo echo inside
echo type bar
echo bar
}

source <(foo)
echo outside
type bar
echo $?

Does it take a script of a certain size to trigger the problem?  If the
problem is as you describe it should not work anywhere.

I happen to be using exactly the same release of MacOS X and kernel version
you are.

Chet

-- 
``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/



[install bash] how to use patch files

2013-09-18 Thread zxycscj
I have downlaod bash-4.2.tar.gz and all the patches for it.
how to use the patch files to install?

http://ftp.gnu.org/gnu/bash/
bash-4.2.tar.gz

http://ftp.gnu.org/gnu/bash/bash-4.2-patches/
bash42-001.sig
bash42-001.txt
bash42-002.sig
bash42-002.txt
bash42-003.sig
bash42-003.txt
bash42-004.sig
bash42-004.txt
bash42-005.sig
bash42-005.txt
bash42-006.sig
bash42-006.txt
bash42-007.sig
bash42-007.txt
bash42-008.sig
bash42-008.txt
bash42-009.sig
bash42-009.txt
bash42-010.sig
bash42-010.txt


2013-09-18



zxycscj

Re: [install bash] how to use patch files

2013-09-18 Thread Greg Wooledge
On Wed, Sep 18, 2013 at 11:54:13PM +0800, zxycscj wrote:
> I have downlaod bash-4.2.tar.gz and all the patches for it.
> how to use the patch files to install?
> 
> http://ftp.gnu.org/gnu/bash/
> bash-4.2.tar.gz
> 
> http://ftp.gnu.org/gnu/bash/bash-4.2-patches/
> bash42-001.sig
> bash42-001.txt
...

gzip -dc bash-4.2.tar.gz | tar xf -
cd bash-4.2
for f in ../bash42-*.txt; do
  patch -p0 < "$f"
done