Package managers should allow administrators to override permissions of files in a way that persists through upgrades. For example, this can be accomplished using an approach similar to Debian's dpkg-statoverride tool.
*** Bug 141619 has been marked as a duplicate of this bug. ***
*** Bug 151778 has been marked as a duplicate of this bug. ***
I think that this bug's importance should be raised. Consider, for instance, net-misc/tor: pkg_setup() { enewgroup tor enewuser tor -1 -1 /var/lib/tor tor } src_install() { ... fperms 750 /var/lib/tor fowners tor:tor /var/lib/tor ... } The intent is clearly that /var/lib/tor is only readable by user "tor". However: drwxr-xr-x 2 tor root 88 Jun 16 01:07 /var/lib/tor Specifically for net-misc/tor, this is not a serious issue (Tor daemon apparently sets umask to 077 for new files and directories), but it might be for other packages. I had to resolve to, e.g.: pkg_setup() { enewgroup i2p enewuser i2p -1 -1 /var/lib/i2p i2p rmdir /var/lib/i2p 2>/dev/null || : } in order to enforce directory permissions for a similar package.
(In reply to comment #3) i don't really understand your example. if /var/lib/tor doesn't exist, then when the dir gets merged, it'll start with 750 perms. how did it get 755 ? also, be aware that you cannot rely on the tree state that an ebuild sets up in /var/{lib,cache,run} since that might get removed manually by an admin. so init.d scripts have to use `checkpath` to make sure they're available.
(In reply to comment #4) > i don't really understand your example. if /var/lib/tor doesn't exist, then > when the dir gets merged, it'll start with 750 perms. how did it get 755 ? But /var/lib/tor already exists before src_install() -- it is created by enewuser in pkg_setup(). > also, be aware that you cannot rely on the tree state that an ebuild sets up > in /var/{lib,cache,run} since that might get removed manually by an admin. > so init.d scripts have to use `checkpath` to make sure they're available. I am aware of /var/run (filed a few bugs for bug #332633 myself), and /var/cache case is kind of obvious, but /var/lib? It seems to me that if one starts arbitrary removing stuff in /var/lib in Gentoo, the system will break...