From owner-svn-src-all@freebsd.org Thu Sep 24 12:19:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 291093F61C0; Thu, 24 Sep 2020 12:19:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BxvH70JBMz4N0s; Thu, 24 Sep 2020 12:19:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id D9E602FC76; Thu, 24 Sep 2020 12:19:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f51.google.com with SMTP id q10so1762975qvs.1; Thu, 24 Sep 2020 05:19:14 -0700 (PDT) X-Gm-Message-State: AOAM530YlVn0Pa1VU7LjAw7WBP9HOEwTF0zzftFifnZxHI3fByJ+gDtq MkBJ8/hgYx0RIDfDSbGYGHJEwmwiVEWWDJS2gPo= X-Google-Smtp-Source: ABdhPJwb8dsVUHS3KtII3nPBX4iXp4wHvwtn5k5Yhxc89OhNdL/pxrmgKdbELKPWSekGsB/zyvmQxufUoJ4kVXn6QlI= X-Received: by 2002:ad4:5146:: with SMTP id g6mr4938425qvq.22.1600949954414; Thu, 24 Sep 2020 05:19:14 -0700 (PDT) MIME-Version: 1.0 References: <202009231656.08NGujEs042900@gndrsh.dnsmgr.net> <545173d1-a6e1-333a-11c1-a791bbeadd76@freebsd.org> In-Reply-To: <545173d1-a6e1-333a-11c1-a791bbeadd76@freebsd.org> From: Kyle Evans Date: Thu, 24 Sep 2020 07:19:03 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r365643 - head/bin/cp To: Stefan Esser Cc: Warner Losh , "Rodney W. Grimes" , Alan Somers , Mateusz Guzik , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2020 12:19:15 -0000 On Thu, Sep 24, 2020 at 3:08 AM Stefan Esser wrote: > > Am 24.09.20 um 08:54 schrieb Warner Losh: > > > > > > On Thu, Sep 24, 2020 at 12:41 AM Stefan Esser > > wrote: > > > > Am 23.09.20 um 19:23 schrieb Warner Losh> 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. > > > > 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. > > > > > > So closing fd1 and fd2 doesn't cause them to be available for these > > programs to get as an fd on open, causing other issues? > > > > 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-- 1 imp imp 5 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. > > > > So those interactions should be disaled by rc variables... Or we should > > 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. > I was under the impression from previous reading and kib's response that this is a complete non-issue, there's no way you can go multi-user without a mounted /dev and we go to somewhat great lengths to make sure we're good. I agree with the previous goal of ripping the /dev dependency out of the build, but this is also much, much easier said than done.