[PATCH] python tests: allow blackbox subcommands without a shell

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Thu Nov 1 03:34:48 UTC 2018


Often I have longed to start a python black-box test without using a
subshell, but BlackboxTestCase doesn't allow such things.

https://gitlab.com/samba-team/samba/merge_requests/96 (attached) fixes
that. As always, a test can go:

       out = self.check_output("samba_dnsupdate --verbose")

but now it can also go:

       out = self.check_output(["samba_dnsupdate", "--verbose"])

which will do the same thing without a shell. Why bother? In that case
it makes no difference (apart from perhaps saving milliseconds and/or
kilobytes), but when it comes to this:

      password = "3(nqx$|><' #!"
      creds = "-UAdministrator%" + password
      out = self.check_output(["samba-tool",
                               "drs",
                               "bind",
                               self.dc1,
                               creds])

you don't want to have to think about what the shell would make of that
password.

Douglas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 96.patch
Type: text/x-patch
Size: 4419 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181101/f5bc1bc6/96.bin>


More information about the samba-technical mailing list