bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ./init.sh: line 139: `test-acos': not a valid identifier


From: Eric Blake
Subject: Re: ./init.sh: line 139: `test-acos': not a valid identifier
Date: Thu, 18 Feb 2010 06:39:23 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

According to Jim Meyering on 2/18/2010 2:20 AM:
>> On that system, /bin/sh is bash 3.2.49 from latest cygwin 1.7.x.

I've been meaning to update cygwin's bash to 4.1, but the point is the
same for either shell - the trick is that invoking the script with
#!/bin/sh is what disables - in function names.

> To accommodate "-" in function names would amount
> to using a POSIX extension, so we'd have to use bash.

Or zsh or pdksh.

So really, the better shell selection needs to look for shells that can
handle -, but only if $EXEEXT is non-empty where such function names are
needed.

For that matter, we should also try 'set +o posix' prior to looking for a
better shell; it is certainly faster, and works for bash:

$ /bin/sh -c 'a-b() { echo hi; }; a-b'
/bin/sh: `a-b': not a valid identifier
$ /bin/sh -c 'set +o posix; a-b() { echo hi; }; a-b'
hi

ksh ignores 'set +o posix'.

zsh doesn't like it (but when /bin/sh is zsh, it already accepts - in
function names).

So, the logic needed is:

test for $(); if not present, start the search loop
if $EXEEXT:
  test for - in functions
  if not present, test for set +o posix
  if still not present, start the search loop

> If so, the proposed re-exec approach should end up solving the problem.
> Now we have to determine which replacement shell to use.
> One way would be to write something similar to posix-shell.m4
> that tests for the added capability.  Or perhaps just perform
> the test "live" every time we run init.sh.

I'm okay with running the test "live" for every init.sh run (that is,
init.sh should be the one that has the better shell loop, because the
better shell loop is only needed: on Solaris, where /bin/sh is puny, and
possibly on wine, where - in function names aren't supported but where
/bin/sh is dash rather than bash).

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]