Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2020 10:08:48 +0200
From:      Stefan Esser <se@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        "Rodney W. Grimes" <rgrimes@freebsd.org>, Kyle Evans <kevans@freebsd.org>, Alan Somers <asomers@freebsd.org>, Mateusz Guzik <mjguzik@gmail.com>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r365643 - head/bin/cp
Message-ID:  <545173d1-a6e1-333a-11c1-a791bbeadd76@freebsd.org>
In-Reply-To: <CANCZdfpHfRK6Hm8H6%2BUcSyo-jVaTYXjpF7M1NRNqoJmQ4w5xJA@mail.gmail.com>
References:  <CACNAnaH-L%2Bw=SJW1Cw1M63LQi19d%2Bf_8Sv%2BdYUTyE%2BjYQU6nbA@mail.gmail.com> <202009231656.08NGujEs042900@gndrsh.dnsmgr.net> <CANCZdfoDpG85jSYs36-oWpxwYymTnVJ2dpAXyk9%2B3Ps7enODmw@mail.gmail.com> <fc0903cf-fd1f-1c39-13f0-4902c5bc1cd9@freebsd.org> <CANCZdfpHfRK6Hm8H6%2BUcSyo-jVaTYXjpF7M1NRNqoJmQ4w5xJA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--BsZ2IiQxZPtrxLFJWLaISIeVd90EgEaBf
Content-Type: multipart/mixed; boundary="8gTPxExLgn8jrNl2Nh6PyVEjbC4ReCbTJ";
 protected-headers="v1"
From: Stefan Esser <se@freebsd.org>
To: Warner Losh <imp@bsdimp.com>
Cc: "Rodney W. Grimes" <rgrimes@freebsd.org>, Kyle Evans
 <kevans@freebsd.org>, Alan Somers <asomers@freebsd.org>,
 Mateusz Guzik <mjguzik@gmail.com>,
 src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>,
 svn-src-head <svn-src-head@freebsd.org>
Message-ID: <545173d1-a6e1-333a-11c1-a791bbeadd76@freebsd.org>
Subject: Re: svn commit: r365643 - head/bin/cp
References: <CACNAnaH-L+w=SJW1Cw1M63LQi19d+f_8Sv+dYUTyE+jYQU6nbA@mail.gmail.com>
 <202009231656.08NGujEs042900@gndrsh.dnsmgr.net>
 <CANCZdfoDpG85jSYs36-oWpxwYymTnVJ2dpAXyk9+3Ps7enODmw@mail.gmail.com>
 <fc0903cf-fd1f-1c39-13f0-4902c5bc1cd9@freebsd.org>
 <CANCZdfpHfRK6Hm8H6+UcSyo-jVaTYXjpF7M1NRNqoJmQ4w5xJA@mail.gmail.com>
In-Reply-To: <CANCZdfpHfRK6Hm8H6+UcSyo-jVaTYXjpF7M1NRNqoJmQ4w5xJA@mail.gmail.com>

--8gTPxExLgn8jrNl2Nh6PyVEjbC4ReCbTJ
Content-Type: multipart/mixed;
 boundary="------------F586FD52C2AD12104A5C5B53"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------F586FD52C2AD12104A5C5B53
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Am 24.09.20 um 08:54 schrieb Warner Losh:
>=20
>=20
> On Thu, Sep 24, 2020 at 12:41 AM Stefan Esser <se@freebsd.org=20
> <mailto:se@freebsd.org>> wrote:
>=20
>     Am 23.09.20 um 19:23 schrieb Warner Losh> But for this issue, we're=
 not
>     mounting devfs early enough.=C2=A0 We should
>      > fix that. Removing /dev/null from the boot process likely is
>     never going
>      > to happen because we use it all over the place to discard output=
=2E..
>      > There's ~200 instances of it in the boot rc scripts, so getting
>     rid of
>      > it there would also be quite the effort, with the same question.=

>=20
>     Removal of /dev/null from rc.d scripts should be quite simple,
>     since most cases could just use ">-" (close file descriptor)
>     instead. Other usage could be substituted with ":>" followed
>     by chown.
>=20
>=20
> So closing fd1 and fd2 doesn't cause them to be available for these=20
> programs to get as an fd on open, causing other issues?
>=20
> But >- isn't documented in sh(1) as doing the close thing. On a whim I =

> did the following:
> $ echo fred >-
> $ ls -last ./-
> 4 -rw-r--r-- =C2=A01 imp =C2=A0imp =C2=A05 Sep 24 00:50 ./-
> $ cat ./-
> fred
> $
> which suggests maybe you now have a lot of files named - instead...

Yes, sorry, please ignore what I wrote - I was thinking of ">&-" of
course, but that is not gracefully accepted by many commands (they
are aborted when trying to write to the closed file descriptor).

I had thought about piping into a command that ignores STDIN, first,
e.g. "| :", but that generates a SIGPIPE when trying to flush the
FILE buffer (i.e. after 4 KB, which might be sufficient for most
cases, but it is not a general solution).

A program that reads from STDIN and generates no output could be used,
though, e.g. "| sed d".

But this would cause lots of extra forked processes and increase the
start-up time and is not acceptable.

>     but e.g. rc.d/syscons
>     uses ${kbddev} (i.e. /dev/ttyv0) and rc.d/zvol performs swapon
>     on /dev/zvol/${name}, rc.d/random uses /dev/random and so on.
>=20
> So those interactions should be disaled by rc variables...=C2=A0 Or we =
should=20
> be failing the operation...

Going multi-user should not be stopped by any of the rc scripts
failing due to lack of /dev. But since most developers will only
test with /dev available, there is a risk that changes to rc files
will not gracefully handle a missing /dev.

>     But those further references to /dev nodes will in general be
>     NOPs if /dev is not available (some test for existence of the
>     node they rely on, other just fail trying to access them, but
>     without negative effect on going multi-user).
>=20
>=20
> Yea, that's more minor, but if /dev/ isn't there, they likely should=20
> fail, or shouldn't proceed... But in a way that allows the rest of the =

> rc scripts to continue...

Since the issue of no devfs mounted it not typical, tests will be
required to prevent regressions. If a failure in such a case stops
the multi-user start-up, then it will most likely be in situations
where there is no good way to provide diagnostics (e.g. no console
that works for user land programs, no known writable file system
locations, ...).

Regards, STefan

--------------F586FD52C2AD12104A5C5B53--

--8gTPxExLgn8jrNl2Nh6PyVEjbC4ReCbTJ--

--BsZ2IiQxZPtrxLFJWLaISIeVd90EgEaBf
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl9sVBAFAwAAAAAACgkQR+u171r99URn
KQgAnxgH0BuFlfh3iXOnuWhFGLpAk8fwQ6rU3sxp1hzgeFsUvoOuHtQKZlNIYuwP8Gox3Zuhok7R
bFDq2Qe7Dy1ZI9yvfnvi05DwBvHVeXL+kjcNkOF6eMuQ11UwVeswXFq5ioOfE3c9d0OclBbFhcex
Dwl2AQGuj6AnAaBP666XsDUst5to5T9vjUr9kPBnEmQv5ltb/vEcL2/7nvNQI+PZc2QDevH2ywto
rfnJoW0Tmg2d9+xTxGBCJt7LymtLvTj0VQyoT4nPVCLwQsRzdnzQc5j6Yf+DW7dt9FPQfO6IKkSE
NY/5LyUCvffPYPdkAcXcEXzJMefEcwRB1DPuPkLFCQ==
=emwY
-----END PGP SIGNATURE-----

--BsZ2IiQxZPtrxLFJWLaISIeVd90EgEaBf--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?545173d1-a6e1-333a-11c1-a791bbeadd76>