FS#16117 - 'depends' with version doesn't accept 'provides' without version

Attached to Project: Pacman
Opened by Phillip Smith (fukawi2) - Thursday, 10 September 2009, 01:50 GMT
Last edited by Xavier (shining) - Wednesday, 16 September 2009, 12:58 GMT
Task Type Bug Report
Category Backend/Core
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 3.3.0
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

If a package 'depends' on something, including a version number, and there's another package that 'provides' the dependency for package A but without specifying a version number, then the dependency is not satisfied.

Example:
I have ha custom package of postfix called 'postfix-relay'. I make a separate package as I compile with custom spool directories etc and custom default config files. This package of course 'provides' postfix.

I also use 'sqlgrey' with this package, which depends on 'postfix>=2.1' but until I specified that postfix-relay provides 'postfix=2.5' instead of just 'postfix' then when I tried to install sqlgrey, pacman wanted to uninstall my postfix-relay package and install the postfix package from extra.

Rebuilding the 'postfix-relay' package with the version number in the 'provides' line solved the problem.

I don't know if this is the expected/desired behaviour but I wanted to raise it to see what others think. I think it's reasonable given the rolling-release nature of Arch to have pacman assume that unless a version number is specified in the 'provides' line, then it is providing the latest / sufficient version to satisfy the 'depends=>X.y' of another package.

But that's just my thoughts...
This task depends upon

Closed by  Xavier (shining)
Wednesday, 16 September 2009, 12:58 GMT
Reason for closing:  Not a bug
Additional comments about closing:  this is not a bug, but expected behavior.

about the not so informative output, this is not easy to improve, and is already covered by FS#7524
Comment by Dan McGee (toofishes) - Thursday, 10 September 2009, 01:58 GMT
I actually tend to think the opposite way- if you don't specify a version, we should be especially careful at assuming it provides a specified package. Thoughts from others?
Comment by Allan McRae (Allan) - Thursday, 10 September 2009, 02:44 GMT
I agree with Dan here. If a package specifically needs a version of a dependency and goes to the trouble of specifying it, then we really need to make sure that the dependency is being resolved to have the right version.
Comment by Phillip Smith (fukawi2) - Thursday, 10 September 2009, 03:01 GMT
In this instance though, the package was specifying a *minimum* version (ie, >=2.1) so since we work on rolling release it would be safe to either:
a) assume that the dependency 'providing' is the latest; or
b) use the $pkgver from the dependency and compare against that?

Maybe a suffix for the 'depends' var if the pkgver must be explicit? eg:
depends=('postfix>=2.1!'

That is getting a bit inbred and complicated though....
Comment by Allan McRae (Allan) - Thursday, 10 September 2009, 03:08 GMT
pacman is not an Arch Linux only tool, so we can not just assume that the distro it runs on is rolling release.

Also, it is good to always remember that assumptions break systems.
Comment by Phillip Smith (fukawi2) - Thursday, 10 September 2009, 03:20 GMT
What else uses pacman? I'm curious now...

Yes, assumptions often do break things.

How about a warning then?
"Package 'postfix-relay' can not provide 'postfix' for 'sqlgrey' because 'sqlgrey' depends on 'postfix>=2.1' and postfix-relay doesn't specify a version"

Or something similar... I'm just trying to think of ways to avoid hair-tearing time-wasting like I went through this morning ;)
Comment by Dan McGee (toofishes) - Thursday, 10 September 2009, 03:48 GMT
Mind telling us what the actual message presented was so we can see how to potentially make it clearer?
Comment by Phillip Smith (fukawi2) - Thursday, 10 September 2009, 03:52 GMT
root / # pacman -S sqlgrey
resolving dependencies...
looking for inter-conflicts...
:: postfix conflicts with postfix-relay. Remove postfix-relay? [Y/n] n
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: postfix: conflicts with postfix-relay
Comment by Xavier (shining) - Thursday, 10 September 2009, 05:30 GMT
Dan : "I actually tend to think the opposite way- if you don't specify a version, we should be especially careful at assuming it provides a specified package. Thoughts from others?"

This behavior was a deliberate choice we made when introducing versioned dependency, for that very reason (being careful)

About the warning message, I am not sure we can do that easily.
It seems we would need to keep the reason why a package was pulled (in this case, postfix was pulled to satisfy postfix>=2.1)
then when we have a conflict, compare all the dependencies that postfix satisfy versus the ones that the conflicting package postfix-really provides.
Quite weird..

Otherwise, we could also display a warning every time a unversioned provider cannot satisfy a versioned dependency, but then we would likely get a lot of spam and cluttered output that we don't want.

But Nagy is the expert here, so I would like to hear his opinion :)

Comment by Phillip Smith (fukawi2) - Thursday, 10 September 2009, 06:29 GMT
Wouldn't it be more efficient:
1) Scan through installed packages for any that could 'provide' the required dependency
2) If an installed package can't satisfy version requirements, print error and continue
3a) Matching installed package is found -> all good
3b) No match found installed, continue with current behaviour (in this case, remove postfix-relay and install standard postfix)

I've never hacked pacman so I don't know if that's reasonable given the existing code, just my thought processes ;P
Comment by Gavin Bisesi (Daenyth) - Sunday, 13 September 2009, 23:39 GMT
Personally I've always thought this was intended behavior.
Comment by Nagy Gabor (combo) - Wednesday, 16 September 2009, 12:29 GMT
"I actually tend to think the opposite way- if you don't specify a version, we should be especially careful at assuming it provides a specified package. Thoughts from others?"

The following example justifies that:
I have mesa-git 20090509-1 installed on my system (mesa-git provides mesa). Without provision version number, pacman should not assume anything, for example mesa 20090509-1 assumption sounds just terrible. (Hint: Nothing guarantees that that my mesa-git is not "outdated".)
Comment by Nagy Gabor (combo) - Wednesday, 16 September 2009, 12:42 GMT
I agree that the actual output is not good: We have a related task (with misleading summary :-P), FS#7524

I am not sure about warnings. Those are helpful for detecting _packager_ bug, but I don't think that worth spamming pacman's output. Even if we print a warning, the end-user cannot do anything until the package is fixed, he can only do pacman -Sd sqlgrey, which is not recommended.

Loading...