Pacman

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.
Tasklist

FS#45954 - pacman version comparison error

Attached to Project: Pacman
Opened by Chris Severance (severach) - Tuesday, 11 August 2015, 11:56 GMT
Last edited by Allan McRae (Allan) - Monday, 14 December 2015, 14:15 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I have foo-git version 2.0.r0.g0 that provides=('foo')
I have a package bar that depends=('foo>=2.0')

Pacman cannot install bar because foo-git cannot meet the dependency.

error: failed to prepare transaction (could not satisfy dependencies)
:: bar: requires foo>=2.0

pkgname=bar; depends=('foo-git>=2.0') # works
pkgname=bar; depends=('foo>=2.0') # does not work

pkgname=foo; pkgver=2.0 # works but I can't take -git off the package name

pkgname=foo-git; pkgver=2.0; provides=('foo') # does not work
pkgname=foo-git; provides=('foo=2.0') # works
pkgname=foo-git; provides=('foo=2.0.r0.g0') # does not work

Adding pkgver=2.0 to package() does not work and it confuses makepkg -i.

So there are two bugs. Pacman is comparing wrong and sometimes provides is ignored for versioned depends. vercmp gets the comparison right.

# vercmp 2.0 2.0.r0.g0
-1

Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
This task depends upon

Closed by  Allan McRae (Allan)
Monday, 14 December 2015, 14:15 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Working as documented
Comment by Dave Reisner (falconindy) - Tuesday, 11 August 2015, 12:31 GMT
> pkgname=foo-git; provides=('foo=2.0.r0.g0') # does not work
I dispute this, as it's extremely commonplace. Sure enough, the below PKGBUILDs result in an installable 'bar' after installing 'foo-git':

## foo-git
pkgname=foo-git
pkgver=2.0.r0.g0
pkgrel=1
arch=(any)
provides=("foo=$pkgver")
package() { :; }

## bar
pkgname=bar
pkgver=1
pkgrel=1
arch=(any)
depends=('foo>=2.0')
package() { :; }

Can you provide "complete" PKGBUILDs which show otherwise?
Comment by Chris Severance (severach) - Tuesday, 11 August 2015, 19:40 GMT
That one seems to work now but it's not very useful as I should not need to explicitly name the version that is already in pkgver.

Debugging this took many hours longer than it should have because for a while the git that produces or updates $srcdir/vcs decided to also reset the PKGBUILD to the AUR4 version on each makepkg run. Once I found the offending line with 'sudo chattr +i PKGBUILD; bash -x makepkg -o' and that it shouldn't be changing PKGBUILD, it took a lot of rapacious folder deleting and temporary PKGBUILD changes to stop git from changing a file referenced in the AUR4 vcs but not the package vcs.

Looks like the version check is working. The unreasonable requirements in provides still need to be fixed. The version checks must be orthogonal or we'll get the impossible version dependencies we see in the forums from time to time.

## foo-git PKGBUILD
pkgrel=1
arch=(any)
conflicts=('foo')
provides=('foo')

#pkgname=foo; pkgver=2.0; unset provides # works
#pkgname=foo; pkgver=2.0.r0.g0; unset provides # works

# Changing bar to depends=('foo-git>=2.0') fix some of the following

#pkgname=foo-git; pkgver=2.0.r0.g0 # does not work (fixed)
pkgname=foo-git; pkgver=2.0.r0.g0; provides=("foo=${pkgver}") # works
#pkgname=foo-git; pkgver=2.0.r9391.4b4b5c5c; provides=("foo=${pkgver}") # works

#pkgname=foo-git; pkgver=2.0 # does not work (fixed)
#pkgname=foo-git; pkgver=2.0.r0.g0 # does not work (fixed). This is the most important one!

package() { :; }
Comment by Dave Reisner (falconindy) - Tuesday, 11 August 2015, 19:52 GMT
> I should not need to explicitly name the version that is already in pkgver.
Yes, you should. It's not reasonable to assume versions for all provisions. Thinking solely about foo-git providing foo is narrow minded. Consider what happens when something like 'util-linux' subsumes a utility (e.g. eject) or when you start dealing with virtual providers (e.g. ssmtp and postfix provide 'smtp-forwarder').

> The version checks must be orthogonal or we'll get the impossible version dependencies we see in the forums from time to time.
This doesn't make sense. Could you provide examples of such forum posts?
Comment by Chris Severance (severach) - Tuesday, 11 August 2015, 21:55 GMT
I finally came to the same conclusion. foo-git could draw the version from pkgver only because foo and foo-git are likely to be versioned the same. Rewriting foo 2.0 as newfoo 0.1 results in a brand new set of versions from which pacman can't assume anything about versions.

Then the bug is in the documentation. This peculiarity needs to be explicit.

A provides without a version can only satisfy a non versioned dependency. If a versioned dependency is expected then a versioned provides is required. For example, if some package depends on cron, any provides=('cron') or provides=('cron=AnyVersion') can satisfy it. However if some package depends on cron>=2.0, a cron compatible package such as dcron with provides=('cron') shall not satisfy it even if the the dcron pkgver is >=2.0. dcron must explicitly add cron=2.0 to its provides array. Though not generally practical, the versioned dependency can also be modified to match the exact package name.

Where possible, vcs packages should include a simple non vcs version number in provides in case other packages need explicit versions.
Comment by Dave Reisner (falconindy) - Tuesday, 11 August 2015, 22:47 GMT
> Then the bug is in the documentation. This peculiarity needs to be explicit.
The description of "provides" in PKGBUILD(5) states: "Versioned provisions are also possible, in the name=version format." This implies that versions aren't assumed. If you think the documentation could be clearer, please provide a patch against the git repo to the pacman-dev mailing list.

Loading...