[PATCHES] Some fixes in s4/scripting/upgradeprovision

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Wed Oct 10 20:36:30 UTC 2018

For no good reason I have been looking at source4/scripting/samba_upgradeprovision,
fixing a few simple errors like misspelt or unused variables.

I ran aground on this cluster:

        if att == "forceLogoff":
            ref == old and ref == abs(new)
            return True

'oldval' and 'newval' are unused.
'old' and 'new' are non-numeric, so will never equal 'ref' (1 << 63).
'abs(new)' would raise an exception, but is never evaluated because
'ref == old' short-circuits though otherwise does nothing.

Perhaps at the end of that series of horrific no-ops, the only thing
to return is True, but I sort of wonder if this might be intended:

-            ref == old and ref == abs(new)
-            return True
+            return ref == oldval and ref == abs(newval)

If we just remove the four lines we lose an exception if the values
don't parse as int.

Any ideas? (other than wishes for -Wall level static analysis for Python?)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: upgradeprovision.patch
Type: text/x-patch
Size: 5501 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181011/61aea5cd/upgradeprovision.bin>

More information about the samba-technical mailing list