7 ms·
I don't understand why -- and do educate me on why I'm wrong -- software don't just use an internal and external version number. Version numbers may have starte
by RJIb8RBYxzAMX9u 6y ago
I don't understand why -- and do educate me on why I'm wrong -- software don't just use an internal and external version number. Version numbers may have started as a technical label with precise meanings, but they've been a part of branding and marketing for a while now. It's futile to fight it[0].
Let the former be a monotonically increasing (say 64-bt) integer, and the latter be a free-form string. This way, marketing folks are free to call one version "macOS 10.16 Big Sur", followed by "macOS 11.0 Big Sur Pro Max", "macOS 10.32 Pro SE", etc. w/o developers pondering over whether "Pro SE" > "Pro Max". As for API, maybe something like getProductVersion() for the internal version, and getProductName() for the external version. Heck, be facetious and let the latter return a string like "!!! DO NOT USE FOR VERSION COMPARISON USE getProductVersion() INSTEAD !!!\07\07\07macOS 10.16 Big Sur".
Yes, lazy developers will get it wrong, similar to how they use gettimeofday()[1] instead of clock_gettime(CLOCK_MONOTONIC, ...)[2]. In their defense, often software switch between versioning conventions such that what's the "right" thing to do is unclear.
[0] Such appropriation is everywhere. Don't get me started on how Porsche Taycan, an electric car, has a "Turbo" model. It probably doesn't even come with blinker fluid standard.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/g...
[2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/c...
- elcomet 6y agoI think that a lot of projects already do this. In particular windows : Windows 95, 98, 2000, XP, Vista, 7,8,9,10 are all external version numbers.
- moron4hire 6y agoAdditionally, they have all of GP's suggested functions.
- rpastuszak 6y agoWhat’s win 9? I thought 9 was the internal version of 10.
- TehCorwiz 6y agoSome software used to check that the version name string started with "Windows 9" to determine if it was running on a "Windows 98" or "Windows 95" system as opposed to 3.x, NT, XP, etc. Yes, there are internal major and minor version numbers available, however that didn't stop people. Ergo, jumping straight to "Windows 10" which would cause software that did this to find "Windows 1" in the string triggering a message like "This program requires at least Windows 95..." or whatever instead of immediately crashing because it made a system call to an API that hasn't existed for 10 years. Or worse, silently corrupting data because of other OS API changes.
- fomine3 6y agoWindows doesn't provide API to get OS product name IIRC but Java provides "os.name" property that returns like "Windows 95". That's bad api to check version but some Java apps use it. https://github.com/AdoptOpenJDK/openjdk-jdk11u/blob/7b9323b12d3c362d88c9de35875c4f320c67b044/src/java.base/windows/native/libjava/java_props_md.c#L486 https://github.com/AdoptOpenJDK/openjdk-jdk11u/blob/7b9323b1...
- TehCorwiz 6y agoThat's probably what I was remembering.
- Kipters 6y agoAFAIK it was Windows 8.2. I came across some early SDK that used both "Threshold" (Win10 codename) and Windows 8.2
- MikeHolman 6y agoThis is somewhat true, but Windows is a perfect example of this not working. There was no Windows 9, because of fear of people using the Windows string name to detect Windows 95/98 (or at least that is the prominent theory).
- mattkevan 6y agoAh, that makes sense. I thought it was because they wanted to go to 10, like Mac OS X. Same as the Xbox 360 was called that because they didn’t want to bring out the Xbox 2 when Sony was bringing out the PS3.
- deberon 6y agoThat doesn’t explain the naming of Xbox One though.
- mortenjorck 6y agoThat name was chosen for the console’s original (if largely abandoned) vision of being a single hub for gaming, live TV, and streaming: https://www.vg247.com/2013/05/28/xbox-one-microsoft-exec-explains-consoles-name/ https://www.vg247.com/2013/05/28/xbox-one-microsoft-exec-exp...
- Kipters 6y agoIt also ties in with Microsoft's "One" line of names: OneDrive, OneNote, OneCore etc
- peterburkimsher 6y agoI also thought it was because of TenVer! "Windows 9x" makes more sense. https://github.com/cube-drone/tenver https://github.com/cube-drone/tenver Like Spinal Tap, now it's time that this one goes to 11.
- ytch 6y agoYes, Microsoft skips windows 9 because some code use "Windows 9" for windows 95/98: https://www.reddit.com/r/technology/comments/2hwlrk/new_windows_version_will_be_called_windows_10/ckwq83x/ https://www.reddit.com/r/technology/comments/2hwlrk/new_wind...
- deleted 6y ago[deleted]
- gok 6y agoYou got the answer right. Software typically does work this way but then people inevitably make the mistake of using the wrong version and then hacks are needed to not break those apps.
- waddlesplash 6y agoWhile I generally agree with your comment, I also find it ironic that one of the POSIX APIs you chose to use as an example of API misusage (clock_gettime) is ... not available on macOS.
- RJIb8RBYxzAMX9u 6y agoIt's been added since macOS 10.12 (Sierra). According to my man page. Couldn't find any authoritative sources online on that, though. However, there are several secondary references[0][1]. [0] https://github.com/zeromq/libzmq/issues/2175 https://github.com/zeromq/libzmq/issues/2175 [1] https://github.com/rust-lang/libc/issues/776 https://github.com/rust-lang/libc/issues/776
- saagarjha 6y agoIt was added in Libc-1158.1.2, which shipped with Sierra: https://github.com/apple-open-source-mirror/Libc/blame/master/gen/clock_gettime.c https://github.com/apple-open-source-mirror/Libc/blame/maste...
- js2 6y agomacOS/iOS have this concept already: CFBundleVersion: The version of the build that identifies an iteration of the bundle. This key is a machine-readable string composed of one to three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion https://developer.apple.com/documentation/bundleresources/in... CFBundleShortVersionString: The release or version number of the bundle. This key is a user-visible string for the version of the bundle. The required format is three period-separated integers, such as 10.14.1. The string can only contain numeric characters (0-9) and periods. https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring https://developer.apple.com/documentation/bundleresources/in... Android similarly has versionName and versionCode. The problem is that no matter what, someone somewhere is going to parse something that was never intended for non-human consumption. Or code ends up making assumptions that it shouldn't about a machine-readable version. I have code which parses CFBundleVersion. It assumes the version follows Apple's docs. But guess what? CFBundleVersion is just a string and nothing enforces Apple's guidance so I was surprised (I shouldn't have been) to have to deal with an internally distributed iOS app that had the word "debug" tacked on to the end of its CFBundleVersion.
- joshstrange 6y agoSmall side note: Android's "versionCode" is an ever-increasing number, you must submit a higher versionCode than your previous build. CFBundleVersion can be set back to 0 with each CFBundleShortVersionString change. Normally I just set both to a build number on whatever CI I use (for something like a cordova cross-platform app) and then increase CFBundleShortVersionString & versionName using the tag name (or a custom version name I give a release).
- lilyball 6y agoCFBundleShortVersionString must increment too though. So if you join “${CFBundleShortVersionString}.${CFBundleVersion}” the whole thing must increment, and this explains why CFBundleVersion can revert when CFBundleShortVersionString increments.
- crooked-v 6y agoAt a previous company, for a very complicated web app with some offline caching aspects, we used the latest git commit hash of each build as a public-facing unique version id in the help menu. This made it dead simple to use proper semver versioning internally without needing to correct user expectations about version numbers, while still having easily tracked unique IDs in bug reports.
- bigiain 6y agoI think Apple's "marketing folks" already do a reasonable job of this with macos - most non-dev people and most (all?) of Apple's consumer facing marketing refer to the OS as "Catalina" or "High Sierra" or "Big Sur". Outside of the sort of people who visit HN, I wonder how many Mac users could tell you what the version number "High Sierra" was?
- eyelidlessness 6y agoThe problem with this is most tech people and mere mortals alike can’t keep the sequence straight. I gave up on trying to even map names to versions and just go to “about” every week or three and provide whichever detail is most useful.
- tomc1985 6y agoMarketing has ruined version numbers with their nonsense. Take it away from them.
- dgellow 6y agoThat's what Windows has. The internal version is the build number: Windows 3.1 - Build 103 Windows 95 - Build 950 Windows NT - Build 1381 Windows 98 - Build 2222A Windows 2000 - Build 2195 Windows XP - Build 2600 Windows Vista - Build 6002 Windows 7 - Build 7601 Windows 8 - Build 9200 Windows 10 (1909) - Build 18363 Windows 10 (2004) - Build 19041 Source: https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_vers...
- saagarjha 6y agomacOS used the build number this way too.
- account42 6y agoYet Windows plays the same game of pretending to be an older version to older software.
- Kipters 6y agoThat's because developers have written and still write incorrect software that relies on the external version number. It's also the reason Windows lies about its build number unless you add magic (read: not deterministic) GUIDs to your apps' manifest. Raymond Chen's blog[0] has tons of stories about this kind of bugs. [0]: https://devblogs.microsoft.com/oldnewthing/ https://devblogs.microsoft.com/oldnewthing/
- tinus_hn 6y agoIt is how you want it to be. The marketing name is Big Sur. The version is 11.0.0. There is meaning to the separate numbers in the version, there’s a guarantee they aren’t going to remove api if the third number increases but they might if the second one increases. The first one only increases with truly big changes such as this move to ARM. Using an integer doesn’t work because point releases where the third number increases are not monotonous, 10.15.20 might be released while 11.0.0 is already out. Apple does maintain the previous release with security updates while there already is a newer current release. Note that Windows is a big mess with Windows 10 build 2004 (because they want to avoid confusion with Server 2003) which is version 19041.329, or perhaps 10.0.19041.329. It’s almost the same scheme but with large numbers you can’t remember and are hard to find in the documentation.
- yencabulator 6y agoA couple of decades back, our product was always internally <codename>.<buildnumber>, where parallel codenames would exist when multiple versions were supported or in development (think "1.x" and "2.x"). What was displayed to the user was hex-edited into the CD image after it passed QA, according to the whims of marketing, and we treated it as pure text.