From: "Jörg Krause" <joerg.krause@embedded.rocks>
To: buildroot@busybox.net
Subject: [Buildroot] bash: /dev/fd/62: No such file or directory
Date: Thu, 15 Mar 2018 23:55:01 +0100 [thread overview]
Message-ID: <1521154501.16532.15.camel@embedded.rocks> (raw)
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
next reply other threads:[~2018-03-15 22:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-15 22:55 Jörg Krause [this message]
2018-03-16 14:19 ` [Buildroot] bash: /dev/fd/62: No such file or directory 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1521154501.16532.15.camel@embedded.rocks \
--to=joerg.krause@embedded.rocks \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox