Version comparisons in Python Munki vs Swift Munki

66 views
Skip to first unread message

Gregory Neagle

unread,
Apr 1, 2026, 9:25:05 PM (10 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
Reply all
Reply to author
Forward
0 new messages