Getting this very bizarre error from libtool when trying to install a package I built. It happens when running in a subdirectory (src/api) of the source tree:

make[5]: Leaving directory '/users/galac/embray/src/slurm/src/api'
 /bin/mkdir -p '/usr/local/lib'
 /bin/bash ../../libtool   --mode=install /usr/bin/install -c   libslurm.la '/usr/local/lib'
../../libtool: line 929: cd: ../..: Not a directory

The relevant section of libtool looks like this:

  914 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  915 # is ksh but when the shell is invoked as "sh" and the current value of
  916 # the _XPG environment variable is not equal to 1 (one), the special
  917 # positional parameter $0, within a function call, is the name of the
  918 # function.
  919 progpath=$0
  921 # The name of this program.
  922 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  924 # Make sure we have an absolute progpath for reexecution:
  925 case $progpath in
  926   [\\/]*|[A-Za-z]:\\*) ;;
  927   *[\\/]*)
  928      progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  929      progdir=`cd "$progdir" && pwd`
  930      progpath=$progdir/$progname
  931      ;;
  932   *)
  933      _G_IFS=$IFS
  934      IFS=${PATH_SEPARATOR-:}
  935      for progdir in $PATH; do
  936        IFS=$_G_IFS
  937        test -x "$progdir/$progname" && break
  938      done
  939      IFS=$_G_IFS
  940      test -n "$progdir" || progdir=`pwd`
  941      progpath=$progdir/$progname
  942      ;;
  943 esac

If I insert set -x into the script around this section, I see the following trace:

+ progpath=../../libtool
++ printf '%s\n' ../../libtool
++ /bin/sed 's|^.*/||'
+ progname=libtool
+ case $progpath in
++ printf '%s\n' ../../libtool
++ /bin/sed 's|/[^/]*$||'
+ progdir=../..
++ cd ../..
../../libtool: line 930: cd: ../..: Not a directory
+ progdir=
+ progpath=/libtool

this leads to further errors since it does not set progpath=../../libtool, the correct path for libtool itself (in the top-level source dir). It also seems to be correctly setting progdir=../... So why is ../.. not a directory?

Clearly it looks fine if I check manually:

~/src/slurm/src/api$ ls -ld ../..
drwxr-xr-x 11 xxxxxx xxxxx 4096 May 14 14:52 ../..

It is not a symlink or anything like that.

Never seen anything like this in my 20 years of development.

  • 2
    I'm a bit confused by the Not a directory error. What shell outputs this message? The bash shell says No such file or directory, not just Not a directory. The dash shell says can't cd to <pathname>. What system are you running on?
    – Kusalananda
    May 14 '20 at 13:13
  • @Kusalananda Thanks for the comment. That actually points me in the right direction. I think I know what the problem is now.
    – Iguananaut
    May 14 '20 at 13:14
  • 1
    BTW the shell is definitely bash, but the message is not coming from bash but rather the filesystem. It's an nfs mount :facepalm:
    – Iguananaut
    May 14 '20 at 13:16
  • 2
    @Kusalananda, you do get a Not a directory error in cd /etc/passwd or cd /dev/null/foo. That is, it's a ENOTDIR error here, not ENOENT. (and the message does come from bash's cd builtin in any case based on the errno returned by chdir(2)). May 15 '20 at 7:31
  • @StéphaneChazelas So it is, and that's true for other cd implementations as well.
    – Kusalananda
    May 15 '20 at 7:44

The problem was that I'm on an NFS mount on an HPC system (on which I have administrative privileges). But the error occurred when running sudo make install.

The NFS server appears to be using the root_squash option, which makes NFS mounts unreadable by the root user; see https://linux.die.net/man/5/exports

The solution is to simply move my build to a non-NFS filesystem and install from there. Thanks to everyone who had a look.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.