Historical bug tracker for the Pacman package manager.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
FS#49093 - [vercmp] vercmp '' foo reports 1
Attached to Project:
Pacman
Opened by Alad Wenter (Alad) - Tuesday, 26 April 2016, 12:26 GMT
Last edited by Eli Schwartz (eschwartz) - Friday, 19 January 2018, 04:48 GMT
Opened by Alad Wenter (Alad) - Tuesday, 26 April 2016, 12:26 GMT
Last edited by Eli Schwartz (eschwartz) - Friday, 19 January 2018, 04:48 GMT
|
DetailsRunning vercmp with the first argument an empty string, and the second an argument starting with a letter, results in 1:
% vercmp '' r123.foo 1 While no argument is -1: % vercmp r123.foo -1 As I understand -1 is the correct result, as an existing version should always be newer than a non-existing one. |
This task depends upon
Closed by Eli Schwartz (eschwartz)
Friday, 19 January 2018, 04:48 GMT
Reason for closing: Fixed
Additional comments about closing: git commit d911438352
Friday, 19 January 2018, 04:48 GMT
Reason for closing: Fixed
Additional comments about closing: git commit d911438352
https://wiki.archlinux.org/index.php/VCS_package_guidelines
Note that vercmp also behaves inconsistently if you supply it a single argument:
% vercmp 123
1
% vercmp r123
-1
I'm not sure on the logic behind this (if any), but at least it should be documented.
Treating the empty string as a "non-existent" version also doesn't make sense. Something that does not exist cannot be newer or older than something else. Alphabetic components of version strings are older than any non-alphabetic component, including the empty string. That's why 1.0alpha is older than 1.0 and why you see the difference between `vercmp 123` and `vercmp r123`.
1. Only allow calling vercmp with two arguments (3+ are also allowed with v5.0.1)
2. Add "Alphabetic components of version strings are older than any non-alphabetic component, including the empty string." to vercmp(8), clarifying the "Version comparison operates as follows:" section.
This should be really simple to fix, e.g. the attached patch. I'm not sure whether to provide an error message though -- and if so, do we need to drag in gettext o_O as well?
(That being said, we don't translate the current help text so probably not...)
https://lists.archlinux.org/pipermail/pacman-dev/2017-December/022211.html