svn commit: r368197 - head/sbin/bectl

Gleb Smirnoff glebius at freebsd.org
Wed Dec 2 18:02:07 UTC 2020


  Kyle,

On Mon, Nov 30, 2020 at 08:28:58PM -0600, Kyle Evans wrote:
K> > Log:
K> >   Print at least something when failing.
K> >
K> > Modified:
K> >   head/sbin/bectl/bectl.c
K> >
K> > Modified: head/sbin/bectl/bectl.c
K> > ==============================================================================
K> > --- head/sbin/bectl/bectl.c     Mon Nov 30 20:58:42 2020        (r368196)
K> > +++ head/sbin/bectl/bectl.c     Mon Nov 30 21:05:31 2020        (r368197)
K> > @@ -584,8 +584,11 @@ main(int argc, char *argv[])
K> >                 return (usage(false));
K> >         }
K> >
K> > -       if ((be = libbe_init(root)) == NULL)
K> > +       if ((be = libbe_init(root)) == NULL) {
K> > +               fprintf(stderr, "libbe_init(\"%s\") failed.\n",
K> > +                   root != NULL ? root : "");
K> >                 return (-1);
K> > +       }
K> >
K> >         libbe_print_on_error(be, !cmd->silent);
K> >
K> 
K> This should be gated on !cmd->silent, because some paths have
K> consumers that are specifically designed to not have to deal with
K> redirecting stderr. It was quite intentional that this didn't
K> previously print anything.

AFAIK, the only command that has cmd->silent is "check".

I can't agree that it should suppress stderr in case of libbe_init()
failure. Failure of the library is something different to failed
check of current system. It is permanent failure, meaning that command
is being with incorrect root argument or ZFS is missing at all. Pretty
much the same as using bectl with incorrect arguments or options.

-- 
Gleb Smirnoff


More information about the svn-src-all mailing list