svn commit: r365643 - head/bin/cp

Mateusz Piotrowski 0mp at FreeBSD.org
Wed Sep 23 18:56:20 UTC 2020


On 9/23/20 7:23 PM, Warner Losh wrote:
> On Wed, Sep 23, 2020, 10:56 AM Rodney W. Grimes <freebsd at gndrsh.dnsmgr.net>
> wrote:
>
>>> cp is already fixed, people are still feeling the fallout of being
>>> within those revisions and needing to bootstrap their own cp. We can
>>> reduce the number of components these invocations rely on trivially to
>>> shell built-in mechanics, why not do so?
>> I would even go further, I would like to see the dependency on
>> /dev/null removed from the build, and the boot process.
>>
> A worthy goal, but one I'm afraid is out of our reach. A quick grep shows
> just over 200 instances of /dev/null in the Makefile and mk file (800 if
> you don't filter Makefile.in and Makefile.am). Maybe a third of those are
> due to tests and other false positives. It would be quite the effort to
> eliminate them all. And /dev/tty and /dev/zero likely will be troublesome
> too, as they are used by running programs.
>
> and how would you throw away output you know is bad / bogus without
> /dev/null?


I wonder if we could do it (at least in some cases)
by closing descriptors with 1<&- and/or 2<&-.


>  From the build because it means I would no longer have to
>> mount /dev in my chroots, and from the boot because I
>> hate to say it, but we often scribble in /dev before
>> devfs is mounted and if you look at root file systems
>> mounted on other systems you well often find a /dev/null
>> FILE that got created during the boot process from a >/dev/null
>> before devfs was mounted.
>>
> But for this issue, we're not mounting devfs early enough.  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... 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.


More information about the svn-src-head mailing list