[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
84-fyi-extra-robust-super-strong-stormproof-filenames.patch
From: |
Akim Demaille |
Subject: |
84-fyi-extra-robust-super-strong-stormproof-filenames.patch |
Date: |
Wed, 05 Sep 2001 09:03:23 +0200 |
That's not funny :P
Index: ChangeLog
from Akim Demaille <address@hidden>
Be ready to handle filenames as stupid as `dnl.at', for if even
the maintainer is dumb enough to do that...
* lib/autotest/general.m4 (AT_SETUP, AT_LINE): Demonstrates your
excellence in M4 quotation: consider `__file__' is active.
And BTW, when invoking m4, pass the --include in the right order:
the wrong one.
* bin/autom4te.in, bin/autoupdate.in: Use reverse when kingtal to
4m.
Index: bin/autom4te.in
--- bin/autom4te.in Tue, 04 Sep 2001 14:49:58 +0200 akim
+++ bin/autom4te.in Tue, 04 Sep 2001 17:01:52 +0200 akim
@@ -572,12 +572,14 @@ sub handle_m4 ($@)
unlink ($tcache . $req->id);
# Run m4.
+ # Be extremely cautious to reverse the includes when talking to M4:
+ # it doesn't speak the same --include as we do.
my $command = ("$m4"
- . " --define m4_warnings=$m4_warnings"
+ . join (' --include=', '', reverse @include)
+ . " --define=m4_warnings=$m4_warnings"
. ' --debug=aflq'
. " --error-output=$tcache" . $req->id
. join (' --trace=', '', sort @macro)
- . join (' --include=', '', @include)
. $files
. " >$ocache" . $req->id);
verbose "running: $command";
Index: bin/autoupdate.in
--- bin/autoupdate.in Tue, 04 Sep 2001 14:49:58 +0200 akim
+++ bin/autoupdate.in Tue, 04 Sep 2001 17:03:59 +0200 akim
@@ -380,8 +380,9 @@ sub handle_autoconf_macros ()
or die "$me: cannot close $tmp/input.m4: $!\n";
# Now ask m4 to perform the update.
+ # M4 and I don't agree on the associativity of `--include': reverse!
xsystem ("$m4"
- . join (' --include=', '', @include, $tmp)
+ . join (' --include=', '', reverse (@include, $tmp))
. " $tmp/input.m4 >$tmp/updated");
update_file ("$tmp/updated",
"$file" eq "$tmp/stdin" ? '-' : "$file");
Index: lib/autotest/general.m4
--- lib/autotest/general.m4 Fri, 31 Aug 2001 13:08:23 +0200 akim
+++ lib/autotest/general.m4 Tue, 04 Sep 2001 17:12:23 +0200 akim
@@ -71,9 +71,23 @@ m4_define([_m4_divert(TAIL)], 60
# AT_LINE
# -------
-# Return the current file sans directory, a colon, and the current line.
+# Return the current file sans directory, a colon, and the current
+# line. Be sure to return a _quoted_ filename, so if, for instance,
+# the user is lunatic enough to have a file named `dnl' (and I, for
+# one, love to be brainless and stubborn sometimes), then we return a
+# quoted name.
+#
+# Gee, we can't use simply
+#
+# m4_patsubst(__file__, [^.*/\(.*\)], [[\1]])
+#
+# since then, since `dnl' doesn't match the pattern, it is returned
+# with once quotation level less, so you lose, dammit! And since GNU M4
+# is one of the biggest junk in the whole universe wrt regexp, don't
+# even think about using `?' or `\?'. Bah, `*' will do.
+# Pleeeeeeeease, Gary, provide us with dirname and ERE!
m4_define([AT_LINE],
-[m4_patsubst(__file__, ^.*/\(.*\), \1):__line__])
+[m4_patsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
# AT_INIT(PROGRAM)
@@ -496,12 +510,12 @@ m4_define([AT_SETUP],
[m4_define([AT_ordinal], m4_incr(AT_ordinal))
m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
m4_divert_text([HELP],
- [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])])
+ [m4_format([[ %3d: %-15s %s]], AT_ordinal, AT_LINE, [$1])])
m4_divert_push([TESTS])dnl
- AT_ordinal ) [#] AT_ordinal. AT_LINE: $1
+ AT_ordinal ) @%:@ AT_ordinal. AT_LINE: $1
at_setup_line='AT_LINE'
$at_verbose "AT_ordinal. $srcdir/AT_LINE: testing $1..."
- $at_quiet $at_n "m4_format([%3d: %-18s], AT_ordinal, AT_LINE)[]$at_c"
+ $at_quiet $at_n "m4_format([[%3d: %-18s]], AT_ordinal, AT_LINE)[]$at_c"
(
$at_traceon
])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 84-fyi-extra-robust-super-strong-stormproof-filenames.patch,
Akim Demaille <=