From owner-svn-src-all@freebsd.org Wed Dec 2 19:12:46 2020 Return-Path: Delivered-To: svn-src-all@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 CE8F74A42BE; Wed, 2 Dec 2020 19:12:46 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (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 (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmTBQ3Vk1z3hXk; Wed, 2 Dec 2020 19:12:45 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 0B2JChNa082225 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 2 Dec 2020 11:12:43 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 0B2JChlI082224; Wed, 2 Dec 2020 11:12:43 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 2 Dec 2020 11:12:43 -0800 From: Gleb Smirnoff To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r368197 - head/sbin/bectl Message-ID: <20201202191243.GF69850@FreeBSD.org> References: <202011302105.0AUL5VHd035423@repo.freebsd.org> <20201202180159.GC69850@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CmTBQ3Vk1z3hXk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 19:12:46 -0000 Kyle, On Wed, Dec 02, 2020 at 12:08:43PM -0600, Kyle Evans wrote: K> > K> This should be gated on !cmd->silent, because some paths have K> > K> consumers that are specifically designed to not have to deal with K> > K> redirecting stderr. It was quite intentional that this didn't K> > K> previously print anything. K> > K> > AFAIK, the only command that has cmd->silent is "check". K> > K> > I can't agree that it should suppress stderr in case of libbe_init() K> > failure. Failure of the library is something different to failed K> > check of current system. It is permanent failure, meaning that command K> > is being with incorrect root argument or ZFS is missing at all. Pretty K> > much the same as using bectl with incorrect arguments or options. K> > K> K> The sole purpose of `bectl check` is to weed out if bectl will work K> (i.e. if libbe_init succeeds) so that scripts like freebsd-update can K> determine if they're running on a system or with a root (`bectl -r`) K> that can work with boot environments. It is not meant to give K> diagnostics like that upon failure, its sole purpose is to know if K> your script should proceed with doing bectl-y things safely or if it K> will just be fraught with peril. Understood. Sorry for my mistake. Is this patch a correct one? Index: bectl.c =================================================================== --- bectl.c (revision 368197) +++ bectl.c (working copy) @@ -585,8 +585,9 @@ main(int argc, char *argv[]) } if ((be = libbe_init(root)) == NULL) { - fprintf(stderr, "libbe_init(\"%s\") failed.\n", - root != NULL ? root : ""); + if (!cmd->silent) + fprintf(stderr, "libbe_init(\"%s\") failed.\n", + root != NULL ? root : ""); return (-1); } -- Gleb Smirnoff