'port build' is getting EPERM from access(2) on "/var/tmp"
Quentin Barnes
qbarnes at gmail.com
Sat May 10 15:13:36 PDT 2014
I'm running OS X 10.9.2 with macports 2.2.1 and hit a problem with
'port build' invoking a port's "./configure" script and having
"test -w /var/tmp" fail.
I modified the configure script with some debug statements and
realized it was running with user "macports" and group "macports":
======
:info:configure + /usr/bin/id -g -n
:info:configure macports
:info:configure + /usr/bin/id -g -nr
:info:configure macports
:info:configure + /usr/bin/id -u -n
:info:configure macports
:info:configure + /usr/bin/id -u -nr
:info:configure macports
======
I also verified that it could write to /var/tmp even though the test -w
was failing:
======
:info:configure + ls -dl /var/tmp
:info:configure drwxrwxrwt 8 root wheel 272 May 10 16:12 /var/tmp
:info:configure + test -w /var/tmp
:info:configure + echo 1
:info:configure 1
:info:configure + rm /var/tmp/zz1
:info:configure + touch /var/tmp/zz1
:info:configure + ls -l /var/tmp/zz1
:info:configure -rw-r--r-- 1 macports wheel 0 May 10 16:12 /var/tmp/zz1
======
To simplify variables in play, I wrote a trivial program to do what
the shell is doing, running access("/var/tmp", W_OK), and that it
failed returning -1 with errno set to EPERM(1) (for reference,
program at end of mail):
======
:info:configure + /tmp/acc
:info:configure access = -1 1
:info:configure + echo 1
:info:configure 1
======
However, trying to emulate the problem outside of the 'port build'
environment didn't work:
======
$ ls -dl /var/tmp
drwxrwxrwt 8 root wheel 272 May 10 17:09 /var/tmp
$ sudo -u macports -g macports /bin/sh -c 'test -w /var/tmp;echo $?'
0
$ sudo -u macports -g macports /tmp/acc
access = 0 0
======
Both succeeded just fine.
Any ideas why under "port build" access(2) returns EPERM on "/var/tmp"
and how best to resolve this problem?
Quentin
=== acc.c ===
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int
main()
{
int ret = access("/var/tmp", W_OK);
fprintf(stderr, "access = %d %d\n", ret, errno);
return ret ? 1 : 0;
}
=============
More information about the macports-users
mailing list