-
Notifications
You must be signed in to change notification settings - Fork 45
Panic in semantic version parsing #263
Comments
Updating the version in packaging metadata is one thing, but why is Debian modifying upstream's version while compiling? |
In the debian/rules file, various build flags are overridden with local values:
This in itself is curious, because variables such a $USER and $BUILD_DATE will break Debian's attempts to ensure reproducible builds.... Although the Prometheus developers have to assume some of the blame on that one, for including such obviously changeable metadata in an end-result binary. |
Unsee supports a range of Alertmanager versions, and maps between the Alertmanger format and the internal Unsee format using mappers. It determines what mapper to use by parsing the Alertmanager version on the assumption it's semver compatible. Some distributions of Alertmanager append distribution specific metadata to this version string, which the semver package isn't tolerant of. This CL creates an internal semver package that sits between Unsee and the upstream semver package. On calls to `MustParse` it first attempts to strip the distribution metadata by tossing out everything after the first tilde. Bug: #263 Change-Id: I64e66af9ebfe82ae9e55d72f4a049d645a9de299
Unsee supports a range of Alertmanager versions, and maps between the Alertmanger format and the internal Unsee format using mappers. It determines what mapper to use by parsing the Alertmanager version on the assumption it's semver compatible. Some distributions of Alertmanager append distribution specific metadata to this version string, which the semver package isn't tolerant of. This CL creates an internal semver package that sits between Unsee and the upstream semver package. On calls to `MustParse` it first attempts to strip the distribution metadata by tossing out everything after the first tilde. Bug: #263 Change-Id: I64e66af9ebfe82ae9e55d72f4a049d645a9de299
Hey, The main reason to change these fields is actually reproducibility. Both USER and BUILD_DATE are reproducible because they are set in the The tilde itself is added because this is an release candidate. 0.15-rc.1 would sort as higher than 0.15, so we don't want that. The tilde sorts in a special way such that 0.15~rc.1 is lower than 0.15, but this is important only for the package version. If there is a way to have semver interpret the RC correctly, i can change the metadata that is exposed in the API to fix this issue. |
@TheTincho I don't disagree that you could (and should) use the additional metadata in packaging, I was just surprised to see it passed through to the binary. Minor differences in packaging beliefs, no big deal. I've submitted a CL that trims everything after the tilde before parsing as a semver. I'm happy to extend that to other forms for other distributions. To answer your question, the semver way to encode this would be "0.15.0-rc.1", which is earlier than "0.15.0". Unfortunately, this conflicts with debian-revision, thus your tilde. Hopefully we'll never have to worry about epochs. |
Hi Terin, thanks for replying. I checked the CL, and I think that patch is not a good idea, because the tilde is not a packaging version. That is what is after the dash in the Debian standard: If you wanted to support this in semver, the correct way would be to interpret it as a pre-release, just like with the dash. You don't need to worry about epochs (because that is also packaging only), and I can just de-mangle the upstream version to -rc.2. I had not thought before anybody would be parsing this, and knowing now how semver interprets it, I think it is the proper thing to do. |
@TheTincho If you don't mind making that change, I can abandon the CL. @dswarbrick How does this sound for you? |
I have just uploaded another snapshot with this change. |
I'm testing @TheTincho's 0.15.0~rc.2+ds-1 package, and Unsee is working fine with this. |
I'm going to go ahead and close this and abandon the CL. |
Debian sometimes like to append git commit IDs to package versions, and this is resulting in a panic when Unsee tries to parse the version:
I realize that this is technically not a bug in Unsee, rather in blang/semver, but perhaps Unsee could offer a workaround?
The text was updated successfully, but these errors were encountered: