From 805c8f0ebc64db2d9c575f6b71c4f8acf22864b6 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 11 Apr 2023 07:39:35 -0700 Subject: [PATCH] Make set{Executable,Readable} noops in WindowsFileSystem Windows does not have the concept of readable or executable files, so these calls would eventually end up in noop calls. Making them noops right away skips an unnecessary existence check. Closes #18005. PiperOrigin-RevId: 523398137 Change-Id: I6f40f9bff94524a73cfa2f01a674bc086a845e23 --- .../build/lib/windows/WindowsFileSystem.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java b/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java index 30afecc1c2415f..5055817ba5b17b 100644 --- a/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java +++ b/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java @@ -221,6 +221,18 @@ protected boolean isDirectory(PathFragment path, boolean followSymlinks) { return super.isDirectory(path, followSymlinks); } + @Override + protected void setReadable(PathFragment path, boolean readable) { + // Windows does not have a notion of readable files. + // https://github.com/openjdk/jdk/blob/e52a2aeeacaeb26c801b6e31f8e67e61b1ea2de3/src/java.base/windows/native/libjava/WinNTFileSystem_md.c#L473-L476 + } + + @Override + protected void setExecutable(PathFragment path, boolean executable) { + // Windows does not have a notion of executable files. + // https://github.com/openjdk/jdk/blob/e52a2aeeacaeb26c801b6e31f8e67e61b1ea2de3/src/java.base/windows/native/libjava/WinNTFileSystem_md.c#L473-L476 + } + /** * Returns true if the path refers to a directory junction, directory symlink, or regular symlink. *