Mailinglist Archive: zypp-devel (230 mails)

< Previous Next >
Re: [zypp-devel] zypper dup
  • From: Michael Matz <matz@xxxxxxx>
  • Date: Mon, 11 Feb 2008 13:09:02 +0100 (CET)
  • Message-id: <Pine.LNX.4.64.0802111300060.20583@xxxxxxxxxxxxx>
Hi,

On Mon, 11 Feb 2008, Michael Matz wrote:

It's the case that i586 is compatible for x86_64 as target. And the
Arch::compare looks for the compatible score first. So it's possible
that the callers of that compare function simply use it in the wrong
direction, or something like that.

I think I know. The code in question looks like so:

if (uninstalled->arch().compare( provider->arch() ) < 0)
// provider has "better" arch, take it

The data in question is, that uninstalled has arch i586, provider has
x86_64. So, i586->compare(x86_64), which is (Arch::compare just calls
the below):

int compare( const CompatEntry & rhs ) const
{
if ( _compatScore != rhs._compatScore )
return( _compatScore < rhs._compatScore ? -1 : 1 );
return _archStr.compare( rhs._archStr );
}

The _compatScore is the number of archs compatible with it. Hence
i586->compatScore is three, and x86_64->compatScore is six. Hence -1 is
returned.

This is sort of true in the sense that more archs are compatible with
"x86_64" than there are with "i585" (six vs. three). But of course it's
the completely wrong mean to determine if x86_64 can and should replace a
i586 package. It simply makes no sense to use Arch::compare() as a
"better" predicate on archs.


Ciao,
Michael.
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups