Version comparisons in Python Munki vs Swift Munki

17 views
Skip to first unread message

Gregory Neagle

unread,
Apr 1, 2026, 9:25:05 PM (14 days ago) Apr 1
to munki-dev, munki-discuss
For context if what I’m writing about here, see: https://github.com/munki/munki/issues/1344

As it turns out, for this particular case, the Python version of Munki compares the two values differently than does the Swift version of Munki. Specifically:

In the Python version of Munki:
"8.0 (build 6300)” compares as higher than "8.0.1 (build 6301)”

In the Swift version of Munki:
"8.0 (build 6300)” compares as lower than "8.0.1 (build 6301)”

There are multiple issues here:

1) Neither version is a well-formed valid version string (which defined as a series of integers separated by periods), and so the result of a comparison where one or more string is not actually a valid version string is undefined.

2) The Swift result is actually what a human would likely consider “correct”.

3) The fact that Munki 7 compares these strings differently than prior versions of Munki is arguably a bug/issue/undesired behavior.

So: 

A) Should I leave it alone (with maybe a note somewhere that comparisons of non-well-formed version strings may differ), or 
B) Should I modify the implementation of MunkiVersion in the Swift code to match Python’s behavior here?

I’m leaning towards leaving it alone, but welcome other thoughtful opinions.

-Greg

Allister Banks

unread,
Apr 1, 2026, 9:35:50 PM (14 days ago) Apr 1
to munk...@googlegroups.com
Revising the swift code so it resumes evaluation in a way that a computer thinks is right vs what a human understands as ‘wrong’ seems undesirable. As long as the swift behavior is expected and consistent I see no downside in leaving it as-is.
Allister

Alan

unread,
Apr 1, 2026, 10:41:56 PM (14 days ago) Apr 1
to munk...@googlegroups.com
I'm also in favor of leaving it as is. Perhaps we could make a note about it in the Munki wiki, in case someone sees the discrepancy and asks about it?

On Wed, Apr 1, 2026 at 6:35 PM Allister Banks <a...@aru-b.com> wrote:
Revising the swift code so it resumes evaluation in a way that a computer thinks is right vs what a human understands as ‘wrong’ seems undesirable. As long as the swift behavior is expected and consistent I see no downside in leaving it as-is.
Allister

--
Find related discussion groups here:
https://github.com/munki/munki/wiki/Discussion-Group
---
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/munki-dev/B3F38CA8-FE3B-49E6-9E20-73A5412FA240%40aru-b.com.

Nick McSpadden

unread,
Apr 1, 2026, 11:17:00 PM (14 days ago) Apr 1
to munk...@googlegroups.com
Fourthed on leaving it as-is. Nonstandard/"non-traditional" version comparison should be stated as a potentially undefined behavior somewhere in the wiki and the admin should be prepared to consider alternatives.



--
--
Nick McSpadden
nmcsp...@gmail.com

Vaughn Miller

unread,
Apr 2, 2026, 9:05:24 AM (13 days ago) Apr 2
to munk...@googlegroups.com
Another vote for leaving as is.   I tend to treat it as lucky happenstance when version strings like this actually work as a human would expect.

It is good to know that the swift an python comparisons differ.

Vaughn

Elliot Jordan

unread,
Apr 2, 2026, 11:40:27 AM (13 days ago) Apr 2
to munk...@googlegroups.com

Gregory Neagle

unread,
Apr 2, 2026, 12:22:11 PM (13 days ago) Apr 2
to munki-dev
Reply all
Reply to author
Forward
0 new messages