Skip to content

Keep the executable bit on empty input files in the directory cache - #3161

Open
rajputdivyanshu81 wants to merge 1 commit into
TraceMachina:mainfrom
rajputdivyanshu81:fix/empty-executable-input
Open

rajputdivyanshu81 wants to merge 1 commit into
TraceMachina:mainfrom
rajputdivyanshu81:fix/empty-executable-input

Conversation

@rajputdivyanshu81

Copy link
Copy Markdown
Contributor

What and why

The worker's directory cache wrote a zero-length input file and returned before the executable handling, so an empty FileNode with is_executable set (an empty stub script or wrapper) was materialized without +x. REAPI FileNode.is_executable says the file is executable; its size does not change that. The empty-file shortcut now sets the same read-only mode as any other private copy (0o555 executable, 0o444 otherwise), through a helper shared with the non-empty path.

Refs #3117

How was this verified?

New test empty_executable_input_keeps_its_executable_bit materializes an empty executable and an empty data file and checks their modes; it fails without the change. It is Unix-only, so CI is its first run: I developed on Windows, where the other 17 directory_cache_test tests pass (evict_with_directory_entry fails there on main too, because creating a symlink on Windows needs a privilege).

Risk

Low. Only zero-byte input files change: executables now get +x, and other empty files become read-only like every other input.

AI assistance

Claude Code found this during a REAPI conformance audit, made the change and wrote the test. I reviewed every line.

@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nativelink Ready Ready Preview Nov 10, 2026 6:09pm UTC
nativelink-aidm Ready Ready Preview Nov 10, 2026 6:09pm UTC

Request Review

The directory cache wrote a zero-length input file and returned before the
executable handling, so an empty FileNode with is_executable (an empty stub
script or wrapper) was materialized without +x. REAPI FileNode.is_executable
says the file is executable; its size does not change that. The empty-file
shortcut now sets the same read-only mode as any other private copy, via a
helper shared with the non-empty path.

Refs TraceMachina#3117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
Preview – nativelink — cf3cc474 Deployed Nov 10, 2026 by vercel[bot]
Preview – nativelink-aidm — cf3cc474 Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant