Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Sep 2020 16:07:34 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Brooks Davis <brooks@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: Appropriate path for mount/fsck sub-programs?
Message-ID:  <3d9a63cf-62f6-02af-0755-2ddeacc38f96@FreeBSD.org>
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
On 9/16/20 1:42 PM, Brooks Davis wrote:
> The mount and fsck commands have the ability to exec a mount_<fs> or
> fsck_<fs> program to do the actual work.  Currently they do this with:
> 
> execvP(execname, _PATH_SYSPATH, argv);
> 
> Where _PATH_SYSPATH is "/sbin:/usr/sbin" unless RESCUE is defined in
> which case it's "/rescue:/sbin:/usr/sbin".  This isn't very friendly to
> filesystems in ports and results in things like sysutils/e2fsprogs
> adding a link to /sbin.  I think the path should be expanded to include
> /usr/local/sbin at a minimum.  If it wasn't for the /rescue hack I'd be
> tempted to suggest just switching to `execvp` and using PATH.
> I see a few options (semi-sorted by level of change):
> 
> 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.

Prefer 1a to 1b between those two.

> 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.

For all of these I think it likely means removing _PATH_SYSPATH?

1b) or 2) seem simplest (just modifying paths.h).  They are probably good
enough whereas 3 and 4 both requiring dealing with strings which is kind
of bleh.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3d9a63cf-62f6-02af-0755-2ddeacc38f96>