-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update install.sh to use /usr/bin/stat #849
Conversation
Using customized stat in $PATH can be in conflict with standard.
@@ -160,7 +160,7 @@ then | |||
fi | |||
HOMEBREW_CACHE="${HOME}/Library/Caches/Homebrew" | |||
|
|||
STAT_PRINTF=("stat" "-f") | |||
STAT_PRINTF=("/usr/bin/stat" "-f") |
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.
In practice this should always be right, but I can't find a good POSIX/similar source that asserts that stat
is always at /usr/bin/stat
. Then again maybe this doesn't matter, since we assume similar things for chown
and chgrp
below.
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.
I checked the file list for all the distros we advertise support for (Debian, Ubuntu, Fedora, CentOS, Red Hat, Arch). In all cases stat
is provided by coreutils and present at /usr/bin/stat
. I agree though, we don't necessarily have a guarantee it'll always be provided there in every distro; for example, alpine's busybox lives in /bin
.
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.
To be more compatible perhaps someone could enhance this (and others if necessary ) to include something like:
UTILDIR ='/usr/bin'
if [ ! -x $UTILDIR/stat ]; then UTILDIR='/bin' ; fi
STAT_PRINTF=("$UTILDIR/stat" "-f")
...
STAT_PRINTF=("$UTILDIR/stat" "--printf")
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.
It's fine as-is until someone complains.
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.
Thanks @DG12 for the PR and @mistydemeo for the research!
Using customized stat in $PATH can be in conflict with standard.