Remove (some) bashisms from the test scripts

Christof Schmitt cs at samba.org
Tue Dec 26 20:21:15 UTC 2017


On Mon, Dec 25, 2017 at 06:55:51AM +0200, Uri Simchoni wrote:
> On 12/25/2017 05:07 AM, Christof Schmitt wrote:
> > On Sat, Dec 23, 2017 at 09:38:06PM +0200, Uri Simchoni via samba-technical wrote:
> > 
> >> Other than that:
> >> Just to make things clear - the Samba test suite policy has always been
> >> not to assume that /bin/sh is bash. On the build server, /bin/sh is
> >> dash. It appears the "bashisms" you pointed out never execute during
> >> selftest (which means we don't have tests for adding/removing/modifying
> >> shares via RPC...).
> > 
> > We do have tests for share management through RPC calls, see
> > the test in source3/script/tests/test_rpcclientsrvsvc.sh. If there are
> > bashisms, then it looks like they are no problem with Debian's dash, but
> > mainly with FreeBSD.
> > 
> > Christof
> > 
> 
> Ok, missed that one. Sorry. But dash doesn't support '[['. When I run
> that (unfixed) test using dash, the server log shows:
> 
> 
> smbd version 4.8.0pre1-DEVELOPERBUILD started.
> Copyright Andrew Tridgell and the Samba Team 1992-2017
> Test dummy executed!
> daemon_ready: STATUS=daemon 'smbd' finished starting up and ready to
> serve connections
> /home/uri/s2/bin/smbchangeshare: 23: /home/uri/s2/bin/smbchangeshare:
> [[: not found
> /home/uri/s2/bin/smbchangeshare: 30: /home/uri/s2/bin/smbchangeshare:
> [[: not found
> /home/uri/s2/bin/smbchangeshare: 37: /home/uri/s2/bin/smbchangeshare:
> [[: not found
> /home/uri/s2/bin/smbchangeshare: 44: /home/uri/s2/bin/smbchangeshare:
> [[: not found
> delete_share_security: Failed to delete entry for share srvsvctest:
> NT_STATUS_NOT_FOUND
> 
> ... and the test as a whole passes.

Yes, i did also some testing and saw the same. It looks like the effect
of the wrong operator in dash is that the error message "[[: not found"
is issued and the check is ignored. As a result, the overall test
succeeds, but it would fail to detect any errors from commands called
form the smb*share scripts.

We should simply fix them. +1 from me for the patch to use the correct [
operator.

Christof



More information about the samba-technical mailing list