Summary: | dev-util/ccache-4.7.4: tries to write to /run for temporary files | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sam James <sam> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dan, matthew |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=837362 https://bugs.gentoo.org/show_bug.cgi?id=837380 https://bugs.gentoo.org/show_bug.cgi?id=887019 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | sandbox.log |
Description
Sam James
2022-12-01 02:25:29 UTC
Created attachment 838641 [details]
sandbox.log
Note this isn't as severe as before or anything, because it won't affect Portage runs, just cases where you have XDG_RUNTIME_DIR set. It may work to just check if /run/user/blah is writable first? (In reply to Sam James from comment #2) > Note this isn't as severe as before or anything, because it won't affect > Portage runs, just cases where you have XDG_RUNTIME_DIR set. > > It may work to just check if /run/user/blah is writable first? Or maybe Portage should forcefully set CCACHE_TEMPDIR to PORTAGE_TMPDIR. (After https://github.com/ccache/ccache/commit/876509ae8b95f76adebdfa1f2380d75a49f9871d landed in 4.7.4, we thought maybe things were fine now and dropped our own patch to force usage of /tmp, but we still need to force /tmp as /run/user might exist but not be writable because of sandbox.) I'm not sure if ccache is properly respecting CCACHE_TEMPDIR, as both setting CCACHE_TEMPDIR in the environment, as well as this Portage patch do nothing to help(!): ``` --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -713,6 +713,13 @@ if ! has "${EBUILD_PHASE}" clean cleanrm ; then addwrite "${CCACHE_DIR}" fi + if [[ -z ${CCACHE_TEMPDIR} ]] ; then + export CCACHE_TEMPDIR="${PORTAGE_TMPDIR}"/ccache-tmp + fi + + addread "${CCACHE_TEMPDIR}" + addwrite "${CCACHE_TEMPDIR}" + [[ -n ${CCACHE_SIZE} ]] && ccache -M ${CCACHE_SIZE} &> /dev/null fi fi ``` (In reply to Sam James from comment #3) > (In reply to Sam James from comment #2) > > Note this isn't as severe as before or anything, because it won't affect > > Portage runs, just cases where you have XDG_RUNTIME_DIR set. > > > > It may work to just check if /run/user/blah is writable first? > > Or maybe Portage should forcefully set CCACHE_TEMPDIR to PORTAGE_TMPDIR. This won't help. If XDG_RUNTIME_DIR is set, ccache generates $XDG_RUNTIME_DIR/ccache-tmp and uses it as the default, and only afterwards ccache checks whether this default is overridden. IMHO, this is a bug in ccache: An actually unused directory should not be created unnecessarily. Also, setting CCACHE_TEMPDIR to PORTAGE_TMPDIR is a bad idea: The original default <cache_dir>/tmp makes much more sense, and there is no reason to change this independently of whether XDG_RUNTIME_DIR is set. I patched this conditional undesirable behavior for set XDG_RUNTIME_DIR out. (In reply to Martin Väth from comment #5) > (In reply to Sam James from comment #3) > > (In reply to Sam James from comment #2) > > > Note this isn't as severe as before or anything, because it won't affect > > > Portage runs, just cases where you have XDG_RUNTIME_DIR set. > > > > > > It may work to just check if /run/user/blah is writable first? > > > > Or maybe Portage should forcefully set CCACHE_TEMPDIR to PORTAGE_TMPDIR. > > This won't help. > > If XDG_RUNTIME_DIR is set, ccache generates $XDG_RUNTIME_DIR/ccache-tmp and > uses it as the default, and only afterwards ccache checks whether this > default is overridden. > Well, I did note that it doesn't actually work in the comment underneath :) It should work, but it doesn't, I think. > IMHO, this is a bug in ccache: An actually unused directory should not be > created unnecessarily. > > Also, setting CCACHE_TEMPDIR to PORTAGE_TMPDIR is a bad idea: > The original default <cache_dir>/tmp makes much more sense, and there is no > reason to change this independently of whether XDG_RUNTIME_DIR is set. > I patched this conditional undesirable behavior for set XDG_RUNTIME_DIR out. I agree the original makes more sense, yes - I don't really understand the value in using XDG_RUNTIME_DIR like this at all. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e37542842e9e85c5f6d739803c6286514a3c6fb commit 8e37542842e9e85c5f6d739803c6286514a3c6fb Author: Pacho Ramos <pacho@gentoo.org> AuthorDate: 2022-12-28 09:11:34 +0000 Commit: Pacho Ramos <pacho@gentoo.org> CommitDate: 2022-12-28 09:14:41 +0000 games-arcade/blobwars: update EAPI 6 -> 8 As a side effect it also avoids bug #883799 Bug: https://bugs.gentoo.org/883799 Bug: https://bugs.gentoo.org/887019 Signed-off-by: Pacho Ramos <pacho@gentoo.org> games-arcade/blobwars/blobwars-2.00-r1.ebuild | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Packages where I am observing this issue, on stable amd64: sys-apps/msr-tools-1.3 sys-process/dcron-4.5-r2 And out-of-tree www-client/palemoon::palemoon The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=257fc52ad8a0d9fa867ed72b9e714dfe5f478555 commit 257fc52ad8a0d9fa867ed72b9e714dfe5f478555 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-05-17 04:00:57 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-05-17 04:01:22 +0000 dev-util/ccache: avoid /run usage (again) Closes: https://bugs.gentoo.org/883799 Closes: https://bugs.gentoo.org/887019 Signed-off-by: Sam James <sam@gentoo.org> dev-util/ccache/ccache-4.8-r2.ebuild | 130 +++++++++++++++++++++ .../ccache/files/ccache-4.8-avoid-run-user.patch | 34 ++++++ 2 files changed, 164 insertions(+) |