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

Christopher Covington cov at codeaurora.org
Thu Mar 19 10:06:02 PDT 2015


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>

Regards,
Chris

P.S. There appears to be more:

find . -name '*.sh' -exec dash -n {} \;

-- 
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