Skip to content

fix(hash_cache): only take user execute bits into account#96

Merged
sitaktif merged 1 commit intobazel-contrib:mainfrom
sitaktif:hash-execute-bit-only
Dec 4, 2024
Merged

fix(hash_cache): only take user execute bits into account#96
sitaktif merged 1 commit intobazel-contrib:mainfrom
sitaktif:hash-execute-bit-only

Conversation

@sitaktif
Copy link
Copy Markdown
Collaborator

@sitaktif sitaktif commented Nov 29, 2024

There are some cases where files are initially created with some permissions (e.g. 775) but are then created by git with different permissions (e.g. 755) when cloning, checking out a branch or creating a worktree. Such differences don't matter to git nor to Bazel; consequently, they should not change the hash of a source file in target-determinator.

The execute bit for ther user (e.g. 744 vs 644) does matter, though, and should be part of the hash.

--

This fixes an issue where TD would spuriously mark targets as changed when they depend on a file that has e.g. 664 permission, and the umask is 022 (the default), when TD uses a git subtree to hash the before state.

There are some cases where files are initially created with some
permissions (e.g. 775) but are then created by git with different
permissions (e.g. 755) when cloning, checking out a branch or creating a
worktree. Such differences don't matter to git nor to Bazel;
consequently, they should not change the hash of a source file in
target-determinator.

The execution bit for ther user (e.g. 744 vs 644) does matter, though,
and should be part of the hash.
@sitaktif sitaktif force-pushed the hash-execute-bit-only branch from 050b2d7 to 699e68e Compare November 29, 2024 14:50
Copy link
Copy Markdown
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems generally reasonable, and remember hitting this bug one time before! Thanks for fixing!

@sitaktif sitaktif merged commit 5bfae36 into bazel-contrib:main Dec 4, 2024
@sitaktif sitaktif deleted the hash-execute-bit-only branch December 4, 2024 16:40
@sitaktif sitaktif mentioned this pull request Feb 6, 2025
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.

3 participants