[CRIU] [PATCH 2/2] fix error in tests when /bin/sh is not bash

Tycho Andersen tycho.andersen at canonical.com
Thu Mar 19 10:19:48 PDT 2015


On Thu, Mar 19, 2015 at 01:06:02PM -0400, Christopher Covington wrote:
> On 03/19/2015 12:56 PM, Tycho Andersen wrote:
> > Hi Chris,
> > 
> > On Thu, Mar 19, 2015 at 12:40:26PM -0400, Christopher Covington wrote:
> >> Hi Tycho,
> >>
> >> On 03/19/2015 10:50 AM, Tycho Andersen wrote:
> >>> == is a bashism, we should use = for /bin/sh; this prevents output like:
> >>
> >> It might be helpful to be more explicit about which non-Bash shell can't
> >> handle "==". Busybox for example is fine with it.
> > 
> > Ubuntu's default /bin/sh (dash) can't:
> > 
> > /tmp$ ls -al /bin/sh 
> > lrwxrwxrwx 1 root root 4 Feb 19  2014 /bin/sh -> dash*
> > /tmp$ cat tester.sh 
> > #!/bin/sh
> > [ "foo" == "bar" ]
> > /tmp$ ./tester.sh 
> > ./tester.sh: 3: [: foo: unexpected operator
> 
> It's not a big deal but perhaps the mention of dash could be folded into the
> commit message when committing. For what it's worth,
> 
> Reviewed-by: Christopher Covington <cov at codeaurora.org>

Thanks, I'll resend with a mention of dash.

> Regards,
> Chris
> 
> P.S. There appears to be more:
> 
> find . -name '*.sh' -exec dash -n {} \;

Yes, I'd personally just switch everything to /bin/bash since that's
what everyone writes anyway, but I didn't want to make such a huge
change just for this one bug :)

Tycho

> -- 
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project


More information about the CRIU mailing list