Replace find -printf, which does not exist on macOS - #18
Open
bmesuere wants to merge 1 commit into
Open
Conversation
Both scripts listed the configuration directory with
find -H "$(getconfigdir)" -mindepth 1 -maxdepth 1 -printf '%P\n'
-printf is a GNU extension. On macOS, whose find is the BSD one, this fails
with "find: -printf: unknown primary or operator", which broke
umgap-visualize.sh -t outright and left umgap-analyse.sh unable to find any
data version.
Replaced with a small helper using a glob and basename. Its output is
byte-identical to the GNU find command on a directory holding version
directories and a symlink, in the same numeric order, and it lists dangling
symlinks just as find -H did.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Both scripts listed the configuration directory with:
-printfis a GNU extension. macOS ships BSD find, so this fails withfind: -printf: unknown primary or operator. The effects:umgap-visualize.sh -tbroke outright — it could not build a frequency table at all.umgap-analyse.shsilently found no data version, so it reported "No data version found valid for all samples. Please run umgap-setup." even with a perfectly good configuration.Replaced with a small
list_versionshelper using a glob andbasename.Verification
GNU find is installed here as
gfind, so this is a direct comparison rather than a reading of the man page. On a directory containing version directories and a symlink:Identical, including the numeric ordering. Also matched on a dangling symlink, which
find -Hlists and a naive[ -e ]test would have dropped — hence the|| [ -L ].Checked the empty-directory case under
/bin/shwithset -e(whichumgap-visualize.shuses): the unmatched glob stays literal, the guard filters it, output is empty and the exit status is 0.End to end on macOS, both now work: