[Top][All Lists]

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

PWD problem in emacs-21.1 configure

From: Keith Thompson
Subject: PWD problem in emacs-21.1 configure
Date: Tue, 26 Feb 2002 14:14:51 -0800
User-agent: Mutt/1.2.5i

uname -a says:
        SunOS elmak 5.7 Generic_106541-16 sun4u sparc SUNW,Ultra-60
config.guess says: 
Emacs tarballs:
        emacs-20.7.tar.gz is ok
        emacs-21.1.tar.gz exhibits the problem
        Both downloaded from ftp://ftp.gnu.org/gnu/emacs/
        No source modifications.
I build with emacs 2.95.3 -- but since the error occurs during
configuration, this shouldn't matter.

I invoke configure with a single argument to specify the prefix:

./configure --prefix=/projects/admin/kst/apps/sparc-sun-solaris2.7/emacs-20.7
./configure --prefix=/projects/admin/kst/apps/sparc-sun-solaris2.7/emacs-21.1

(I know that the bug reporting guidelines discourage speculation about
the cause of a bug, but I'm pretty sure about this one.  If I'm wrong,
I think there's still enough information here to figure out what the
real problem is.  My speculation is marked as such below.)

The configure script for emacs-20.7 contains the following (line 599):

    if test "${PWD}" != "" && test "`(cd ${PWD} ; sh -c pwd)`" = "`pwd`"  ;

In emacs-21.1, this has been changed to the following (line 697):

    if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".${PWD}"  ;

When I build emacs, I use a Perl script that unpacks the tarball
and runs "configure", "make", and "make install".  The Perl script,
after it unpacks the tarball, does a "chdir" to the source directory.
A Perl chdir doesn't affect the $PWD environment variable, so $PWD was
still pointing to the parent of the source directory, though the actual
current working directory was the source directory itself.

    I believe the test in the emacs-20.7 configure script correctly fails
    when $PWD doesn't match the current directory (causing it to fall back
    to `pwd`), but the test in the emacs-21.1 configure script incorrectly
    succeeds (causing it to use the incorrect $PWD value.  The bug only shows 
up when configuring emacs-21.1, and only
    when $PWD points to a directory other than the actual current one.
end Speculation;

The symptom I'm seeing indicates that configure is looking for install-sh
or install.sh in the parent of the source directory, and failing to
find it:

    configure: error: can not find install-sh or install.sh in \
            /projects/admin/kst/src/gnu/emacs \
            /projects/admin/kst/src/gnu/emacs/.. \

(I've split the error message for legibility.)

I've added a workaround to my Perl build script; it unsets the $PWD
environment variable before invoking configure, forcing it to use `pwd`.
(This shouldn't cause problems for anything else, so I'm just going to
leave it that way.)  I'm just finished a successful build of emacs-21.1
while typing this.  "M-x emacs-version" prints "GNU Emacs 21.1.1
(sparc-sun-solaris2.7, X toolkit, Xaw3d scroll bars) of 2002-02-26
on elmak".

I note that the Bourne shell on Solaris also doesn't modify $PWD on a cd
command, so someone building emacs-21.1 from a Bourne shell script could
also run into this problem.  Since some Bourne shells do modify $PWD,
a Perl demo is more portable.

Here's a small perl script that demonstrates the bug:
#!/usr/local/bin/perl5.6.0 -w

use strict;

$| = 1;

my $result;

my $tarball = 'emacs-21.1.tar.gz';
my $source_dir = 'emacs-21.1';

print "% tar zxf $tarball\n";
$result = system 'tar', 'zxf', $tarball;
print "\$result = $result\n";
print "\n";

print "chdir $source_dir\n";
chdir $source_dir or die "$source_dir: $!\n";
print "chdir ok\n";     # Changes working directory but not $PWD
print "\n";

print "\$PWD = \"$ENV{PWD}\"\n";
my $pwd = `pwd`;
chomp $pwd;
print "`pwd` returns \"$pwd\"\n";
print "\n";

print "% ./configure\n";
$result = system './configure';
print "\$result = $result\n";
if ($result == 0) {
    print "The error seems not to have occurred\n";
else {
    die "configure failed\n";

Put it in a directory along with a copy of emacs-21.1.tar.gz, change
the "#!" line to suit your system, and run it.  It assumes that
tar groks the 'z' option.  Here's the output I get running it from
/projects/admin/kst/src/gnu/emacs/TMPDIR :
% tar zxf emacs-21.1.tar.gz $result = 0

chdir emacs-21.1
chdir ok

$PWD = "/projects/admin/kst/src/gnu/emacs/TMPDIR"
`pwd` returns "/projects/admin/kst/src/gnu/emacs/TMPDIR/emacs-21.1"

% ./configure
creating cache ./config.cache
configure: error: can not find install-sh or install.sh in 
$result = 256
configure failed

Suggested fix: change the indicated line in configure back to what it
was in version 20.7.

Keith Thompson (The_Other_Keith) address@hidden  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"

reply via email to

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