.PP
.SH "ENVIRONMENT VARIABLES"
.PP
-ccache used a number of environment variables to control operation\&. In
+ccache uses a number of environment variables to control operation\&. In
most cases you won\&'t need any of these as the defaults will be fine\&.
.PP
.IP
results, even if it finds them\&. New results are still cached, but
existing cache entries are ignored\&.
.IP
+.IP "\fBCCACHE_UMASK\fP"
+This sets the umask for ccache and all child
+processes (such as the compiler)\&. This is mostly useful when you wish
+to share your cache with other users\&. Note that this also affects the
+file permissions set on the object files created from your
+compilations\&.
+.IP
.IP "\fBCCACHE_HASHDIR\fP"
This tells ccache to hash the current working
directory when calculating the hash that is used to distinguish two
Make sure that all users have write permission in the entire
cache directory (and that you trust all users of the shared cache)\&.
.IP o
-Tell your users to set a umask that allows group writes
-(eg\&. umask 002)
+Make sure everyone sets the CCACHE_UMASK environment variable
+to 002, this ensures that cached files are accessible to everyone\&.
.IP o
Make sure that the setgid bit is set on all directories in the
cache\&. This tells the filesystem to inherit group ownership for new
int main(int argc, char *argv[])
{
+ char *p;
+
cache_dir = getenv("CCACHE_DIR");
if (!cache_dir) {
x_asprintf(&cache_dir, "%s/.ccache", getenv("HOME"));
cache_logfile = getenv("CCACHE_LOGFILE");
setup_uncached_err();
+
+
+ /* the user might have set CCACHE_UMASK */
+ p = getenv("CCACHE_UMASK");
+ if (p) {
+ mode_t mask;
+ errno = 0;
+ mask = strtol(p, NULL, 8);
+ if (errno == 0) {
+ umask(mask);
+ }
+ }
+
/* check if we are being invoked as "ccache" */
if (strlen(argv[0]) >= strlen(MYNAME) &&
manpagesection(ENVIRONMENT VARIABLES)
-ccache used a number of environment variables to control operation. In
+ccache uses a number of environment variables to control operation. In
most cases you won't need any of these as the defaults will be fine.
startdit()
results, even if it finds them. New results are still cached, but
existing cache entries are ignored.
+dit(bf(CCACHE_UMASK)) This sets the umask for ccache and all child
+processes (such as the compiler). This is mostly useful when you wish
+to share your cache with other users. Note that this also affects the
+file permissions set on the object files created from your
+compilations.
+
dit(bf(CCACHE_HASHDIR)) This tells ccache to hash the current working
directory when calculating the hash that is used to distinguish two
compiles. This prevents a problem with the storage of the current
it() Use the same bf(CCACHE_DIR) environment variable setting
it() Make sure that all users have write permission in the entire
cache directory (and that you trust all users of the shared cache).
- it() Tell your users to set a umask that allows group writes
- (eg. umask 002)
+ it() Make sure everyone sets the CCACHE_UMASK environment variable
+ to 002, this ensures that cached files are accessible to everyone.
it() Make sure that the setgid bit is set on all directories in the
cache. This tells the filesystem to inherit group ownership for new
directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might
int fd;
unlink(path_stdout);
- fd = open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+ fd = open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0666);
if (fd == -1) {
exit(STATUS_NOCACHE);
}
close(fd);
unlink(path_stderr);
- fd = open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+ fd = open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0666);
if (fd == -1) {
exit(STATUS_NOCACHE);
}
{
int fd;
- fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
+ fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0666);
if (fd == -1) {
return -1;
}
compiler as a command line option.
<p><h2>ENVIRONMENT VARIABLES</h2>
-<p>ccache used a number of environment variables to control operation. In
+<p>ccache uses a number of environment variables to control operation. In
most cases you won't need any of these as the defaults will be fine.
<p><dl>
<p><p></p><dt><strong><strong>CCACHE_DIR</strong></strong><dd> the CCACHE_DIR environment variable specifies
<p><p></p><dt><strong><strong>CCACHE_RECACHE</strong></strong><dd> This forces ccache to not use any cached
results, even if it finds them. New results are still cached, but
existing cache entries are ignored.
+<p><p></p><dt><strong><strong>CCACHE_UMASK</strong></strong><dd> This sets the umask for ccache and all child
+processes (such as the compiler). This is mostly useful when you wish
+to share your cache with other users. Note that this also affects the
+file permissions set on the object files created from your
+compilations.
<p><p></p><dt><strong><strong>CCACHE_HASHDIR</strong></strong><dd> This tells ccache to hash the current working
directory when calculating the hash that is used to distinguish two
compiles. This prevents a problem with the storage of the current
<li > Use the same <strong>CCACHE_DIR</strong> environment variable setting
<li > Make sure that all users have write permission in the entire
cache directory (and that you trust all users of the shared cache).
- <li > Tell your users to set a umask that allows group writes
- (eg. umask 002)
+ <li > Make sure everyone sets the CCACHE_UMASK environment variable
+ to 002, this ensures that cached files are accessible to everyone.
<li > Make sure that the setgid bit is set on all directories in the
cache. This tells the filesystem to inherit group ownership for new
directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might