From owner-freebsd-arch@freebsd.org Thu Sep 17 05:47:29 2020 Return-Path: Delivered-To: freebsd-arch@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 CC0083FD60B for ; Thu, 17 Sep 2020 05:47:29 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BsQwH3DjTz4ldX; Thu, 17 Sep 2020 05:47:27 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id BF0F51AF1A5; Thu, 17 Sep 2020 05:47:24 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.16.1/8.16.1) with ESMTPS id 08H5lOJ0028797 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 17 Sep 2020 05:47:24 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.16.1/8.16.1/Submit) id 08H5lO4p028796; Thu, 17 Sep 2020 05:47:24 GMT (envelope-from phk) To: Brooks Davis cc: freebsd-arch@freebsd.org Subject: Re: Appropriate path for mount/fsck sub-programs? In-reply-to: <20200916204214.GA87473@spindle.one-eyed-alien.net> From: "Poul-Henning Kamp" References: <20200916204214.GA87473@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28794.1600321644.1@critter.freebsd.dk> Date: Thu, 17 Sep 2020 05:47:24 +0000 Message-ID: <28795.1600321644@critter.freebsd.dk> X-Rspamd-Queue-Id: 4BsQwH3DjTz4ldX X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk X-Spamd-Result: default: False [-1.01 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[phk]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.dk]; NEURAL_HAM_LONG(-1.01)[-1.010]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-0.84)[-0.840]; NEURAL_HAM_SHORT(-0.16)[-0.162]; RCPT_COUNT_TWO(0.00)[2]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; SUBJECT_ENDS_QUESTION(1.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; MAILMAN_DEST(0.00)[freebsd-arch] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 05:47:29 -0000 -------- 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.