Repository navigation
scripts: Fix portability issues in asmap-verify (BSD diff and GPG) - #76
Conversation
jurraca
left a comment
There was a problem hiding this comment.
Nice, thanks. Tested and confirmed behavior on Linux.
Would've been better as two commits but not a big deal in this case.
Would like some Mac users to test and confirm.
| # shellcheck disable=SC2206 | ||
| GPG_ARRAY=($GPG) |
There was a problem hiding this comment.
https://www.shellcheck.net/wiki/SC2206 indicates this is just in order to avoid having to add quotes. Is there some reason quotes would not work here? Opting for the comment instead seems more verbose.
| # shellcheck disable=SC2206 | |
| GPG_ARRAY=($GPG) | |
| GPG_ARRAY=("$GPG") |
hodlinator
left a comment
There was a problem hiding this comment.
ACK 6dd482a
Would prefer if the commits were squashed.
- Use BSD/POSIX-compatible 'diff -s' instead of GNU-only 'diff --report-identical' so asmap-verify works on macOS/BSD. - Allow overriding the GPG binary via the GPG environment variable (defaulting to 'gpg') to support systems using gpg2 or custom paths. Co-authored-by: hodlinator <172445034+hodlinator@users.noreply.github.com>
6dd482a to
9532c86
Compare
|
Squashed into a single commit (no functional changes). |
hodlinator
left a comment
There was a problem hiding this comment.
re-ACK 9532c86
Thanks for the squash!
Done, the current version works just as well but the problems that this fixes are mostly non-existent on mac.
It is supported by my mac version.
My homebrew didn't do that. This still seems fine to merge as a mild improvement, even though the problems don't seem to appear as widely as stated in the description. |
This PR addresses two portability issues in
asmap-verifyto improve compatibility across environments:Replace GNU-specific
diff --report-identicalwithdiff -sThe script currently uses the long flag
--report-identical, which is not supported by the default BSDdifffound on macOS and FreeBSD (resulting in an "illegal option" error). It has been replaced with the equivalent short flag-s, which is supported natively across BSD, macOS, and GNU environments while preserving the identical file output logging.Respect
$GPGenvironment variable overridesCurrently,
asmap-verifyhardcodes thegpgbinary, which causes failures for users whose package managers (e.g., Homebrew) install GnuPG v2 asgpg2. This PR brings the logic into alignment withasmap-attestby defaulting togpgbut respecting the$GPGenvironment variable, safely parsing it for tool validation.