Re: [PATCH v2 1/4] Replace 'test "${var+set}" = set' with '[ ${var+y} ]'

Bernhard Reutner-Fischer <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <CAC1BbcSK5wFPN6fo34k4x6TapbzwO4BaU6HViCVh84tbPUb2=Q@mail.gmail.com>
On 9 April 2015 at 16:33, Eric Blake <[email protected]> wrote:
> On 04/09/2015 07:54 AM, Bernhard Reutner-Fischer wrote:

>>> This pattern for setting a variable to a default value also occurs in
>>> the manual under the section on ${var=value}; we should probably update
>>> that recommendation to the shorter form, since we should follow our own
>>> documentation.  Or we should determine if we can portably use the even
>>> shorter ${CONFIG_COMMANDS=$config_commands} these days, after properly
>>> rejecting ancient broken shells.
>>
>> ${x=$default} is even better, agree.
>> Given that this was even in SUSv3 it should be reasonable safe to use
>> this by now.
>
> Not all the world is SUSv3.  We have a section in the manual for a reason.
> https://www.gnu.org/software/autoconf/manual/autoconf.html#Shell-Substitutions
>
> | The portable way out consists in using a double assignment, to switch
> the 8th bit twice on Ultrix:
> |
> |           list=${list="$default"}
> |
> | ...but beware of the ‘}’ bug from Solaris (see above). For safety, use:
> |
> |           test "${var+set}" = set || var={value}
>
> Okay, so maybe we can argue that no one uses autoconf to generate
> configure scripts for Ultrix any more, and that the Solaris bug is
> something we easily avoid (because we require a shell with functions),
> so maybe we CAN now get away with the shorter default assignment form;
> but it should be its own commit and testsuite enhancements to make sure
> we aren't overlooking some other broken shell that is used in the wild.

Yea, given that Ultrix support has been removed from GCC (recently) i
would start to phase out support for Ultrix in future releases of autoconf.
Since even /me replaced my OSF/1 installation with something even more
modern a year ago i guess it would be acceptable to leave OS' that were
in effect abandoned by their vendors at older versions.

Not my call though.

Either way, thanks a lot for having taken care of these!

cheers,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.