Date: Wed, 2 Dec 2020 13:14:16 -0600 From: Kyle Evans <kevans@freebsd.org> To: Gleb Smirnoff <glebius@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org> Subject: Re: svn commit: r368197 - head/sbin/bectl Message-ID: <CACNAnaE1_4%2BcV82u5jAGSCmknkUAAnXwWRpKgHO-L0SyLERJgw@mail.gmail.com> In-Reply-To: <20201202191243.GF69850@FreeBSD.org> References: <202011302105.0AUL5VHd035423@repo.freebsd.org> <CACNAnaEMtsNRgHPM1pRm9RJzf3ex9w8qNHjLg8gjm%2B8nJ2F0zg@mail.gmail.com> <20201202180159.GC69850@FreeBSD.org> <CACNAnaHXZTBJ_xLDNOA2c=ef1HsfyxJ9SmOcfvSs04-9dvZqXQ@mail.gmail.com> <20201202191243.GF69850@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 2, 2020 at 1:12 PM Gleb Smirnoff <glebius@freebsd.org> 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! :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaE1_4%2BcV82u5jAGSCmknkUAAnXwWRpKgHO-L0SyLERJgw>