Use install -m 755 for explicit binary mode#247
Open
tejaskochar-db wants to merge 1 commit into
Open
Conversation
Under restrictive umasks such as 0027, `chmod +x` + `cp` produces a 0750 binary. When installed via sudo, the binary is owned by root, leaving non-root users unable to execute it. `install -m 755` sets the mode atomically and ignores umask. Co-authored-by: Isaac
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The script currently sets the binary mode in two steps:
chmod +x ./databricks cp ./databricks "$TARGET"Under restrictive umasks such as 0027, this leaves the installed binary at mode 0750 instead of 0755 — non-root users cannot execute it.
Two compounding causes:
chmod +xwithout au/g/o/aactor letter is umask-aware: under 0027 it addsxonly for owner and group, producing 0750.cpwithout-pfurther masks the resulting mode through umask, so even a 0755 source would land as 0750.This patch replaces both lines with:
install -m 755 ./databricks "$TARGET/"install -m 755sets the mode atomically and ignores umask — the standard pattern for installer scripts.Verified that the binary lands as 0755 under umask 0027 and that a non-root user can execute it after
sudo sh install.sh.