Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-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 -g -O2 uname output: Linux sc 2.6.17.11 #1 PREEMPT Sun Sep 24 13:29:05 BST 2006 i686 GNU/Linux Machine Type: i486-pc-linux-gnu
Bash Version: 3.1 Patch Level: 17 Release Status: release Description: $ echo echo echo | bash -c '. /dev/fd/0' $ echo echo echo | zsh -c '. /dev/fd/0' echo $ echo echo echo | ksh -c '. /dev/fd/0' echo $ echo echo echo | ash -c '. /dev/fd/0' echo $ echo echo echo | posh -c '. /dev/fd/0' echo Same problem if you do a ". fifo". $ echo echo echo | strace bash -c '. /dev/fd/0' [...] stat64("/dev/fd/0", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 open("/dev/fd/0", O_RDONLY|O_LARGEFILE) = 5 fstat64(5, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 read(5, "", 0) = 0 [...] The problem being that bash does a stat on the file, and reads st_size bytes from the file only, instead of reading til eof. Repeat-By: echo echo echo | bash -c '. /dev/fd/0' Fix: Not use stat(2). I think the file should be read the same way as standard input is read. Like echo 'echo echo echo >> a' > a . ./a should output "echo". (It does with ash, pdksh and zsh, not with AT&T ksh). SUSv3 is not specific on that case. -- Stephane _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash