diff options
author | Lukacs Berki <lberki@google.com> | 2015-08-28 07:40:04 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-08-28 09:23:15 +0000 |
commit | 05c5daacd8ffe1051471a6b9453c559aaed698fa (patch) | |
tree | 12fae75b1626e7fcd482e634574764e0f09536ec /src/main/java | |
parent | ff8fb25e9493adc280b458c3409430a5ac011919 (diff) |
Make dangling symlinks in external repositories work to some degree.
This seems to be the least insane approach within the following boundaries:
- Skyframe apparently doesn't allow GlobFunction to recover if FileFunction had already raised an exception that Skyframe knows about (this is somewhat surprising)
- I didn't want to change FileFunction not to throw an exception for dangling symlinks because this part of the code is scary
- I didn't want to revert to Skyframe-based symlink resolution for symlinks in immutable directories because that would be a performance hit
- I didn't want to write yet another symlink resolver and the two existing ones (FileSystem#resolveSymlinks() and and FileFunction#getSymlinkTargetRootedPath()) don't work: the former cannot resolve just one level of symlinks and the latter cannot do its job without adding Skyframe dependencies
I had to put in a placeholder value for realRootedPath when the FileValue represents a dangling symlink, because FileStateValue.create() relies on the symlink target being different than the symlink itself.
RELNOTES:
--
MOS_MIGRATED_REVID=101756189
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java index ecccc075d1..32cce31b85 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/FileFunction.java @@ -99,7 +99,12 @@ public class FileFunction implements SkyFunction { pkgLocator.get().getPathEntries()); realFileStateValue = FileStateValue.create(realRootedPath, tsgm); } catch (IOException e) { - throw new FileFunctionException(e, Transience.TRANSIENT); + RootedPath root = RootedPath.toRootedPath( + rootedPath.asPath().getFileSystem().getRootDirectory(), + rootedPath.asPath().getFileSystem().getRootDirectory()); + return FileValue.value( + rootedPath, fileStateValue, + root, FileStateValue.NONEXISTENT_FILE_STATE_NODE); } catch (InconsistentFilesystemException e) { throw new FileFunctionException(e, Transience.TRANSIENT); } |