[Top][All Lists]

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

Re: document AS_BASENAME

From: Eric Blake
Subject: Re: document AS_BASENAME
Date: Fri, 31 Mar 2006 07:56:44 -0700
User-agent: Thunderbird 1.5 (Windows/20051201)

Hash: SHA1

According to Ralf Wildenhues on 3/30/2006 11:54 PM:
> FWIW, I wonder whether using expr at all for general names is a good
> idea, as the documented bug on Tru64 that turns everything into a number
> that looks like one (after other operations):
>  $ expr 'X000123.c' : 'X\(.*\)\.c'
>  123

AS_BASENAME attempts the platform's basename before falling back to expr;
it only filters out missing basename or instances of basename that
mishandle /.  If Tru64 has a working basename, then the expr bug will not
hit us when doing AS_BASENAME[(foo/01)]; but that does not prevent the
above suffix stripping bug unless we improve AS_BASENAME to take an
optional suffix argument.  Do we have anyone that can verify whether Tru64
will always have a working basename?  Should we beef up _AS_EXPR_PREPARE
to also refuse to use expr if it mishandles numeric string pattern matches?

Also, I noticed that where basename is missing, AS_BASENAME mishandles ///
(it was outputting . instead of /), patched thusly:

2006-03-31  Eric Blake  <address@hidden>

        * lib/m4sugar/m4sh.m4 (AS_BASENAME_EXPR): Correctly handle ///.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -

Index: lib/m4sugar/m4sh.m4
RCS file: /sources/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.165
diff -u -p -r1.165 m4sh.m4
--- lib/m4sugar/m4sh.m4 27 Mar 2006 17:42:18 -0000      1.165
+++ lib/m4sugar/m4sh.m4 31 Mar 2006 14:54:30 -0000
@@ -706,8 +706,7 @@ m4_defun([AS_BASENAME_EXPR],
 $as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
         X[]$1 : 'X\(//\)$' \| \
-        X[]$1 : 'X\(/\)$' \| \
-        .     : '\(.\)'])
+        X[]$1 : 'X\(/\)' \| .])
 [echo X/[]$1 |

reply via email to

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