automake-patches
[Top][All Lists]
Advanced

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

Do not write in symlinked aclocal.m4


From: Ralf Wildenhues
Subject: Do not write in symlinked aclocal.m4
Date: Thu, 12 Jan 2006 20:25:37 +0100
User-agent: Mutt/1.5.9i

CVS Libtool will allow to use a symlinked libltdl in third-party
packages.  We discovered that an innocent `autoreconf' in the toplevel
package will then cause `aclocal' in libltdl to overwrite the target
of the `aclocal.m4' symlink.  We will work around this by not symlinking
that one file, but think this is a bug in aclocal.

The patch below fixes it.

(The currently-proposed patch against Autoconf to implement
`autoreconf --non-recursive' also helps as a workaround.)

Cheers,
Ralf

        * aclocal.in (write_aclocal): Unlink `aclocal.m4' before
        writing into it, to break a symlinked file.
        * tests/acloca20.test: New test.
        * tests/Makefile.am: Updated.

Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.134
diff -u -r1.134 aclocal.in
--- aclocal.in  5 Jan 2006 23:47:36 -0000       1.134
+++ aclocal.in  12 Jan 2006 20:02:46 -0000
@@ -763,6 +763,10 @@
 
   if (!$dry_run)
     {
+      if (-e $output_file && !unlink $output_file)
+        {
+         fatal "could not remove `$output_file': $!";
+       }
       my $out = new Automake::XFile "> $output_file";
       print $out $output;
     }
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.591
diff -u -r1.591 Makefile.am
--- tests/Makefile.am   30 Jun 2005 21:19:47 -0000      1.591
+++ tests/Makefile.am   12 Jan 2006 20:26:21 -0000
@@ -22,6 +22,7 @@
 acloca17.test \
 acloca18.test \
 acloca19.test \
+acloca20.test \
 acoutnoq.test \
 acoutpt.test \
 acoutpt2.test \
--- /dev/null   1970-01-01 00:00:01.000000000 +0200
+++ tests/acloca20.test 2006-01-12 20:26:31.000000000 +0100
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Make sure aclocal does not write into symlinked aclocal.m4.
+
+. ./defs || exit 1
+
+set -e
+
+cat >foo.m4 <<'END'
+m4_define([FOO], [echo wrong foo])
+END
+
+cat >doit.in <<'END'
address@hidden@ foo.m4 aclocal.m4
+END
+
+cat >configure.in <<'END'
+AC_INIT([acloca20], [1.0])
+AC_PROG_LN_S
+dnl FOO
+AC_CONFIG_FILES([doit],[chmod +x doit])
+AC_OUTPUT
+END
+
+$AUTOCONF
+./configure
+./doit
+grep 'wrong foo' aclocal.m4
+
+cat >acinclude.m4 <<'END'
+m4_define([FOO], [echo right foo])
+END
+sed 's/dnl //' <configure.in >configure.int
+mv -f configure.int configure.in
+
+$ACLOCAL
+$AUTOCONF
+./configure | grep 'right foo'
+grep 'wrong foo' foo.m4




reply via email to

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