From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 28 Feb 2009 17:17:25 +0300 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20090228141725.GC9851@altlinux.org> Mail-Followup-To: ALT Devel discussion list References: <20090216081651.GA15873@altlinux.org> <20090216122312.GK27664@wo.int.altlinux.org> <20090216130508.GL31985@altlinux.org> <20090216232939.GA11469@wo.int.altlinux.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bAmEntskrkuBymla" Content-Disposition: inline In-Reply-To: <20090216232939.GA11469@wo.int.altlinux.org> Subject: Re: [devel] gb-task-repo-vercheck (vercheck): Use rpmevrcmp X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.10b3 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2009 14:17:26 -0000 Archived-At: List-Archive: List-Post: --bAmEntskrkuBymla Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 17, 2009 at 02:29:39AM +0300, Dmitry V. Levin wrote: > On Mon, Feb 16, 2009 at 04:05:08PM +0300, Alexey Tourbin wrote: > > On Mon, Feb 16, 2009 at 03:23:12PM +0300, Dmitry V. Levin wrote: > > > On Mon, Feb 16, 2009 at 11:16:51AM +0300, Alexey Tourbin wrote: > > > [...] > > > > 0:1.0-alt1 cmp 1.0-alt2 should yield 1. > > >=20 > > > Why? > > >=20 > > > > Zero serial is greater than no serial. > > >=20 > > > Why? > >=20 > > This is because how rpm-4.0 works. > >=20 > > lib/psm.c: > > 72 int rpmVersionCompare(Header first, Header second) >=20 > If rpmVersionCompare() works this way, why rpmEVRcmp() doesn't work the > same way? That's because rpmEVRcmp() is botched. rpmdb/rpmvercmp.c: 155 /* Compare {A,B} [epoch:]version[-release] */ 156 int=20 157 rpmEVRcmp(const char * const aE, const char * const aV, const char = * const aR, 158 const char * const aDepend, 159 const char * const bE, const char * const bV, const char = * const bR, 160 const char * const bDepend) 161 { 162 int sense =3D 0; 163 =20 164 rpmMessage(RPMMESS_DEBUG, "cmp e=3D%s, v=3D%s, r=3D%s\n and e= =3D%s, v=3D%s, r=3D%s\n ", 165 aE, aV, aR, bE, bV, bR); 166 =20 167 =20 168 if (aE && *aE && bE && *bE) 169 sense =3D rpmvercmp(aE, bE); 170 else if (aE && *aE && atol(aE) > 0) { 171 /* XXX legacy epoch-less requires/conflicts compatibility */ 172 rpmMessage(RPMMESS_DEBUG, _("the \"B\" dependency needs an = epoch (assuming same as \"A\")\n\tA %s\tB %s\n"), 173 aDepend, bDepend); 174 sense =3D 0; 175 } else if (bE && *bE && atol(bE) > 0) 176 sense =3D -1; 177 =20 178 if (sense =3D=3D 0) { 179 sense =3D rpmvercmp(aV, bV); 180 if (sense =3D=3D 0 && aR && *aR && bR && *bR) { 181 sense =3D rpmvercmp(aR, bR); 182 } 183 } 184 =20 185 return sense; 186 } That is, rpmEVRcmp() does not exercise quite the same logic as rpmVersionCompare(). > Let's fix librpm rather than multiply workarounds. Prepending zero serial was wrong anyway. --bAmEntskrkuBymla Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmpR3UACgkQfBKgtDjnu0aYmgCeOggh8mswm+oiVZxTI4cYLBhD eewAoOQ6TlpgmZdXfU/P07dtrN01ye6R =TCSc -----END PGP SIGNATURE----- --bAmEntskrkuBymla--