Hi,

I noticed a strange behavior of dnf not updating a package from the package 
feed, and when I told it to explicitly install that newest package version it 
went "Downgrading: ...." as if the newest version were a older one.

The "competing" packages were:
foo-bar-1.0.0+git0+93a939c4-r0.24
foo-bar-1.0.0+git0+f95bf929-r0.26

So we have a system where foo-bar-1.0.0+git0+93a939c4-r0.24 is installed, and a 
package feed which offers foo-bar-1.0.0+git0+f95bf929-r0.26,
dnf is convinced that f95bf929-r0.26 is older than 93a939c4-r0.24 - which is 
not as expected, IMHO.

BitBake has the "Package version for package XYZ went backwards which would 
break package feeds" error message, but it wouldn't even trigger in this case, 
since after a lexical comparison, f95bf929 is "higher" than 93a939c4. But turns 
out that libsolv implements a whole different algorithm for comparing version 
strings [1] which splits them into 'tokens' of either only numerical or only 
alpha characters, and compares the length of each. In above example it arrives 
at the commit hash after everything preceding it is equal, then it processes 
"93" for the 93a939c4 (delimited by "a") and "" for f95bf929 (delimited by 
"f"). Comparing "93" and "" the former is 2 characters longer, so the 93a939c4 
version is considered more recent.

I think this behavior is counter-intuitive and there are lots of upstream 
recipes that append "git0+<hash>" to their PV; is the general consensus that 
you *must never* change the Git revision of such a package without incrementing 
the PV preceding the "git0" part? (Incrementing the PR doesn't help here, since 
dnf/libsolv never considers the PR if a PV is found to be newer).

I patched libsolv on our systems now to ignore everything following a "git0" in 
a PV, since we absolutely need to be able to update packages between version 
bumps.

Would be interested to learn if this behavior of dnf/libsolv is already known 
and what is the commonly accepted "best practice" dealing with it.

Thanks,
Patrick

[1]: 
https://github.com/openSUSE/libsolv/blob/7b0788fb7ee937b7d38829bcec47760e42779a66/src/evr.c#L74-L155
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#62629): https://lists.yoctoproject.org/g/yocto/message/62629
Mute This Topic: https://lists.yoctoproject.org/mt/104621339/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to