'port build' is getting EPERM from access(2) on "/var/tmp"

Joshua Root jmr at macports.org
Sat May 24 17:48:50 PDT 2014


On 2014-5-25 09:21 , Quentin Barnes wrote:
> On Sat, May 24, 2014 at 10:18:12AM +1000, Joshua Root wrote:
>> I'm not sure what exact syscalls test -w uses,
> 
> That was covered in my base note, access("/var/tmp", W_OK).
> 
>> but possibly allowing
>> file-write-data on /var/tmp would be correct and allow it to succeed.

Well, try this:

Index: src/port1.0/portsandbox.tcl
===================================================================
--- src/port1.0/portsandbox.tcl (revision 120356)
+++ src/port1.0/portsandbox.tcl (working copy)
@@ -89,6 +89,7 @@
 (allow file-write-data (literal \"/dev/null\") (literal \"/dev/zero\") \
 (literal \"/dev/dtracehelper\") (literal \"/dev/tty\") \
 (literal \"/dev/stdin\") (literal \"/dev/stdout\") (literal
\"/dev/stderr\") \
+(regex #\"^(/private)?(/var)?/tmp\$\") \
 (regex #\"^/dev/fd/\")) (allow file-write* \
 (regex #\"^(/private)?(/var)?/tmp/\" #\"^(/private)?/var/folders/\"))"


>> But it wouldn't hurt for the script to try $TMPDIR as well.
> 
> I suspect that's not going to work well since the configure script
> is looking for a writable tmp directory to compile into the program
> for when it is run by the user after installation.

Ah, OK. The right thing would be for the program to look at TMPDIR at
runtime then. I guess it would still want a fallback in case TMPDIR
isn't set, so the configure script should provide a way to specify one
directly in case it can't find one automatically. You can probably
override some autoconf var on the command line without even modifying
the script.

- Josh


More information about the macports-users mailing list