Closed AlexanderLanin closed 4 years ago
The second compilation (the one after "Check that read-only mode finds the cached result") in the Cache hit test case in SUITE_readonly is expected to log something like this:
[2020-01-19T19:58:57.329469 23099] Result: cache hit (preprocessed) [2020-01-19T19:58:57.329556 23099] lockfile_acquire: symlink /path/to/.ccache/0/stats.lock: Permission denied [2020-01-19T19:58:57.329597 23099] Failed to acquire lock /path/to/.ccache/0/stats.lock
But in your case it's
[2020-01-16T11:06:40.227522 28597] Result: cache hit (preprocessed) [2020-01-16T11:06:40.227738 28597] Acquired lock /mnt/c/Git/ccache/testdir.16087/.ccache/1/stats.lock
followed by
ccache: error: failed to rename /mnt/c/Git/ccache/testdir.16087/.ccache/1/stats.tmp.Rehbock.28597.KHGUJs to /mnt/c/Git/ccache/testdir.16087/.ccache/1/stats
to stdout. So it looks like WSL either lies about the symlink creation in lockfile_acquire
or it actually creates a symlink even though the directory is (should be) read-only. In any case, ccache believes that it acquired the lock, proceeds to write a temporary file (which succeeds) and then fails when trying to rename it to the (existing) .ccache/1/stats
file, which I guess is read-only.
I don't know anything about WSL (I had to DuckDuckGo it), but from the observations above I guess that chmod -R dir
only makes existing files in dir
read-only, not directories? If so, it's a bad file system emulation.
Since I don't have handy access to a Windows machine, could you check if #516 fixes the problem you see?
With #516:
Running test suite readonly... FAILED
Test suite: readonly Test case: Cache hit, direct Failure reason: Read-only mode + direct mode stored files in the cache
[...]
I guess those are the lines in question:
Result: cache hit (preprocessed) Acquired lock /mnt/c/Git/ccache/testdir.1814/.ccache/1/stats.lock Error: failed to rename /mnt/c/Git/ccache/testdir.1814/.ccache/1/stats.tmp.Rehbock.14665.M4SLDf to /mnt/c/Git/ccache/testdir.1814/.ccache/1/stats Releasing lock /mnt/c/Git/ccache/testdir.1814/.ccache/1/stats.lock Unlink /mnt/c/Git/ccache/testdir.1814/.ccache/1/stats.lock === CCACHE 3.7.1+336_gb2f22c2 STARTED =========================================
However your chmod remark was interesting, so I just tried it with surprising results. In default WSL1 settings (which is what everyone has at the moment) chmod is a no-op. Yeah really!
This was already fixed, but not made default as documented in https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/
With this the test suite runs through!
So I'd suggest to take up 1-2 approaches:
After some thought it should probably behave as other tests which are skipped when not executable?!
if(WSL detected
and chmod failed
) skip_readonly_test
Right, so bad file system emulation it is. :slightly_smiling_face:
Yes, skipping the test if the chmod didn't actually make the cache read-only sounds good.
How to reproduce
/mnt/c/Git/ccache$ git checkout origin/master
/mnt/c/Git/ccache$ git clean -dxf
/mnt/c/Git/ccache$ ./autogen.sh
/mnt/c/Git/ccache$ ./configure
make test -j8
Actual behavior
Expected behavior
Some green result :-)
Environment
current ccache from github master, WSL1 with Ubuntu 18.04.1 LTS