"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Ryo ONODERA <ryo@tetera.org>
Subject:
Re: POSIX shell portability fixes under regress/
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 29 Dec 2020 14:13:38 +0900

Download raw body.

Thread
Hi,

Christian Weisgerber <naddy@mips.inka.de> writes:

> Ryo ONODERA:
>
>> Some shell scripts under regress/ directory
>> use [s1 == s2] syntax to compare strings.
>> In POSIX way, this is defined as [s1 = s2].
>> See:
>> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
>
> There are a lot of things in the regression scripts that are not
> POSIX.  Such as "local" variables.  I'm not sure it makes much sense
> to fix usages that work just fine on all platforms that Got is
> likely to be ported to.
>
> The biggest actual portability headache is the use of "sed -i".
>
>> -	if [ "$ret" == "0" ]; then
>> +	if [ "$ret" = "0" ]; then
>
> Numerical comparisons should use -eq in the first place.

Thanks for your reply and suggestions.

I want to use got under NetBSD in future.
NetBSD's package management system, pkgsrc dislikes == comparison
in test/[.
It was my motivation.

GNU sed's -i is always headache for me too.

My patch is intended to fix one problem.
I would like to submit another patch later.

> -- 
> Christian "naddy" Weisgerber                          naddy@mips.inka.de

-- 
Ryo ONODERA // ryo@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3