Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 158177 - sys-apps/portage-2.1.2_rc3-r5 sandbox violations with custom CCACHE_DIR
Summary: sys-apps/portage-2.1.2_rc3-r5 sandbox violations with custom CCACHE_DIR
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 147007
  Show dependency tree
 
Reported: 2006-12-14 16:53 UTC by Horst Schirmeier
Modified: 2006-12-16 17:19 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Horst Schirmeier 2006-12-14 16:53:00 UTC
The following is true for sys-apps/portage-2.1.2_rc3-r5, but I guess earlier versions are affected.

An emerge run aborts with lots of sandbox violations if certain conditions (see below) are met:

--------------------------- ACCESS VIOLATION SUMMARY ---------------------------
LOG FILE = "/var/log/sandbox/sandbox-games-action_-_bzflag-2.0.8-2874.log"

open_wr:   /root/.ccache/stats
unlink:    /root/.ccache/conftest.tmp.nexus.3561.i
open_wr:   /root/.ccache/conftest.tmp.nexus.3561.i
unlink:    /root/.ccache/conftest.tmp.nexus.3561.i
unlink:    /root/.ccache/tmp.cpp_stderr.nexus.3561
[...]

This is reproducible with the following preconditions:

 -  CCACHE_DIR (make.conf) is set to a place outside of normal
    SANDBOX_READ/SANDBOX_WRITE directories (not under /var/tmp or /tmp), for
    example /root/.ccache

 -  FEATURES (make.conf) does not contain "ccache"

 -  dev-util/ccache is installed

 -  a package is emerged that has a configure script which detects and utilizes
    ccache by itself, for example games-action/bzflag

The effect is that the package's configure script detects ccache and adds it to its Makefiles' CC and/or CXX variables; subsequent make runs start ccache (with $CCACHE_DIR still being set), which in turn tries to write to $CCACHE_DIR. As $CCACHE_DIR is not in $SANDBOX_WRITE (or _READ), a sandbox violation is thrown.

This did not happen to default CCACHE_DIR=/var/tmp/ccache users because /var/tmp is normally listed in both $SANDBOX_READ and $SANDBOX_WRITE.

Possible countermeasures in ebuild.sh could be an unconditional

[ -d "$CCACHE_DIR" ] && addwrite "$CCACHE_DIR"

(solar suggested this on #gentoo-portage) and/or

if hasq ccache ${FEATURES} ; then
   [...]
else
        export CCACHE_DISABLE=1
fi

(my own suggestion).
Comment 1 Zac Medico gentoo-dev 2006-12-15 19:52:30 UTC
(In reply to comment #0)
>  -  a package is emerged that has a configure script which detects and utilizes
>     ccache by itself, for example games-action/bzflag

Generally, we frown on configure scripts that do automatic things based on the environment like that.  If one has FEATURES="-ccache", shouldn't the ebuild respect that and disable it?
Comment 2 Horst Schirmeier 2006-12-15 20:23:03 UTC
Well, that was solar's first comment, too. But patching ccache utilization out of every configure script out there could turn into quite some work, I think, and the suggested ebuild.sh modifications would take care of this very well, either.
Comment 3 Zac Medico gentoo-dev 2006-12-15 21:14:25 UTC
(In reply to comment #2)
> Well, that was solar's first comment, too. But patching ccache utilization out
> of every configure script out there could turn into quite some work,

That depends on how common it is.

> I think,
> and the suggested ebuild.sh modifications would take care of this very well,
> either.

I suppose if CCACHE_DIR is exported in the environment then it's a pretty good assumption that the user wants to use it though.  I still don't like it but if it's a common problem with lots of configure scripts then I guess we should do it.
Comment 4 Zac Medico gentoo-dev 2006-12-15 21:23:06 UTC
(In reply to comment #0)
> if hasq ccache ${FEATURES} ; then
>    [...]
> else
>         export CCACHE_DISABLE=1
> fi
> 
> (my own suggestion).

That's done in svn r5302.  Thanks.
Comment 5 Zac Medico gentoo-dev 2006-12-16 17:19:27 UTC
This has been released in 2.1.2_rc3-r6.