On 31/10/2022 12:35, Michael Tokarev via samba wrote:> For fun, just found an interesting tidbbit with wbinfo cmdline parsing.. > > # wbinfo --help | grep uid-to > ? -U, --uid-to-sid=UID?????????????????????????????? Converts uid to sid > > but: > > $ wbinfo --uid-to-sid=mjtThe invalid option is 'mjt', it isn't a number, you are possibly mistaking it for the rfc2307 attribute 'uid' which is a name. The 'uid' in this instance is the users Unix ID e.g. rowland at devstation:~$ wbinfo -U 11104 S-1-5-21-627072207-2265849604-124128874-1104> Invalid option > Usage: [OPTION...] > ? -u, --domain-users???????????????????????????????? Lists all domain > users > ... > > Here, there are 2 issues: first, it does not recognize -U/--uid-to-sid > option at all (which is listed in its help output and is documented > in the manpage). > > It is interesting how this ever happened. It seems to be consistent > in 4.13, 4.16 and 4.17 releases.It as been like that since 4.0.0 at least.> > And second, and this very annoying issue is quite common - it prints > out whole --help output in case of option error. It should only print > help/usage when --help is requested, - in case of actual error, this > makes it difficult to find.? And it definitely should clarify which > option is invalid, - it is easy to see if there's only one option, > but if the command line is long, finding the wrong one becomes a > real challenge...If you wish to change it, I would expect that patches would be readily acceptable ;-) Rowland> > /mjt >
31.10.2022 15:58, Rowland Penny via samba wrote:> > On 31/10/2022 12:35, Michael Tokarev via samba wrote: >> For fun, just found an interesting tidbbit with wbinfo cmdline parsing.. >> >> # wbinfo --help | grep uid-to >> ?? -U, --uid-to-sid=UID?????????????????????????????? Converts uid to sid >> >> but: >> >> $ wbinfo --uid-to-sid=mjt > > The invalid option is 'mjt', it isn't a number, you are possibly mistaking it for the rfc2307 attribute 'uid' which is a name. The 'uid' in this > instance is the users Unix ID e.g. > > rowland at devstation:~$ wbinfo -U 11104 > S-1-5-21-627072207-2265849604-124128874-1104Oh! :) Well, it is even more important in this case to give clean error message instead of dumping whole --help test on another unsuspecting user like me ;))>> Invalid option >> Usage: [OPTION...]Because I can't even think - after being in this industry for 30+ years - that "invalid option" means invalid *value* for an option. DOH!.. :)) ..> If you wish to change it, I would expect that patches would be readily acceptable ;-)Yeah. Dunno. It should be easy to fix. Thanks, /mjt
31.10.2022 15:58, Rowland Penny via samba wrote: ...> If you wish to change it, I would expect that patches would be readily acceptable ;-)Hm. This whole thing is done by popt - both printing whole --help output in case of error, and printing the less-than-understandable 'Invalid option' if it can't convert argument to an integer for POPT_ARG_INT. So it is either we switch from popt to something saner or fix popt itself.. :( *sigh* /mjt