Bug 9801 - CCACHE_BASEDIR does not work well with softlinks
Summary: CCACHE_BASEDIR does not work well with softlinks
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.1.8
Hardware: x64 Linux
: P5 normal
Target Milestone: 3.1.10
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
Depends on:
Reported: 2013-04-16 20:00 UTC by Andrew Stubbs
Modified: 2014-10-19 18:35 UTC (History)
0 users

See Also:

Fix path canonicalization in make_relative_path when path doesn't exist (3.46 KB, patch)
2013-08-08 16:07 UTC, Joel Rosdahl
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Stubbs 2013-04-16 20:00:26 UTC
Steps to reproduce:

1. ln -s /path/to/ccache/src /tmp/link

2. cd /tmp/link

3. ./test.sh

Test "set CCACHE_BASEDIR" will fail.

The problem command line, extracted from the test script is:

CCACHE_BASEDIR=/tmp/link/testdir.3135/dir1 \
    /tmp/link/ccache gcc -I/tmp/link/testdir.3135/dir1/include -c src/test.c

All tests pass if run directly from the source directory.

I've not yet figured out why this happens, but what the test script is doing looks reasonable. I'll post more when I've looked closer.
Comment 1 Joel Rosdahl 2013-08-08 16:07:20 UTC
Created attachment 9116 [details]
Fix path canonicalization in make_relative_path when path doesn't exist

Hi Andrew,

When I try the reproduction recipe, it's the "-MF/-MQ/-MT with absolute paths" test that fails:

    % ln -s ~/code/ccache/ccache /tmp/ccachelink
    % cd /tmp/ccachelink
    % ./test.sh basedir
    starting testsuite basedir
    SUITE: "basedir", TEST: "-MF/-MQ/-MT with absolute paths" - Expected "cache hit (direct)" to be 1, got 0
    cache directory                     /tmp/ccachelink/testdir.5824/.ccache
    cache hit (direct)                     0
    cache hit (preprocessed)               0
    cache miss                             2
    files in cache                         6
    cache size                            24 Kbytes
    max cache size                       1.0 Gbytes
    Test data and log file have been left in testdir.5824

Anyway, could you try the attached patch and see if it fixes the problem for you as well?
Comment 2 Joel Rosdahl 2013-08-08 20:07:57 UTC
Committed in a9dc850d06ecb6aa3b15c4afaadc4cc0300d794a on the maint branch.
Comment 3 Joel Rosdahl 2014-10-19 18:35:57 UTC
Fix included in v3.1.10.