Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] bash: /dev/fd/62: No such file or directory
@ 2018-03-15 22:55 Jörg Krause
  2018-03-16 14:19 ` Peter Korsgaard
  0 siblings, 1 reply; 14+ messages in thread
From: Jörg Krause @ 2018-03-15 22:55 UTC (permalink / raw)
  To: buildroot

Hi,

I am facing an issue with busybox init system, bash and mdev. When a
bash script uses process substitution, bash ends with an error:

   """
   # bash -c 'read x< <(echo 1); echo $x'
   bash: /dev/fd/62: No such file or directory
   """

The issue is addressed is some threads, e.g. [1]. The problem is that
/dev/fd does not exist when using mdev:

   """
   # ls -l /dev/fd
   ls: /dev/fd: No such file or directory
   """

As addressed here [2], the issue can be fixed by adding:

   """
   ln -snf /proc/self/fd /dev/fd
   """

... to /etc/inittab or /etc/init.d/S10mdev:

   """
   # ls -l /dev/fd
   lrwxrwxrwx    1 root     root            13 Mar 15 22:39 /dev/fd -> /proc/self/fd
   # ls -l /dev/fd/
   total 0
   lrwx------    1 root     root            64 Mar 15 22:40 0 -> /dev/pts/0
   lrwx------    1 root     root            64 Mar 15 22:40 1 -> /dev/pts/0
   lrwx------    1 root     root            64 Mar 15 22:40 2 -> /dev/pts/0
   ls: /dev/fd/3: cannot read link: No such file or directory
   lr-x------    1 root     root            64 Mar 15 22:40 3
   """

The process substitution works now as expected:

   """
   # bash -c 'read x< <(echo 1); echo $x'
   1
   """

I found some other threads which additionally add the following lines:

   """
   ln -snf /proc/self/fd/0 /dev/stdin
   ln -snf /proc/self/fd/1 /dev/stdout
   ln -snf /proc/self/fd/2 /dev/stderr
   """

... as /dev/std{in,out,err} do not exist when using mdev

My question is how to best fix this issue in Buildroot? Any
suggestions?

[1] http://gnu-bash.2382.n7.nabble.com/dev-fd-62-No-such-file-or-directory-td13233.html
[2] https://bugs.alpinelinux.org/issues/1465

Best regards
J?rg Krause

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-04-04 20:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-15 22:55 [Buildroot] bash: /dev/fd/62: No such file or directory Jörg Krause
2018-03-16 14:19 ` Peter Korsgaard
2018-03-21 15:25   ` Jörg Krause
2018-03-29 19:46   ` Jörg Krause
2018-03-30 11:11     ` Peter Korsgaard
2018-03-30 11:51       ` Jörg Krause
2018-03-30 12:41         ` Peter Korsgaard
2018-04-01  9:45       ` Jörg Krause
2018-04-01 10:27         ` Peter Korsgaard
2018-04-04 18:12       ` Jörg Krause
2018-04-04 18:58         ` Peter Korsgaard
2018-04-04 20:22           ` Jörg Krause
2018-04-04 20:23           ` Peter Korsgaard
2018-04-04 20:39             ` Jörg Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox