Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2020 05:47:24 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Appropriate path for mount/fsck sub-programs?
Message-ID:  <28795.1600321644@critter.freebsd.dk>
In-Reply-To: <20200916204214.GA87473@spindle.one-eyed-alien.net>
References:  <20200916204214.GA87473@spindle.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--------
Brooks Davis writes:

> 0) Do nothing
> 1a) Add /usr/local/sbin to _PATH_SYSPATH (it's only used in mount and
>    fsck).
> 1b) The same, but a new variable.
> 2) Switch to _PATH_DEFPATH (that also add .../bin directories).
> 3) Use PATH, optionally prepending /rescue
> 4) Use exevp and teach crunched_main.c to prepend /rescue to PATH.

Why are we even bothering with _PATH_SYSPATH in the first place ?

    A) Being able to find the subprograms  ?

or

    B) Not running random binaries ?

I'd call B a bogus strawman:  If we do not trust root's PATH, we
should not trust /bin/sh to find the right fsck(8) in the first
place.

So if the concern only to find the subprograms, we should use ${PATH},
but since fsck is a Very Important Program for bringing systems up,
we should have a user-friendly fall-back.

So my proposal 5):

	Use ${PATH}, on failure search through a list of
	Well-Known-Directories, and ask the user for confirmation:

		fsck -t foofs /dev/da0
		fsck error: fsck_foofs not found in $PATH.
		Use /rescue/fsck_foofs Y/N ?

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28795.1600321644>