[8626] in athena10
Re: possible AFS bug on 32 bit systems?
daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Thu Nov 3 14:23:42 2011
Date: Thu, 3 Nov 2011 14:23:37 -0400 (EDT)
From: Anders Kaseorg <andersk@MIT.EDU>
To: Alex T Prengel <alexp@MIT.EDU>
cc: debathena@MIT.EDU
In-Reply-To: <1320341117.7640.17.camel@dit>
Message-ID: <alpine.DEB.2.02.1111031415450.8052@dr-wily.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=UTF-8
Content-Transfer-Encoding: 8bit
On Thu, 3 Nov 2011, Alex T Prengel wrote:
> error: Cannot stat
> link ../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
The problem is simply that the MathematicaScript binary uses an incorrect
algorithm to find its own location. Specifically, it interprets relative
symlinks as being relative to the current directory, rather than relative
to the directory of the symlink as it should.
This can clearly be seen in the strace output:
open(".", O_RDONLY) = 3
chdir("/afs/athena.mit.edu/software/math_v8.0.4/bin") = 0
getcwd("/afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin"..., 1024) = 66
fchdir(3) = 0
close(3) = 0
lstat64("/afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin/MathematicaScript", {st_mode=S_IFLNK|0755, st_size=67, ...}) = 0
open(".", O_RDONLY) = 3
chdir("/afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin") = 0
getcwd("/afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin"..., 1024) = 66
fchdir(3) = 0
close(3) = 0
lstat64("/afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin/MathematicaScript", {st_mode=S_IFLNK|0755, st_size=67, ...}) = 0
readlink("/afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin/MathematicaScript", "../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript"..., 68) = 67
lstat64("../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript", 0xbfc1fefc) = -1 ENOENT (No such file or directory)
The reason you don’t see this problem on 64-bit systems is that the
symlink for 64-bit sysnames is absolute instead of relative.
lrwxr-xr-x 1 alexp nogroup 99 2011-11-01 17:21 /afs/athena.mit.edu/software/math_v8.0.4/arch/amd64_linux26/bin/MathematicaScript -> /afs/athena.mit.edu/software/math_v8.0.4/distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
lrwxr-xr-x 1 alexp nogroup 99 2011-11-01 17:21 /afs/athena.mit.edu/software/math_v8.0.4/arch/amd64_ubuntu1004/bin/MathematicaScript -> /afs/athena.mit.edu/software/math_v8.0.4/distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
lrwxr-xr-x 1 alexp nogroup 99 2011-11-01 17:21 /afs/athena.mit.edu/software/math_v8.0.4/arch/amd64_ubuntu1104/bin/MathematicaScript -> /afs/athena.mit.edu/software/math_v8.0.4/distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
lrwxr-xr-x 1 alexp nogroup 67 2011-11-02 17:03 /afs/athena.mit.edu/software/math_v8.0.4/arch/i386_deb50/bin/MathematicaScript -> ../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
lrwxr-xr-x 1 alexp nogroup 67 2011-11-02 17:03 /afs/athena.mit.edu/software/math_v8.0.4/arch/i386_linux26/bin/MathematicaScript -> ../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
lrwxr-xr-x 1 alexp nogroup 67 2011-11-02 17:03 /afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1004/bin/MathematicaScript -> ../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
lrwxr-xr-x 1 alexp nogroup 67 2011-11-02 17:03 /afs/athena.mit.edu/software/math_v8.0.4/arch/i386_ubuntu1104/bin/MathematicaScript -> ../../../distrib/SystemFiles/Kernel/Binaries/@sys/MathematicaScript
So you can work around this bug by making the symlink absolute on 32-bit
sysnames as well.
Anders