Bug 736533 - ccache is not a safe replacement for /usr/bin/cc if anything tries doing a compile without a writable home directory
Summary: ccache is not a safe replacement for /usr/bin/cc if anything tries doing a co...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: ccache
Version: 15
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-08 00:16 UTC by Jonathan Abbey
Modified: 2012-08-07 19:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-07 19:10:38 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jonathan Abbey 2011-09-08 00:16:14 UTC
Description of problem:

ccache fails out if it is run as 'cc' without a writable home directory.  This breaks the automatic kernel builds done by the RPMFusion group's akmods tool, which attempts to run builds as the 'akmods' user with a non-writable /var/cache/akmods home directory.

Version-Release number of selected component (if applicable):

3.1.4

How reproducible:

Attempt to do an akmods build of an kind with ccache installed.

Steps to Reproduce:
1.
2.
3.
  
Actual results:

Tears.

Expected results:

A shiny new nvidia-kmod, or what-have-you.

Additional info:

I've filed a bug report with the akmods folks at RPMFusion, but having something like ccache put before /usr/bin/cc in the default PATH is very problematic unless it can fail safely in the absence of a writable home directory.

I would argue that ccache should behave identically to /usr/bin/cc even in the case of a non-writable home directory, or else ccache should not be set as the default cc when the development-tools meta package is installed in Fedora.

Note that this is only a problem with akmods because it uses a non-root account for doing its builds.  If a root process attempted this, it would have used /var/cache/ccache successfully, but this is not achievable by a non-root script such as akmodsbuilder.

Comment 1 Joel Rosdahl 2011-09-11 19:03:49 UTC
This will be fixed in ccache 3.1.7.

Comment 2 Ville Skyttä 2012-01-08 15:35:13 UTC
(In reply to comment #1)
> This will be fixed in ccache 3.1.7.

It doesn't seem to be fixed in 3.1.7:

$ cd /tmp
$ cat foo.cc 
#include <cstdio>
void foo() {printf("Hello, world\n");}
$ export HOME=/root # non-readable, non-writable
$ unset CCACHE_DIR

$ /usr/bin/g++ -c -o foo.o foo.cc
(no stdout/err output, no problems)

$ ccache /usr/bin/g++ -c -o foo.o foo.cc
ccache: failed to create /root/.ccache (Permission denied)


3.1.7 mentions some changes related to unwritable CCACHE_DIR when CCACHE_READONLY is set, but it doesn't seem to affect this scenario:

$ CCACHE_READONLY=1 ccache /usr/bin/g++ -c -o foo.o foo.cc
ccache: failed to create /root/.ccache (Permission denied)

Comment 3 Joel Rosdahl 2012-01-09 20:07:49 UTC
My bad. However, I'm torn about what to do with this. On one hand, I'd like ccache to be backward compatible, but on the other hand, I'd like ccache to have good defaults. I think that complaining about failure to create things in the cache directory is a good default, because otherwise the effects of misconfiguration will be silently hidden.

I'll start a discussion on the ccache mailing list for more feedback.

Comment 4 Fedora End Of Life 2012-08-07 19:10:40 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


Note You need to log in before you can comment on or make changes to this bug.