Repository navigation
scripts: Fix portability issues in asmap-verify (BSD diff and GPG) - #76
Open
AlphaSparrow wants to merge 1 commit into
Open
AlphaSparrow wants to merge 1 commit into
AlphaSparrow wants to merge 1 commit into
Conversation
This fixes two bugs that prevent macOS users (and anyone using GPG v2) from successfully running the verification script: - Uses the BSD/GNU-compatible short flag \-s\ instead of the GNU-only \diff --report-identical\ long flag, preserving identical file output logging without breaking on macOS. - Sources the GPG binary from the environment variable (if set), safely stripping flags for validation and mimicking the logic in \�smap-attest\.
jurraca
approved these changes
Oct 8, 2026
jurraca
left a comment
Collaborator
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.
hodlinator
reviewed
Oct 9, 2026
Comment on lines
+39
to
+40
| # shellcheck disable=SC2206 | ||
| GPG_ARRAY=($GPG) |
Contributor
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.
Suggested change
| # shellcheck disable=SC2206 | |
| GPG_ARRAY=($GPG) | |
| GPG_ARRAY=("$GPG") |
Comment on lines
+36
to
+41
| check_tools cat diff basename date | ||
|
|
||
| GPG=${GPG:-gpg} | ||
| # shellcheck disable=SC2206 | ||
| GPG_ARRAY=($GPG) | ||
| check_tools "${GPG_ARRAY[0]}" |
Contributor
There was a problem hiding this comment.
Seems sufficient:
Suggested change
| check_tools cat diff basename date | |
| GPG=${GPG:-gpg} | |
| # shellcheck disable=SC2206 | |
| GPG_ARRAY=($GPG) | |
| check_tools "${GPG_ARRAY[0]}" | |
| GPG=${GPG:-gpg} | |
| check_tools cat diff basename date "$GPG" |
This branch has not been deployed
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.
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.