Remove (some) bashisms from the test scripts

Martin Schwenke martin at meltin.net
Thu Jan 4 04:22:53 UTC 2018


On Wed, 3 Jan 2018 23:45:55 +0200, Uri Simchoni via samba-technical
<samba-technical at lists.samba.org> wrote:

> On 01/02/2018 06:24 PM, Björn JACKE wrote:
> > On 2017-12-27 at 07:36 +0200 Uri Simchoni via samba-technical sent off:  
>  [...]  
> >>
> >> Nothing is wrong IMHO but it requires two reviewers. Please bear with us :)  
> > 
> > +1 from me
> >   
> 
> I tried pushing this and it consistently fails on
> samba4.blackbox.dbcheck.release-4-0-0.
> 
> I suspect that the following patch is causing a test that previously
> never ran to run, and fail:
> 
> --- a/testprogs/blackbox/dbcheck-oldrelease.sh
> +++ b/testprogs/blackbox/dbcheck-oldrelease.sh
> @@ -366,19 +366,19 @@ check_expected_after_deleted_objects() {
>  }
> 
>  referenceprovision() {
> -    if [ x$RELEASE == x"release-4-0-0" ]; then
> +    if [ x$RELEASE = x"release-4-0-0" ]; then
>          $PYTHON $BINDIR/samba-tool domain provision --server-role="dc"
> [...]

I'm struggling to understand why we have code that uses the

  [ x$FOO = xbar ]

idiom.

My understanding is that this used to protect against the expansion of
$FOO starting with a '-' and tricking the test command into doing the
wrong thing.  Are there still any shells around that have this problem?

If not, surely when this code is touched it should be updated to use

  [ "$FOO" = "bar" ]

so that the code says what is meant?  :-)

peace & happiness,
martin



More information about the samba-technical mailing list