From nobody Sun Apr 03 02:04:45 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A0C561A45185; Sun, 3 Apr 2022 02:04:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KWHKT3fCfz4lry; Sun, 3 Apr 2022 02:04:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648951485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zkFnfipbBp6k7u3wC4m5dC0le8rc7aIAq8IOyFnLXWo=; b=OeDYvXg9lyKYxR1ogHwFcwecC93AfXO63AD0xAhIIBcEfdmW27DnqQqECDYHQQ+RwCvQgO GHYEgpLNZZ1XZ087l8eX34evQIP3WfjlvquSUdLZUGz9b5LqvqY/IKhMKFuzsP6UC9Mt16 51n9tpNtnKSpB5HM+gOdPVNZlyYv5fz/xurenihC6lj79mgArztkbHkBnsFPXviZN9NQAl ZAy7VdKgM36zpCPagAeiwusF6jESbNhFcDXDbL+r4oYWmd2ssQNyGrgqlRoiJUp8cSGQet stX5suHpla0P2kobZiHqnnNkX+ico7iDKxQNJKbMENpMh71O3k4YH2a2uJvOZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5999014BAA; Sun, 3 Apr 2022 02:04:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23324jwp019004; Sun, 3 Apr 2022 02:04:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23324jNQ019003; Sun, 3 Apr 2022 02:04:45 GMT (envelope-from git) Date: Sun, 3 Apr 2022 02:04:45 GMT Message-Id: <202204030204.23324jNQ019003@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: dadb9c70938c - main - bectl: push space-in-name check down into libbe List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dadb9c70938c4ae2c260f6af65752c67ac752284 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648951485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zkFnfipbBp6k7u3wC4m5dC0le8rc7aIAq8IOyFnLXWo=; b=sRVohJMHt01jKezfq3j9gxCIRMade2/Kvlm0zKa4vEqKqIjjYg8sbyoCnltAxQlLict2su v+ddGy6YHJqGAw5fP31S/j4Ikey1u0x8F8nUAzVhoi5YdB1ZuYNP07gueNYKeeABR3bWM+ o/lVWCY5c5x8rTC7aIHPMs89dc5SHFOlvPJUK0f5Lr+LTsMUQNXizR8gMN7Amg4ljI+kwZ DF9fM0dYIq23TyvsqvWRbtMbKmaO1zMKsJiEbMdjDQte3X/Psefxw+3bxKTzaXFjFQvXqT pAK0CLkrOovohFj/rtULzDwY2yTRTuhCgQB1b8lUVsk0253QZemPfy4njTqdMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648951485; a=rsa-sha256; cv=none; b=Stus/vMbxZErEDNISYN7NOT+c/LQV/5qBFl2JQpEKj9YPIboHUC5/HpboGkH0xHGSx8q4u 2q99EAXhpD8tntCznOZ7w/l8SN2sA3vbrh8KSYADyX7CZWakFwSY3a/DgMkC+hfVvZuH25 MfBRBS5xw8VKFOqDnfczLHXeKmZzKm0mIpzcU/ISPrWDPQ/kk4zG6B4c8oRc39gCq9nYlN PLq7NY7U/kTlHLrmDBVoqKczqVbkgpdFiWdWaJwer1ENQIkD39Jj3FI0zP5LY3nvfVg+AA +167yIpiw6loGDXfRhz7F+RPGwpQMAd2Zkq9Jds9HjO756pdcXkOXY/4WTqpwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=dadb9c70938c4ae2c260f6af65752c67ac752284 commit dadb9c70938c4ae2c260f6af65752c67ac752284 Author: Kyle Evans AuthorDate: 2022-04-03 02:04:31 +0000 Commit: Kyle Evans CommitDate: 2022-04-03 02:04:31 +0000 bectl: push space-in-name check down into libbe This check was previously in `create` only, not applying to renames. It should really be applied at the libbe level, so that we can avoid writing about this restriction over and over again. While we're here: `bectl rename` always succeeds, even when it doesn't. Start returning the error. Reported By: Christian McDonald Reviewed by: rew, jwmaag_gmail.com (earlier version) Differential Revision: https://reviews.freebsd.org/D34605 --- lib/libbe/be.c | 11 +++++++++++ sbin/bectl/bectl.c | 9 ++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index d6fe027f5df3..13f7a59d5215 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -961,6 +961,17 @@ be_validate_name(libbe_handle_t *lbh, const char *name) if (!zfs_name_valid(name, ZFS_TYPE_DATASET)) return (BE_ERR_INVALIDNAME); + /* + * ZFS allows spaces in boot environment names, but the kernel can't + * handle booting from such a dataset right now. vfs.root.mountfrom + * is defined to be a space-separated list, and there's no protocol for + * escaping whitespace in the path component of a dev:path spec. So + * while loader can handle this situation alright, it can't safely pass + * it on to mountroot. + */ + if (strchr(name, ' ') != NULL) + return (BE_ERR_INVALIDNAME); + return (BE_ERR_SUCCESS); } diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c index d3de58ea2982..2b7af4e55419 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -134,7 +134,6 @@ get_cmd_info(const char *cmd) return (NULL); } - static int bectl_cmd_activate(int argc, char *argv[]) { @@ -233,10 +232,7 @@ bectl_cmd_create(int argc, char *argv[]) bootenv = *argv; err = BE_ERR_SUCCESS; - if (strchr(bootenv, ' ') != NULL) - /* BE datasets with spaces are not bootable */ - err = BE_ERR_INVALIDNAME; - else if ((atpos = strchr(bootenv, '@')) != NULL) { + if ((atpos = strchr(bootenv, '@')) != NULL) { /* * This is the "create a snapshot variant". No new boot * environment is to be created here. @@ -478,7 +474,6 @@ bectl_cmd_rename(int argc, char *argv[]) dest = argv[2]; err = be_rename(be, src, dest); - switch (err) { case BE_ERR_SUCCESS: break; @@ -487,7 +482,7 @@ bectl_cmd_rename(int argc, char *argv[]) src, dest); } - return (0); + return (err); } static int