From nobody Wed Apr 06 03:41:13 2022 X-Original-To: dev-commits-src-all@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 D8A371A8FE42; Wed, 6 Apr 2022 03:41:14 +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 4KY9KQ3FMnz4qhw; Wed, 6 Apr 2022 03:41:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649216474; 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=s17NQ/iogUi5ssrLO+SpTtb/1fkRdcc5zUpKMBCzoqI=; b=fpor+BHSwUfspwWK/TNtPtgbBUo3s44cWgu4PFG5OQ/GVlRH2ZC7vNfGc0gj/CL9go3Jl3 8FkM8NjfWmv1pYP/5idfUslQj6uu71WXtEXSTtLX8UmMq1MAeexxijcokpSJoS7FPR3oED p//5CDsXVktuGgV96Zh+W02NwotWkKYulcsepPw+dkM+gXuxQcL4n/7baCwF8ATnYwMoNh TDAdvZiTCscaFfLPXaFoCScX44UWAA068Vhiz6b6NfhMmlIfnqN8qBbg/2yvysynKxycal FR2Vi0QDWK5PuSywGAa7ceJLN2t8RNqMtMZ3qsT829xURrn/hQXfvhVz1yl5/A== 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 137D313BBE; Wed, 6 Apr 2022 03:41:14 +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 2363fDTH088673; Wed, 6 Apr 2022 03:41:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2363fDhe088672; Wed, 6 Apr 2022 03:41:13 GMT (envelope-from git) Date: Wed, 6 Apr 2022 03:41:13 GMT Message-Id: <202204060341.2363fDhe088672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 0869fa0c0ab7 - stable/12 - bectl: push space-in-name check down into libbe List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 0869fa0c0ab7a684e09c414d9689abc202669ff6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649216474; 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=s17NQ/iogUi5ssrLO+SpTtb/1fkRdcc5zUpKMBCzoqI=; b=gEO1eAnW9IqVQ+fGaRbJ0JQo5vMKSrCKlTexh2Qioa9QOL+rrsdAhPyL4weTka9bG40aOW WzqqnNsr0wc1QzcPmO9i/pU65w0ZC4C9iZGoDh2k9T1BUh/4tdmQmLx8QR3m02W1XlCFtb V8cWI/GxmvT9+3sRCWwvUQcz5KCVULsW547OHVTgmLXI5JhBXAHKX7kA2uc/EiE9cg5iRS 2UKC9ssI0oPWVEW5rYryN/fgBjBvIjoibtMurm+YV3lnv78lZDQ0NMCEiVzu7D8RftfMly KPhiNtbyRvwx+ZPJoKUreA/Vnbi6eQtGvtcER8V11Wz6gjled4wmxZS0Mm8SLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649216474; a=rsa-sha256; cv=none; b=SC9ItxobtSX/UwxKK+QOOjIDRD/iBtgtmlxeldnfTeKcBL25J330OQ3Uvp3GD1/R0socMm HJZxRp5MdmOtein0YKyVz2Dhk57EEkINJv/Qd9RSDu8R2I4OyQ74QhRvA1QTb1IzOiQ999 jf3RJ8db0c7P0wjS9sCGVNYjgtcjB5rC1Rjl273Ah9Q7IhYTmWt1BrLNJSHohvjpnbY/Ju /VwdBGFkYfkeY2qnbV6RVXAH+8gfMXY8yyT2aW0fnWGSamv/sKpJOueNmhlWDxKIDPdXtL rUmuaxWMaSVljdD0rvQI2lnKNHfhncGeFFDUvMYEH7hJO7SKgXE+5ch6JknJoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0869fa0c0ab7a684e09c414d9689abc202669ff6 commit 0869fa0c0ab7a684e09c414d9689abc202669ff6 Author: Kyle Evans AuthorDate: 2022-04-03 02:04:31 +0000 Commit: Kyle Evans CommitDate: 2022-04-06 03:40: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 (cherry picked from commit dadb9c70938c4ae2c260f6af65752c67ac752284) --- 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 98304c8bd166..6c7bf1b2ae45 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -957,6 +957,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 0c8b9c313488..1b31c337a3f2 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -133,7 +133,6 @@ get_cmd_info(const char *cmd) return (NULL); } - static int bectl_cmd_activate(int argc, char *argv[]) { @@ -217,10 +216,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. @@ -462,7 +458,6 @@ bectl_cmd_rename(int argc, char *argv[]) dest = argv[2]; err = be_rename(be, src, dest); - switch (err) { case BE_ERR_SUCCESS: break; @@ -471,7 +466,7 @@ bectl_cmd_rename(int argc, char *argv[]) src, dest); } - return (0); + return (err); } static int