[Top][All Lists]

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

Autoconf-2.53 .. -2.57: Spurious cd error messages

From: Christian Cornelssen
Subject: Autoconf-2.53 .. -2.57: Spurious cd error messages
Date: Thu, 9 Jan 2003 11:32:52 +0100 (CET)

(initially posted to address@hidden, which may or may not


I have been wondering why `config.status' issues spurious error
messages when creating links.  The links are created correctly,
though the script complains about cds to a nonexistent directory.
IIRC, the error occured from 2.53 on.  I have now fixed it in 2.57.

To reproduce, try something like


in `', with `include/kernel' not existing in the
source tree.  (It's for build-time links only.)  Then use a build
directory other than the source directory, and voila: It works, but
complains such that doubts arise immediately.

What happens is that _AC_SRCPATHS figures out many paths which may
or may not be needed, and in case of ac_srcdir and ac_abs_srcdir
need not even exist.  The expansion of _AC_SRCPATHS leads to the
superfluous attempt to provide ac_abs_srcdir by using a combination
of cd and pwd.  This fails and produces the irritating error message.

My solution is to simply add a 2>/dev/null.  This means that if
$ac_srcdir does not exist, then $ac_abs_srcdir will be empty.
You may or may not like this; perhaps you'd want to construct a
hypothetical value using just string concatenation instead of cd
and pwd.  However, such a value would not work when it is used,
simply because the directory does not exist.  (It would occasionally
work with an mkdir, but you would not create dirs in the source tree,
would you?)

On the other hand, my approach has the potential for making real
errors more harmful.  If $ac_srcdir does not exist, and is used,
this leads to an error message about a nonexisting directory.
But if $ac_abs_srcdir is used instead, e.g. "$ac_abs_srcdir/file",
the path prefix gets lost, leaving "/file", which may or may not lead
to a missing file or a permission denial afterwards.  In any case,
unrelated files could get involved silently.  Think about that.
Perhaps you'd prefer the fallback to a string concatenation.

Tested with "make check".


Christian Cornelssen

        * lib/autoconf/status.m4 (_AC_SRCPATHS): Added 2>/dev/null
        for the case that $ac_srcdir does not exist.

--- lib/autoconf/status.m4.orig Tue Nov 12 11:54:46 2002
+++ lib/autoconf/status.m4      Thu Jan  9 03:23:40 2003
@@ -164,7 +164,9 @@
 # absolute.
 ac_abs_builddir=`cd $1 && cd $ac_builddir && pwd`
 ac_abs_top_builddir=`cd $1 && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd $1 && cd $ac_srcdir && pwd`
+# If there is no srcdir corresponding to the builddir,
+# forget it and suppress the warning.
+ac_abs_srcdir=`cd $1 && cd $ac_srcdir 2>/dev/null && pwd`
 ac_abs_top_srcdir=`cd $1 && cd $ac_top_srcdir && pwd`

reply via email to

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