Skip to content
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

usage of match-version-number-or-higher.bash non numerical version numbers breaks for option "--usingJamf" when version number contains character "b" #139

Open
katidzehnder opened this issue Apr 22, 2024 · 3 comments

Comments

@katidzehnder
Copy link

match-version-number-or-higher.bash is misusing character "b" du substitute | to beak the regex into pieces: maybe replace with "ZZ" or a less common character than b

match-version-number-or-higher.bash:

line 357: 		regex_end=$( /usr/bin/sed "s/|/b/" <<< ${regex_end} )
line 381: 		regexString=$( /usr/bin/awk -F "b" -v divider=$(( aBreak + 1 )) '{ print $divider }' <<< "$dividedRegex" )

example with current Spotify that gets wrong output:
./match-version-number-or-higher.bash -j 1.2.35.663.gb699649e

@grahampugh
Copy link
Collaborator

Thanks for that. As these lines were inherited from the source script https://gist.github.com/talkingmoose/2cf20236e665fcd7ec41311d50c89c0e, I've asked about the choice of b in the comments in case there was some specific reason I'm not sure about. I'm not really sure why the | needs to be substituted at all.

grahampugh added a commit that referenced this issue Apr 23, 2024
@grahampugh
Copy link
Collaborator

This should be fixed now, I substituted b for ±.

% ./match-version-number-or-higher.bash -j -q 1.2.35.663.gb699649e
^(\d{2,}.*|[2-9].*|1\.\d{2,}.*|1\.[3-9].*|1\.2\.\d{3,}.*|1\.2\.[4-9]\d{1,}.*|1\.2\.3[6-9].*|1\.2\.35\.\d{4,}.*|1\.2\.35\.[7-9]\d{2,}.*|1\.2\.35\.6[7-9]\d{1,}.*|1\.2\.35\.66[4-9].*)$
^(1\.2\.35\.663\.gb\d{7,}.*|1\.2\.35\.663\.gb[7-9]\d{5,}.*|1\.2\.35\.663\.gb699[7-9]\d{2,}.*|1\.2\.35\.663\.gb6996[5-9]\d{1,}.*|1\.2\.35\.663\.gb699649e.*)$

@katidzehnder
Copy link
Author

thanks a lot. it works now.
The b was probably used because the script does only check for numbers and nonnumericals are handled like the number 9. as it is so rare to have characters relevant in version number, it is fine to leave the regex to compare numbers and ignore characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants