[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Process-substitution FDs closed prematurely
From: |
Zev Weiss |
Subject: |
Process-substitution FDs closed prematurely |
Date: |
Tue, 6 Nov 2012 06:09:10 -0600 |
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-unknow
uname output: Linux hatter.bewilderbeest.net 3.4.4-2-ARCH #1 SMP PREEMPT Sun
Jun 24 18:59:47 CEST 2012 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.2
Patch Level: 39
Release Status: release
Description:
It seems that when bash passes (the expanded form of) a
process substitution to a function and that function then uses
the argument in a pipeline, the file descriptor for the
substituted pipe gets closed prematurely. This does not occur
with bash-4.1.11 on FreeBSD, but does with 4.2.39 on Linux (I
attempted to compile 4.1.11 from source on Linux to test it,
but the build failed).
Repeat-By:
Shell transcript demonstrating it:
[zev@hatter: tmp]% cat test.sh
#!/bin/bash
fn() { cat | cat "$1"; }
fn <(:) < /dev/null
[zev@hatter: tmp]% bash ./test.sh
cat: /dev/fd/63: No such file or directory
[zev@hatter: tmp]% echo $?
1
Expected behavior is no output and an exit status of zero.
- Process-substitution FDs closed prematurely,
Zev Weiss <=