I'm running into a build break that relates to the temporary files
that LLVM creates:

svl-junos-j019% cc --version
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: arm--freebsd10.0-gnueabi
Thread model: posix

On a build machine /tmp/b is a directory and created by user X.
I am doing a buildworld on that machine as user Y (Y=marcelm) and
I don't have permissions in /tmp/b. The build gets to usr.bin/awk
and it has a source file called b.c

The build fails with:

--- b.o ---
cc  -O -pipe  -DHAS_ISBLANK -I. 
 -DFOPEN_MAX=64 -std=gnu99 -Qunused-arguments  -Wsystem-headers -Werror 
-Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int 
-Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality 
-Wno-unused-function -Wno-enum-conversion -Wno-switch -Wno-switch-enum 
-Wno-knr-promoted-parameter -Wno-parentheses -c 
cc: error: unable to make temporary file: /tmp/b: can't make unique filename: 
Permission denied
*** [b.o] Error code 1

Running truss shows:

 = 0 (0x0)
stat("/tmp/b",{ mode=drwxr-xr-x ,inode=235520,size=512,blksize=16384 }) = 0 
open("/dev/random",O_RDONLY,00)                  = 3 (0x3)
read(3,"\M^S\M^H\^S65S'*\M-T\M-r\^A9\M-K"...,128) = 128 (0x80)
close(3)                                         = 0 (0x0)
stat("/tmp/b",{ mode=drwxr-xr-x ,inode=235520,size=512,blksize=16384 }) = 0 
open("/tmp/b/B8owDb",O_RDWR|O_CREAT|O_EXCL,0600) ERR#13 'Permission denied'

Now, if I compile another file, I get:

 = 0 (0x0)
stat("/tmp/lex",0x7fffffffbab0)                  ERR#2 'No such file or 
open("/dev/random",O_RDONLY,00)                  = 3 (0x3)
read(3,"\^F\r\M-J\M-5Z\M-fK\^E\M-2'\M-1"...,128) = 128 (0x80)
close(3)                                         = 0 (0x0)
stat("/tmp",{ mode=drwxrwxrwt ,inode=2,size=9728,blksize=16384 }) = 0 (0x0)
open("/tmp/lex-pDQnPA",O_RDWR|O_CREAT|O_EXCL,0600) = 3 (0x3)
close(3)                                         = 0 (0x0)

So for some reason when /tmp/<basename> exists and is a directory, then the
compiler wants to create a temporary file underneath that directory. That
looks like a bug to me. Do people concur and thus shall I file a PR?

Marcel Moolenaar

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to