Subject: | Cache::FileCache incorrect permissions under umask 077 |
Date: | Tue, 24 Jan 2012 14:41:26 -0800 (PST) |
To: | "bug-Cache-Cache [...] rt.cpan.org" <bug-Cache-Cache [...] rt.cpan.org> |
From: | Christopher Vaill <cvaill [...] yahoo.com> |
When the umask is set to 077 (or anything with an execute bit set), the modes on files created by Cache::FileCache don't come out quite right:
$ umask
0077
$ perl -MCache::FileCache -e '$c = Cache::FileCache->new(); $c->set("key", "value");'
$ find /tmp/FileCache -type f | xargs ls -l
-r-xrw-rwx 1 vaillc wheel 145 Jan 24 17:13 /tmp/FileCache/Default/a/6/2/a62f2225bf70bfaccbc7f1ef2a397836717377de
$
The file has a mode of 0567, but should have a mode of 0600. The cause is this, at line 587 of Cache::FileBackend:
$p_optional_mode ||= 0666 - umask( );
the expression should be 0666 & ~umask().