Rainer Orth wrote:
Jacob Bachmeyer <jcb62...@gmail.com> writes:
Rainer Orth wrote:
It seems this is no wonder:
expr foo : -
is not in XPG7/POSIX.1 and the autoconf manual explicitly states that
this is an unportable non-POSIX extension.
Can you cite exactly where in the Autoconf manual that is mentioned?
The closest that I can find is a recommendation to use `expr X"word" :
'Xregex'` to handle cases where "word" starts with a dash; here Solaris
10 is rejecting a case where "word" is "foo".
Upon re-checking, I seem to have misread the relevant section, sorry.
The fact remains, however, that XPG7 doesn't list that variant on
https://pubs.opengroup.org/onlinepubs/9699919799/toc.htm
which suggests (together with the behaviour of /usr/xpg6/bin/expr which
has been certified for XPG conformance AFAIK) that this usage is an
extension.
By my reading of
<URL:https://pubs.opengroup.org/onlinepubs/9699919799/utilities/expr.html>,
"/expr1/ : /expr2/" is a "matching expression", which is explained in
the next subsection as matching the string /expr1/ against the regular
expression /expr2/ according to basic regular expression syntax
explained at
<URL:https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03>,
where dash ("-") is not listed as a special character, so that usage of
expr should be equivalent to matching the glob pattern "-*" as the code
now does.
Wait... while Solaris seems to be incorrectly rejecting that command,
cases where it *should* match would be exactly the situation the
Autoconf manual mentions, with `expr --help : -` as one example where
expr can incorrectly parse the first expression as an option.
There is still a bug somewhere here, either in Solaris expr or the
Autoconf manual (or both); I am unsure which, but my reading of the
specs suggest a bug in Solaris which the Autoconf manual should
mention. In any case, the incorrect usage in the dejagnu launcher
script has now been fixed, thanks again for pointing it out.
I encourage you to report the issue as a documentation bug in Autoconf
once we get this figured out: either the Autoconf manual does not
mention an easy pitfall or the Autoconf manual does not mention a bug on
Solaris that makes an otherwise portable usage nonportable.
-- Jacob
_______________________________________________
Bug-dejagnu mailing list
Bug-dejagnu@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-dejagnu