[haiku-bugs] [Haiku] #16907: Process substitution in Bash fails

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 11 Apr 2021 14:20:09 -0000

#16907: Process substitution in Bash fails
-----------------------+-----------------------------
 Reporter:  aligator   |       Owner:  nobody
     Type:  bug        |      Status:  new
 Priority:  normal     |   Milestone:  Unscheduled
Component:  - General  |     Version:  R1/Development
 Keywords:             |  Blocked By:
 Blocking:             |    Platform:  All
-----------------------+-----------------------------
 Hi
 The problem is related to this issue
 [https://github.com/romkatv/gitstatus/issues/229].
 Basically it happens that the bash process substitution
 [https://www.linuxjournal.com/content/shell-process-redirection] doesn't
 work relyable in Haiku using bash or zsh.

 I am not sure in which component exactly this issue belongs to.
 I am running Haiku Revision hrev55023.

 Initially I noticed the problem in zsh and it can reproduced there with
 {{{
 zsh -fc 'zmodload zsh/system && sysopen -r -o cloexec -u fd <(true)'
 }}}
 Which fails to read the file the substitution creates.
 {{{
 can't open /tmp/zshpRfl6c: no such file or directory
 }}}

 Now this problem also appears to happen when using bash using a simpler
 variant:
 {{{
 ~/projects/dev> bash --norc -c 'exec < <(true)'
 bash: cannot open named pipe /tmp//sh-np.qGCOgA for writing: No such file
 or directory
 }}}

 But interestingly
 {{{
 zsh -fc 'exec < <(true)'
 }}}
 works just fine.

 But now the strangest thing about it is that
 {{{
 bash --norc -c 'exec < <(true)'
 }}}
 works sometimes, too. When I spam the command it happens to work in rare
 cases.
 This leads to my assumption that the "file" created by <(true) does not
 last long enough for the exec to read it in all cases.
 Also because the short zsh variant works mostly, I assume that it just
 executes it faster. But when running the initial command with sysopen it's
 too slow and the file is already closed when it tries to read it.

 Also this
 {{{
 ~/projects/dev> bash --norc -c 'cat <(echo hello)'
 hello
 }}}
 seems to work just fine.

 As additional information it seems that a similar issue exists for other
 shell implementations, too:
 https://github.com/ish-app/ish/issues/164
 Here ish has a similar problem and WSL1 had it also.

 Thats all I found out so far.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/16907>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: