pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: clang builds and /var/tmp



Le 21/10/15 10:39, Tobias Nygren a écrit :

The purpose of /var/tmp is to be a globally writable temp directory.
If you do "ktrace gcc -o test test.c" you will find that the gcc +
binutils toolchain too creates many temporary files there, unless -pipe
is used. A good solution to preserve the life of your ssd is to mount
tmpfs on /tmp and /var/tmp. But beware that this breaks virecover.

-Tobias


/tmp is naturally already tmpfs (at least on SunOS)...

from `man filesystem'

      /tmp
           Temporary files; cleared during the boot operation.

...
      /var/tmp
           Files that vary in size or presence during normal system
           operations. This directory is not cleared during the boot
           operation. An approved installation location for bundled Solaris
           software and for add-on system software and applications.

           It is possible to change the default behavior for /var/tmp to clear
           all of the files except editor temporary files by setting the
           clean_vartmp property value of the rmtmpfiles service. This is done
           with the following commands:

             # svccfg -s svc:/system/rmtmpfiles setprop \
                   options/clean_vartmp = "true"
             # svcadm refresh svc:/system/rmtmpfiles:default

           The solaris.smf.value.rmtmpfiles authorization is required to
           modify this property.


why the hell would a /var/tmp be used in the case of pure temporary files?

even mktemp does the right thing:
richard@omnis:/home/richard/src/tnull$ echo `mktemp`
/tmp/tmp.GbWcPL
richard@omnis:/home/richard/src/tnull$ echo  `mktemp -t`
/tmp/tmp.oUGdPL
richard@omnis:/home/richard/src/tnull$ echo  `TMPDIR=/var/tmp mktemp`
/var/tmp/tmp.hIGFPL
richard@omnis:/home/richard/src/tnull$ echo  `TMPDIR=/var/tmp mktemp -t`
/var/tmp/tmp.ZfqGPL

I do see now that gcc uses /var/tmp, but even sunstudio does it right with /tmp...

Looks as if, for the case of gcc, that in libiberty/make-temp-file.c:
115 #ifdef VMS
116       /* Try VMS standard temp logical.  */
117       base = try_dir ("/sys$scratch", base);
118 #else
119       base = try_dir (getenv ("TMPDIR"), base);
120       base = try_dir (getenv ("TMP"), base);
121       base = try_dir (getenv ("TEMP"), base);
122 #endif
123
124 #ifdef P_tmpdir
125       /* We really want a directory name here as if concatenated with say \d    ir
126          we do not end up with a double \\ which defines an UNC path.  */
127       if (strcmp (P_tmpdir, "\\") == 0)
128         base = try_dir ("\\.", base);
129       else
130         base = try_dir (P_tmpdir, base);
131 #endif
132
133       /* Try /var/tmp, /usr/tmp, then /tmp.  */
134       base = try_dir (vartmp, base);
135       base = try_dir (usrtmp, base);
136       base = try_dir (tmp, base);

Always having TMPDIR set should probably get over the issue.

Therefore, it seems pkgsrc could have a TMPDIR in defaults,
overrideable by the user or even the package allowing customisation if
need be.


Home | Main Index | Thread Index | Old Index