Steps to reproduce:
1. ln -s /path/to/ccache/src /tmp/link
2. cd /tmp/link
Test "set CCACHE_BASEDIR" will fail.
The problem command line, extracted from the test script is:
/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.
Created attachment 9116 [details]
Fix path canonicalization in make_relative_path when path doesn't exist
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?
Committed in a9dc850d06ecb6aa3b15c4afaadc4cc0300d794a on the maint branch.
Fix included in v3.1.10.