2

The following test script:

#!/bin/bash
f() { :; }

while :; do
    coproc f par1
    wait $COPROC_PID
done

floods the console with:

./debug.sh: line 7: warning: execute_coproc: coproc [8740:COPROC] still exists
./debug.sh: line 7: warning: execute_coproc: coproc [8741:COPROC] still exists

That is, wait doesn't wait for the coprocess to terminate.
Bash version is 4.2.0(5)-release. This does not happen with 4.1.5(1)-release.

Do you think it is a bug?

Mat
  • 202,337
  • 40
  • 393
  • 406
davide
  • 2,082
  • 3
  • 21
  • 30
  • 1
    Um, where do you set the `COPROC_PID` variable? – atzz Sep 28 '12 at 10:10
  • `COPROC_PID` should be automatically set at `coproc` invocation. – davide Sep 28 '12 at 10:12
  • 1
    Live an learn, I guess. I didn't know about this feature. – atzz Sep 28 '12 at 10:18
  • BTW, cannot reproduce with bash 4.2.24(1)-release. – atzz Sep 28 '12 at 10:27
  • 2
    I submitted a bug report to bug-bash here: http://lists.gnu.org/archive/html/bug-bash/2012-09/msg00069.html – davide Sep 28 '12 at 10:39
  • 1
    I could also reproduce it in bash 4.2.10(1)-release (i686-pc-linux-gnu). Then I found the reply to your bug report [here](https://groups.google.com/d/msg/gnu.bash.bug/9Y99-BiSxxA/oH2CzMGyF5sJ)so it finally was a bug (and also, if you put a sleep in f(), it seems to work ok, coincident with the race condition mentioned in the bug response) – German Garcia Oct 18 '12 at 20:57
  • Not reproducable with bash-4.2.53-1.fc20.x86_64, if I run it with `bash -x a.sh` I can see `wait XXX` where XXX increases by 1 each time. – Doncho Gunchev Dec 15 '14 at 04:49

1 Answers1

-1

This isn't a bug. You named your coproc "f" so it would be under $f_PID.

Rob
  • 26,989
  • 16
  • 82
  • 98
ageis
  • 27
  • 2
  • 1
    downvoted because completely wrong: [RTFM](https://www.gnu.org/software/bash/manual/html_node/Coprocesses.html) "NAME must not be supplied if command is a simple command" .. "is interpreted as the first word of the simple command" `coproc x y` => NAME=`COPROC`, `coproc { x y; }` => NAME=`COPROC`, `coproc x { y; }` => NAME=`x` – Tino Apr 14 '18 at 09:47