All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Add /dev/std{in, out, err} symlinks to inittabs
@ 2018-04-04 18:09 Jörg Krause
  2018-04-04 18:09 ` [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab Jörg Krause
  2018-04-04 18:09 ` [Buildroot] [PATCH 2/2] sysvinit: " Jörg Krause
  0 siblings, 2 replies; 7+ messages in thread
From: Jörg Krause @ 2018-04-04 18:09 UTC (permalink / raw)
  To: buildroot

Some applications, e.g. bashs process subsitution feature, rely on the
convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
but not by mdev, resulting in the following error when using the following
expression:
   
```
bash: /dev/fd/62: No such file or directory
```
    
For the sake of simplicity, lets fix this by creating the symlinks in busybox'
and sysvinits inittab file. It is only really needed if eudev isn't used, but
it doesn't really hurt to create them even if eudev will recreate them
afterwards.

Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
not available on all platforms, e.g. ARM, and the feature is not much
appreciated [2].

[1] https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
[2] https://lwn.net/Articles/45315/

J?rg Krause (2):
  busybox: add /dev/std{in,out,err} symlinks to inittab
  sysvinit: add /dev/std{in,out,err} symlinks to inittab

 package/busybox/inittab  | 4 ++++
 package/sysvinit/inittab | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

-- 
2.16.3

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

* [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab
  2018-04-04 18:09 [Buildroot] [PATCH 0/2] Add /dev/std{in, out, err} symlinks to inittabs Jörg Krause
@ 2018-04-04 18:09 ` Jörg Krause
  2018-05-01 19:52   ` Peter Korsgaard
  2018-04-04 18:09 ` [Buildroot] [PATCH 2/2] sysvinit: " Jörg Krause
  1 sibling, 1 reply; 7+ messages in thread
From: Jörg Krause @ 2018-04-04 18:09 UTC (permalink / raw)
  To: buildroot

Some applications, e.g. bashs process subsitution feature, rely on the
convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
but not by mdev, resulting in the following error when using the following
expression:

```
bash: /dev/fd/62: No such file or directory
```

For the sake of simplicity, lets fix this by creating the symlinks in inittab.
It is only really needed if eudev isn't used, but it doesn't really hurt to
create them even if eudev will recreate them afterwards.

Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
not available on all platforms, e.g. ARM, and the feature is not much
appreciated [2].

[1] https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
[2] https://lwn.net/Articles/45315/

Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
---
 package/busybox/inittab | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/busybox/inittab b/package/busybox/inittab
index 3f49f6bd7a..0f6b8cbe37 100644
--- a/package/busybox/inittab
+++ b/package/busybox/inittab
@@ -19,6 +19,10 @@
 ::sysinit:/bin/mkdir -p /dev/pts
 ::sysinit:/bin/mkdir -p /dev/shm
 ::sysinit:/bin/mount -a
+::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
+::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
+::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
+::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
 ::sysinit:/bin/hostname -F /etc/hostname
 # now run any rc scripts
 ::sysinit:/etc/init.d/rcS
-- 
2.16.3

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

* [Buildroot] [PATCH 2/2] sysvinit: add /dev/std{in, out, err} symlinks to inittab
  2018-04-04 18:09 [Buildroot] [PATCH 0/2] Add /dev/std{in, out, err} symlinks to inittabs Jörg Krause
  2018-04-04 18:09 ` [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab Jörg Krause
@ 2018-04-04 18:09 ` Jörg Krause
  2018-05-01 19:53   ` Peter Korsgaard
  1 sibling, 1 reply; 7+ messages in thread
From: Jörg Krause @ 2018-04-04 18:09 UTC (permalink / raw)
  To: buildroot

Some applications, e.g. bashs process subsitution feature, rely on the
convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
but not by mdev, resulting in the following error when using the following
expression:

```
bash: /dev/fd/62: No such file or directory
```

For the sake of simplicity, lets fix this by creating the symlinks in inittab.
It is only really needed if eudev isn't used, but it doesn't really hurt to
create them even if eudev will recreate them afterwards.

Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
not available on all platforms, e.g. ARM, and the feature is not much
appreciated [2].

[1] https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
[2] https://lwn.net/Articles/45315/

Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
---
 package/sysvinit/inittab | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/sysvinit/inittab b/package/sysvinit/inittab
index fad91eae8b..608aabce07 100644
--- a/package/sysvinit/inittab
+++ b/package/sysvinit/inittab
@@ -9,7 +9,11 @@ si1::sysinit:/bin/mount -o remount,rw /
 si2::sysinit:/bin/mkdir -p /dev/pts
 si3::sysinit:/bin/mkdir -p /dev/shm
 si4::sysinit:/bin/mount -a
-si5::sysinit:/bin/hostname -F /etc/hostname
+si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
+si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
+si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
+si8::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
+si9::sysinit:/bin/hostname -F /etc/hostname
 rcS:12345:wait:/etc/init.d/rcS
 
 # S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
-- 
2.16.3

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

* [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab
  2018-04-04 18:09 ` [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab Jörg Krause
@ 2018-05-01 19:52   ` Peter Korsgaard
  2018-06-17 15:58     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2018-05-01 19:52 UTC (permalink / raw)
  To: buildroot

>>>>> "J?rg" == J?rg Krause <joerg.krause@embedded.rocks> writes:

 > Some applications, e.g. bashs process subsitution feature, rely on the
 > convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

 > This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
 > but not by mdev, resulting in the following error when using the following
 > expression:

 > ```
 > bash: /dev/fd/62: No such file or directory
 > ```

 > For the sake of simplicity, lets fix this by creating the symlinks in inittab.
 > It is only really needed if eudev isn't used, but it doesn't really hurt to
 > create them even if eudev will recreate them afterwards.

 > Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
 > not available on all platforms, e.g. ARM, and the feature is not much
 > appreciated [2].

 > [1]
 > https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
 > [2] https://lwn.net/Articles/45315/

 > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
 > ---
 >  package/busybox/inittab | 4 ++++
 >  1 file changed, 4 insertions(+)

 > diff --git a/package/busybox/inittab b/package/busybox/inittab
 > index 3f49f6bd7a..0f6b8cbe37 100644
 > --- a/package/busybox/inittab
 > +++ b/package/busybox/inittab
 > @@ -19,6 +19,10 @@
 >  ::sysinit:/bin/mkdir -p /dev/pts
 >  ::sysinit:/bin/mkdir -p /dev/shm
 >  ::sysinit:/bin/mount -a
 > +::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
 > +::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
 > +::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
 > +::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr

This will fail on static /dev on a readonly rootfs, so I've redirected
errors to /dev/null.

Committed with that changed, thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 2/2] sysvinit: add /dev/std{in, out, err} symlinks to inittab
  2018-04-04 18:09 ` [Buildroot] [PATCH 2/2] sysvinit: " Jörg Krause
@ 2018-05-01 19:53   ` Peter Korsgaard
  2018-06-17 15:58     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2018-05-01 19:53 UTC (permalink / raw)
  To: buildroot

>>>>> "J?rg" == J?rg Krause <joerg.krause@embedded.rocks> writes:

 > Some applications, e.g. bashs process subsitution feature, rely on the
 > convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

 > This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
 > but not by mdev, resulting in the following error when using the following
 > expression:

 > ```
 > bash: /dev/fd/62: No such file or directory
 > ```

 > For the sake of simplicity, lets fix this by creating the symlinks in inittab.
 > It is only really needed if eudev isn't used, but it doesn't really hurt to
 > create them even if eudev will recreate them afterwards.

 > Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
 > not available on all platforms, e.g. ARM, and the feature is not much
 > appreciated [2].

 > [1]
 > https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
 > [2] https://lwn.net/Articles/45315/

 > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
 > ---
 >  package/sysvinit/inittab | 6 +++++-
 >  1 file changed, 5 insertions(+), 1 deletion(-)

 > diff --git a/package/sysvinit/inittab b/package/sysvinit/inittab
 > index fad91eae8b..608aabce07 100644
 > --- a/package/sysvinit/inittab
 > +++ b/package/sysvinit/inittab
 > @@ -9,7 +9,11 @@ si1::sysinit:/bin/mount -o remount,rw /
 >  si2::sysinit:/bin/mkdir -p /dev/pts
 >  si3::sysinit:/bin/mkdir -p /dev/shm
 >  si4::sysinit:/bin/mount -a
 > -si5::sysinit:/bin/hostname -F /etc/hostname
 > +si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
 > +si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
 > +si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
 > +si8::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr

This will fail on static /dev on a readonly rootfs, so I've redirected
errors to /dev/null.

Committed with that changed, thanks.

I have also added a patch adding these symlinks in the default skeleton
to handle static /dev on readonly rootfs setups.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab
  2018-05-01 19:52   ` Peter Korsgaard
@ 2018-06-17 15:58     ` Peter Korsgaard
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2018-06-17 15:58 UTC (permalink / raw)
  To: buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

>>>>> "J?rg" == J?rg Krause <joerg.krause@embedded.rocks> writes:
 >> Some applications, e.g. bashs process subsitution feature, rely on the
 >> convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

 >> This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
 >> but not by mdev, resulting in the following error when using the following
 >> expression:

 >> ```
 >> bash: /dev/fd/62: No such file or directory
 >> ```

 >> For the sake of simplicity, lets fix this by creating the symlinks in inittab.
 >> It is only really needed if eudev isn't used, but it doesn't really hurt to
 >> create them even if eudev will recreate them afterwards.

 >> Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
 >> not available on all platforms, e.g. ARM, and the feature is not much
 >> appreciated [2].

 >> [1]
 >> https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
 >> [2] https://lwn.net/Articles/45315/

 >> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
 >> ---
 >> package/busybox/inittab | 4 ++++
 >> 1 file changed, 4 insertions(+)

 >> diff --git a/package/busybox/inittab b/package/busybox/inittab
 >> index 3f49f6bd7a..0f6b8cbe37 100644
 >> --- a/package/busybox/inittab
 >> +++ b/package/busybox/inittab
 >> @@ -19,6 +19,10 @@
 >> ::sysinit:/bin/mkdir -p /dev/pts
 >> ::sysinit:/bin/mkdir -p /dev/shm
 >> ::sysinit:/bin/mount -a
 >> +::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
 >> +::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
 >> +::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
 >> +::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr

 > This will fail on static /dev on a readonly rootfs, so I've redirected
 > errors to /dev/null.

 > Committed with that changed, thanks.

Committed to 2018.02.x, thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 2/2] sysvinit: add /dev/std{in, out, err} symlinks to inittab
  2018-05-01 19:53   ` Peter Korsgaard
@ 2018-06-17 15:58     ` Peter Korsgaard
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2018-06-17 15:58 UTC (permalink / raw)
  To: buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

>>>>> "J?rg" == J?rg Krause <joerg.krause@embedded.rocks> writes:
 >> Some applications, e.g. bashs process subsitution feature, rely on the
 >> convention of `/dev/fd` being a symbolic link to `/proc/self/fd`.

 >> This symbolic link and his companions `/dev/std*` are created by (e)udev [1],
 >> but not by mdev, resulting in the following error when using the following
 >> expression:

 >> ```
 >> bash: /dev/fd/62: No such file or directory
 >> ```

 >> For the sake of simplicity, lets fix this by creating the symlinks in inittab.
 >> It is only really needed if eudev isn't used, but it doesn't really hurt to
 >> create them even if eudev will recreate them afterwards.

 >> Note, that we do not create the symlink `/dev/core` as `/proc/kcore` is
 >> not available on all platforms, e.g. ARM, and the feature is not much
 >> appreciated [2].

 >> [1]
 >> https://github.com/gentoo/eudev/blob/8943501993322c59a6eb5be456b0d716aafff21e/src/shared/dev-setup.c#L35-L40
 >> [2] https://lwn.net/Articles/45315/

 >> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
 >> ---
 >> package/sysvinit/inittab | 6 +++++-
 >> 1 file changed, 5 insertions(+), 1 deletion(-)

 >> diff --git a/package/sysvinit/inittab b/package/sysvinit/inittab
 >> index fad91eae8b..608aabce07 100644
 >> --- a/package/sysvinit/inittab
 >> +++ b/package/sysvinit/inittab
 >> @@ -9,7 +9,11 @@ si1::sysinit:/bin/mount -o remount,rw /
 >> si2::sysinit:/bin/mkdir -p /dev/pts
 >> si3::sysinit:/bin/mkdir -p /dev/shm
 >> si4::sysinit:/bin/mount -a
 >> -si5::sysinit:/bin/hostname -F /etc/hostname
 >> +si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
 >> +si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
 >> +si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
 >> +si8::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr

 > This will fail on static /dev on a readonly rootfs, so I've redirected
 > errors to /dev/null.

 > Committed with that changed, thanks.

 > I have also added a patch adding these symlinks in the default skeleton
 > to handle static /dev on readonly rootfs setups.

Committed to 2018.02.x, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2018-06-17 15:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 18:09 [Buildroot] [PATCH 0/2] Add /dev/std{in, out, err} symlinks to inittabs Jörg Krause
2018-04-04 18:09 ` [Buildroot] [PATCH 1/2] busybox: add /dev/std{in, out, err} symlinks to inittab Jörg Krause
2018-05-01 19:52   ` Peter Korsgaard
2018-06-17 15:58     ` Peter Korsgaard
2018-04-04 18:09 ` [Buildroot] [PATCH 2/2] sysvinit: " Jörg Krause
2018-05-01 19:53   ` Peter Korsgaard
2018-06-17 15:58     ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.