On Thu Jul 25 01:10 2002 -0700, Paul Eggert wrote:
> I don't see how that patch solves the problem in general.  It has
> a special case for $1 = ., and doesn't handle any other case.

Good point.


> I looked at the ksh source code, since I couldn't believe that it
> always has this problem.  I discovered that ksh's cd command has a -P
> option that causes it to behave in the traditional way.

Well, it's nice of the OS vendors to document this...  The -P option
isn't listed in the ksh docs under Solaris or AIX.  Only OpenBSD seems
to document this.


> I also looked at POSIX 1003.1-2001, and discovered that it _requires_
> the ksh93 behavior.
> 
> So it appears to me that the "proper" fix is to try "cd -P DIR" first,
> and to fall back on plain "cd DIR" if that doesn't work.

Sounds good.  Please see the attached patch.  If it looks good to you,
I'll commit it.

-- 
Mark D. Roth <[EMAIL PROTECTED]>
http://www.feep.net/~roth/
Index: ChangeLog
===================================================================
RCS file: /cvsroot/autoconf/autoconf/ChangeLog,v
retrieving revision 1.1972
diff -u -r1.1972 ChangeLog
--- ChangeLog   23 Jul 2002 22:16:36 -0000      1.1972
+++ ChangeLog   25 Jul 2002 13:18:25 -0000
@@ -1,3 +1,9 @@
+2002-07-24  Mark D. Roth  <[EMAIL PROTECTED]>
+
+       * lib/autoconf/status.m4 (_AC_SRCPATHS): Try undocumented
+       "cd -P" option to avoid broken ksh behavior when $PWD
+       involves a symlink.
+
 2002-07-23  Paul Eggert  <[EMAIL PROTECTED]>
 
        * lib/m4sugar/m4sh.m4 (_AS_PATH_SEPARATOR_PREPARE):
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.29
diff -u -r1.29 status.m4
--- lib/autoconf/status.m4      18 Jul 2002 11:57:32 -0000      1.29
+++ lib/autoconf/status.m4      25 Jul 2002 13:18:28 -0000
@@ -164,8 +164,16 @@
 # 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`
-ac_abs_top_srcdir=`cd $1 && cd $ac_top_srcdir && pwd`
+# Try undocumented "cd -P" option to avoid broken ksh behavior when $PWD
+# involves a symlink.
+ac_abs_srcdir=`cd $1 && cd -P $ac_srcdir 2>/dev/null && pwd`
+if test $? -ne 0; then
+  ac_abs_srcdir=`cd $1 && cd $ac_srcdir && pwd`
+fi
+ac_abs_top_srcdir=`cd $1 && cd -P $ac_top_srcdir 2>/dev/null && pwd`
+if test $? -ne 0; then
+  ac_abs_top_srcdir=`cd $1 && cd $ac_top_srcdir && pwd`
+fi
 ])# _AC_SRCPATHS
 
 

Reply via email to