fails to write to coproc with "bad fd" from a compound command or subshell
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gnu Bash |
New
|
Undecided
|
|||
bash (Debian) |
New
|
Unknown
|
|||
bash (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When redirecting to the fd connected to a coproc, bash fails with "bad file descriptor" message.
The code is like this -- https:/
coproc ssh "$@" -e none "ls -l $DEST && cat >> $DEST"
DESTsize=
SRCsize="$(ls -l "$SRC" | readSizeUnixls)"
( tail -c +$((DESTsize+1)) "$SRC" | pv --wait --size $((SRCsize-
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: bash 4.2-2ubuntu2
Uname: Linux 3.0.27-1-ac100 armv7l
ApportVersion: 2.0.1-0ubuntu12
Architecture: armhf
Date: Sat Sep 1 03:40:04 2012
SourcePackage: bash
UpgradeStatus: No upgrade log present (probably fresh install)
Changed in bash (Debian): | |
status: | Unknown → New |
I suppose that's the same problem as explained in http:// stackoverflow. com/a/12189425/ 94687 and http:// lists.gnu. org/archive/ html/bug- bash/2012- 06/msg00027. html :
"Coproc file descriptors are not available to subshells. They're implemented using pipes, and leaving pipe file descriptors open in subshells causes processes to hang and not terminate properly, which results in very hard-to- track-down- and-reproduce bugs."
Although my redirection is outside of () (or {}), the file descriptor used must be available in the forked subshell, but it not might be the way bash treats fds.