On #fedora-devel, the issue of comparing Fedora versions by string comparison just came up. With F-10 on the way, this will be the first time when string comparing versions will fail in a "10" < "7" way.
The case in question was a classic older %if "%{?fedora}" > "7", which should be changed to %if 0%{?fedora} > 7, as Rex Dieter and Christopher Stone have pointed out: http://fedoraproject.org/wiki/Packaging/DistTag#head-1c550109af0705ccb713296...
Where else but in spec files may similarly wrong string comparisons be happening? Is a systematic effort required to fix these comparisons in the run-up to F-10?
On Sat, 2008-05-24 at 01:00 +0200, Hans Ulrich Niedermann wrote:
On #fedora-devel, the issue of comparing Fedora versions by string comparison just came up. With F-10 on the way, this will be the first time when string comparing versions will fail in a "10" < "7" way.
The case in question was a classic older %if "%{?fedora}" > "7", which should be changed to %if 0%{?fedora} > 7, as Rex Dieter and Christopher Stone have pointed out: http://fedoraproject.org/wiki/Packaging/DistTag#head-1c550109af0705ccb713296...
Where else but in spec files may similarly wrong string comparisons be happening? Is a systematic effort required to fix these comparisons in the run-up to F-10?
Probably. This is something we should look into, and I've added it to my todo list.
~spot
Tom "spot" Callaway wrote:
On Sat, 2008-05-24 at 01:00 +0200, Hans Ulrich Niedermann wrote:
The case in question was a classic older %if "%{?fedora}" > "7", which should be changed to %if 0%{?fedora} > 7, as Rex Dieter and Christopher Stone have pointed out: http://fedoraproject.org/wiki/Packaging/DistTag#head-1c550109af0705ccb713296...
Where else but in spec files may similarly wrong string comparisons be happening? Is a systematic effort required to fix these comparisons in the run-up to F-10?
Probably. This is something we should look into, and I've added it to my todo list.
My quick and dirty spec file string comparison checker script is at:
http://ndim.fedorapeople.org/stuff/rpm/string-comparison-check.sh
Log files for devel, F-9, F-8, F-7 branches:
http://ndim.fedorapeople.org/stuff/rpm/string-comp-devel.log http://ndim.fedorapeople.org/stuff/rpm/string-comp-F-9.log http://ndim.fedorapeople.org/stuff/rpm/string-comp-F-8.log http://ndim.fedorapeople.org/stuff/rpm/string-comp-F-7.log
To give a rough idea of the scale:
devel: 85 string comparisons in 46 spec files F-9: 90 string comparisons in 50 spec files F-8: 117 string comparisons in 59 spec files F-7: 121 string comparisons in 63 spec files
If someone wants to do mass bug filing or reporting sorted by maintainer name based on that, you'd probably need to filter out a few cases where this simple grep finds false positives. The == and != comparisons might be working as intended.
Hans Ulrich Niedermann wrote:
Log files for devel, F-9, F-8, F-7 branches:
http://ndim.fedorapeople.org/stuff/rpm/string-comp-devel.log http://ndim.fedorapeople.org/stuff/rpm/string-comp-F-9.log http://ndim.fedorapeople.org/stuff/rpm/string-comp-F-8.log http://ndim.fedorapeople.org/stuff/rpm/string-comp-F-7.log
To give a rough idea of the scale:
devel: 85 string comparisons in 46 spec files F-9: 90 string comparisons in 50 spec files F-8: 117 string comparisons in 59 spec files F-7: 121 string comparisons in 63 spec files
Update from today's CVS:
devel: 75 string comparisons in 41 spec files F-9: 83 string comparisons in 48 spec files F-8: 114 string comparisons in 58 spec files F-7: 118 string comparisons in 62 spec files
It's going in the right direction.
A short reminder what this is about:
%if "%{?fedora}" > "7" <something which should work in F-8, F-9, F-10, F-11, etc.> %endif
This fails to work as intended in rawhide/devel/F10 and later and should be fixed.
Summary for 2008-07-06 ---------------------- devel: 58 string comparisons in 32 spec files F-9: 78 string comparisons in 46 spec files F-8: 109 string comparisons in 56 spec files F-7: 118 string comparisons in 62 spec files
The packages in rawhide will definitely be affected by this, might already be breaking stuff, and really should be fixed:
http://ndim.fedorapeople.org/stuff/rpm/string-comp-devel.log
Graphing the numbers over time shows a definite decrease in devel/rawhide/F10, but nothing approaching zero for a long time:
http://ndim.fedorapeople.org/stuff/rpm/
On Sun, 06 Jul 2008 15:02:52 +0200 Hans Ulrich Niedermann hun@n-dimensional.de wrote:
A short reminder what this is about:
%if "%{?fedora}" > "7" <something which should work in F-8, F-9, F-10, F-11, etc.> %endif
This fails to work as intended in rawhide/devel/F10 and later and should be fixed.
Summary for 2008-07-06
devel: 58 string comparisons in 32 spec files F-9: 78 string comparisons in 46 spec files F-8: 109 string comparisons in 56 spec files F-7: 118 string comparisons in 62 spec files
The packages in rawhide will definitely be affected by this, might already be breaking stuff, and really should be fixed:
http://ndim.fedorapeople.org/stuff/rpm/string-comp-devel.log
Graphing the numbers over time shows a definite decrease in devel/rawhide/F10, but nothing approaching zero for a long time:
http://ndim.fedorapeople.org/stuff/rpm/
Some false positives here:
lat lat.spec:14:%if "%{?fedora}" == "5" lat.spec:42:%if "%{?fedora}" == "5" lat.spec:111:%if "%{?fedora}" == "5"
These are not a problem.
Paul.
Le dimanche 06 juillet 2008 à 15:29 +0100, Paul Howarth a écrit :
Some false positives here:
lat lat.spec:14:%if "%{?fedora}" == "5" lat.spec:42:%if "%{?fedora}" == "5" lat.spec:111:%if "%{?fedora}" == "5"
These are not a problem.
Actually since FC5 has been EOLed for a long time, some legacy baggage cleaning up is in order.
Nicolas Mailhot wrote:
Le dimanche 06 juillet 2008 à 15:29 +0100, Paul Howarth a écrit :
Some false positives here:
lat lat.spec:14:%if "%{?fedora}" == "5" lat.spec:42:%if "%{?fedora}" == "5" lat.spec:111:%if "%{?fedora}" == "5"
These are not a problem.
Actually since FC5 has been EOLed for a long time, some legacy baggage cleaning up is in order.
Well, it is still useful at least as documentation for people wanting to build newer packages on older systems. Enterprise disto derivates, and standalone lab boxes running Fedora spring to mind.
Apropos... I am not checking for improper %{epel} or %{rhel} usage, but some spec files contain conditionals with them.
On Sun, 2008-07-06 at 15:29 +0100, Paul Howarth wrote:
Some false positives here:
lat lat.spec:14:%if "%{?fedora}" == "5" lat.spec:42:%if "%{?fedora}" == "5" lat.spec:111:%if "%{?fedora}" == "5"
These are not a problem.
Maybe not, but FC5 is long-since dead. Conditional cruft like that should probably just be outright removed.
Paul Howarth wrote:
On Sun, 06 Jul 2008 15:02:52 +0200 Hans Ulrich Niedermann hun@n-dimensional.de wrote:
Summary for 2008-07-06
devel: 58 string comparisons in 32 spec files F-9: 78 string comparisons in 46 spec files F-8: 109 string comparisons in 56 spec files F-7: 118 string comparisons in 62 spec files
Some false positives here:
lat lat.spec:14:%if "%{?fedora}" == "5" lat.spec:42:%if "%{?fedora}" == "5" lat.spec:111:%if "%{?fedora}" == "5"
These are not a problem.
Technically speaking, they are not a problem, right. Until someone gets the idea that he wants >= instead of ==.
Whetever, strictly requiring a < or > in the conditional, the situation changes to the following:
Summary for 2008-07-06 ---------------------- devel: 48 string comparisons in 28 spec files F-9: 68 string comparisons in 42 spec files F-8: 91 string comparisons in 53 spec files F-7: 95 string comparisons in 58 spec files
Updated details, diagrams, etc. on http://ndim.fedorapeople.org/stuff/rpm/