You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be reasonable for ccache not to try moving special files around even in CCACHE_HARDLINK=1 mode (or maybe handle /dev/null in a special way that does not require writes into target). Or should this behaviour be declared Intended Behaviour?
Thanks!
The text was updated successfully, but these errors were encountered:
When hard link mode is enabled, ccache ≥3.6 unlinks the output file
before writing to it as a workaround for a bug in Clang (ccache#331). This
unfortunately means that /dev/null will be removed when building as root
(don’t do that, BTW) with hard link mode enabled and /dev/null as the
the output file.
Fix this by disabling hard link mode if the output object file is
/dev/null and by not copying cached output to /dev/null at all, thus not
triggering unlink-before-write for other files (e.g. dependency file) as
well. (There is no need to handle other non-regular output files since
/dev/null is the only allowed non-regular output file.)
Fixesccache#564.
jrosdahl
added a commit
to jrosdahl/ccache
that referenced
this issue
Mar 22, 2020
When hard link mode is enabled, ccache ≥3.6 unlinks the output file
before writing to it as a workaround for a bug in Clang (ccache#331). This
unfortunately means that /dev/null will be removed when building as root
(don’t do that, BTW) with hard link mode enabled and /dev/null as the
the output file. A similar problem exists if the dependency file is
/dev/null, regardless of hard link mode.
Fix this by not unlinking the output file if it’s /dev/null and by not
copying files to /dev/null at all. (There is no need to handle other
non-regular output files since /dev/null is the only allowed non-regular
output file.)
Fixesccache#564.
jrosdahl
added a commit
to jrosdahl/ccache
that referenced
this issue
Mar 22, 2020
When hard link mode is enabled, ccache ≥3.6 unlinks the output file
before writing to it as a workaround for a bug in Clang (ccache#331). This
unfortunately means that /dev/null will be removed when building as root
(don’t do that, BTW) with hard link mode enabled and /dev/null as the
the output file. A similar problem exists if the dependency file is
/dev/null, regardless of hard link mode.
Fix this by not unlinking the output file if it’s /dev/null and by not
copying files to /dev/null at all. (There is no need to handle other
non-regular output files since /dev/null is the only allowed non-regular
output file.)
Fixesccache#564.
It's an upstream variant of bug https://bugs.gentoo.org/712080 observed and debugged by Dan Goodliffe on
ccache-3.7.7
There user runs kernel build as root in a container (or on real machine) and observes
/dev/null
to be replaced by regular file.Trigger command:
CCACHE_HARDLINK=1 /usr/lib/ccache/bin/cc -Werror -Wmaybe-uninitialized -S -x c /dev/null -o /dev/null
Kernel's build ssystem probably just probes flag support and redirects unused output to /dev/null.
On my system
strace
confirmsrename
attempt. It fails to damage my system only because/dev/null
is a mountpoint for me:In upstream bug user observed successful
rename()
:Would it be reasonable for
ccache
not to try moving special files around even inCCACHE_HARDLINK=1
mode (or maybe handle/dev/null
in a special way that does not require writes into target). Or should this behaviour be declared Intended Behaviour?Thanks!
The text was updated successfully, but these errors were encountered: