[Bug 1044466] Re: fails to write to coproc with "bad fd" from a compound command or subshell

Ivan Zakharyaschev 1044466 at bugs.launchpad.net
Fri Aug 31 17:02:42 UTC 2012


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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1044466

Title:
  fails to write to coproc with "bad fd" from a compound command or
  subshell

Status in The GNU Bash Shell:
  New
Status in “bash” package in Ubuntu:
  New
Status in “bash” package in Debian:
  Unknown

Bug description:
  When redirecting to the fd connected to a coproc, bash fails with "bad
  file descriptor" message.

  The code is like this -- https://gitorious.org/rpush-cat/rpush-
  cat/blobs/continue-coproc/rpush-continue#line34 (mirror:
  http://repo.or.cz/w/rpush-cat.git/blob/refs/heads/continue-coproc
  :/rpush-continue#l34 ):

  coproc ssh "$@" -e none "ls -l $DEST && cat >> $DEST"

  DESTsize="$(readSizeAndroidls <&${COPROC[0]}- )" || exit $?
  SRCsize="$(ls -l "$SRC" | readSizeUnixls)"
  ( tail -c +$((DESTsize+1)) "$SRC" | pv --wait --size $((SRCsize-DESTsize)); ) >&${COPROC[1]}-

  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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/gnubash/+bug/1044466/+subscriptions




More information about the foundations-bugs mailing list