From owner-svn-src-all@freebsd.org Wed Dec 2 19:14:30 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 96AF04A4179; Wed, 2 Dec 2020 19:14:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmTDQ3qCRz3hb1; Wed, 2 Dec 2020 19:14:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 7074E27122; Wed, 2 Dec 2020 19:14:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f175.google.com with SMTP id i199so2339300qke.5; Wed, 02 Dec 2020 11:14:30 -0800 (PST) X-Gm-Message-State: AOAM5338Y0XdjlwCeic1p262qQsTE4rCfgGQHv0JNU5lS1C40UbkIvs2 9J0rXho1n+bL9bZq1qEy2ICkvYvjoqmMzZQ2BRk= X-Google-Smtp-Source: ABdhPJyxnfPV+aRPWfjrOlMAN1XlMF7PRy8G6GnpYkZl66FXe/NEK0YpIokCes0O0HqwEmstnSQyhZkEiQrSuyAODtI= X-Received: by 2002:a05:620a:12ea:: with SMTP id f10mr4254343qkl.430.1606936469530; Wed, 02 Dec 2020 11:14:29 -0800 (PST) MIME-Version: 1.0 References: <202011302105.0AUL5VHd035423@repo.freebsd.org> <20201202180159.GC69850@FreeBSD.org> <20201202191243.GF69850@FreeBSD.org> In-Reply-To: <20201202191243.GF69850@FreeBSD.org> From: Kyle Evans Date: Wed, 2 Dec 2020 13:14:16 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368197 - head/sbin/bectl To: Gleb Smirnoff Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" 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:14:30 -0000 On Wed, Dec 2, 2020 at 1:12 PM Gleb Smirnoff wrote: > > 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); > } > Yup, looks good to me! Thanks! :-)