Appropriate path for mount/fsck sub-programs?

John Baldwin jhb at FreeBSD.org
Wed Sep 16 23:08:08 UTC 2020


On 9/16/20 4:07 PM, John Baldwin wrote:
> 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.

Sorry, 1a) or 2).

-- 
John Baldwin


More information about the freebsd-arch mailing list