[PATCH] fix for bug 12292

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Wed Sep 28 22:11:39 UTC 2016


hi Rowland,

So there are two cases (for simplicity's sake):

A) The operation that is being requested boils down to a no-op (the
state you are seeking already exists). It looks to be operator error;
you mistyped the name.

In this case you want samba-tool to give you an informative message --
maybe without returning a failure code.

B) There is a corrupt database, a memory error, a bug in Samba.
samba-tool doesn't know where or why this happened.

Now you want samba-tool to provide the full stack trace so you can ask
on the mailing list or google for it. You also want a failing return
code so you can use it in shell scripts:

  samba-tool whatever && the-next-logical-step

Your patches address case A. You can safely try to delete what does
not exist without seeing tracebacks or getting a failing return code.
But they break case B. That is, if you try to delete a user that does
exist which causes some kind of obscure ldb error, you won't be told.
It'll lie to you and say "Unable to find user...".

The simple solution, in my opinion, is to raise a specific unambiguous
exception in the case where the user does not exist, and suppress the
traceback and error code only in that case. That was the effect of my
patch (or at least the intention, I tested nothing).

I am uncertain whether the cosmetic case A should really suppress the
return code, but I entirely agree that making the message nicer is
good. But that doesn't justify discarding the serious messages from
case B.

regards
Douglas



More information about the samba-technical mailing list