-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify executable checking to be more universal #76607
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my only misgiving here is that when I first read this, I spent a while wondering about why its looking at the
group
andothers
bits at all, and about what scenarios could arise here. (example questions: Does owner alone not suffice? Is there any scenario where we could get an exec-bit set for group and/or others, and not owner, and yet we would still expect things to continue to work? Because the logic as written here seems to imply that interpretation of matters...)I don't really know the best way to fix this, or if it really is something to fix at all. I figure the code as written is probably just playing it safe (no one ever got fired for taking the OR of all three triads, right?). But I would be curious if there is actually a scenario that its anticipating, and if so, maybe a comment here is warranted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I guess given the first context where this is called, namely a check if the filesystem is magically treating fresh created files as executable, the OR of all the triads does make sense to me.
Update: And for the second context, where we are trying to detect a binary that has been checked into git... well, I guess that was the logic that was already there, so we might assume that's doing the right thing.
(I might rename the method to
is_any_triad_executable
, though, to make that clear.)