Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 47847 - Version parsing problem in relparse() - breaks on 'netwatch-1.0b_pre3'
Summary: Version parsing problem in relparse() - breaks on 'netwatch-1.0b_pre3'
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
: 47873 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-14 14:49 UTC by Jim Ramsay (lack) (RETIRED)
Modified: 2004-08-10 22:35 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Ramsay (lack) (RETIRED) gentoo-dev 2004-04-14 14:49:29 UTC
Running sys-apps/portage-2.0.50-r5, attemting to do 'eupdatedb', received following error:

 * indexing: 2068 ebuilds to goTraceback (most recent call last):
  File "/usr/sbin/eupdatedb", line 158, in ?
    pkgv = portage.portdb.xmatch("bestmatch-visible", pkg)
  File "/usr/lib/portage/pym/portage.py", line 4690, in xmatch
    myval=best(self.xmatch("match-visible",None,mydep,mykey))
  File "/usr/lib/portage/pym/portage.py", line 3469, in best
    if pkgcmp(p1,p2)>0:
  File "/usr/lib/portage/pym/portage.py", line 2833, in pkgcmp
    mycmp=vercmp(pkg1[1],pkg2[1])
  File "/usr/lib/portage/pym/portage.py", line 2819, in vercmp
    cmp2=relparse(val2[x])
  File "/usr/lib/portage/pym/portage.py", line 2507, in relparse
    number=string.atof(mynewver[0])
  File "/usr/lib/python2.3/string.py", line 205, in atof
    return _float(s)
ValueError: invalid literal for float(): .0b

Further investigation showed that the ebuild causing the problem was net-analysis/netwatch/netwatch-1.0b_pre3.ebuild  (when I remove this ebuild from the directory, the error does not occurr).

This is due to a bug in 'portage.py' line 2507 where it assumes that when a version number contains a '_', the portion prior to the '_' will be properly parseable by string.atof() and not end with a letter.

Reproducible: Always
Steps to Reproduce:
1. Update ports so that the ebuild netwatch-1.0b_pre3.ebuild is in the net-analysis/netwatch directory
2. Run updatedb

Actual Results:  
A python error occurred:

Traceback (most recent call last):
  File "/usr/sbin/eupdatedb", line 158, in ?
    pkgv = portage.portdb.xmatch("bestmatch-visible", pkg)
  File "/usr/lib/portage/pym/portage.py", line 4690, in xmatch
    myval=best(self.xmatch("match-visible",None,mydep,mykey))
  File "/usr/lib/portage/pym/portage.py", line 3469, in best
    if pkgcmp(p1,p2)>0:
  File "/usr/lib/portage/pym/portage.py", line 2833, in pkgcmp
    mycmp=vercmp(pkg1[1],pkg2[1])
  File "/usr/lib/portage/pym/portage.py", line 2819, in vercmp
    cmp2=relparse(val2[x])
  File "/usr/lib/portage/pym/portage.py", line 2507, in relparse
    number=string.atof(mynewver[0])
  File "/usr/lib/python2.3/string.py", line 205, in atof
    return _float(s)
ValueError: invalid literal for float(): .0b

Expected Results:  
Not err, and parse the version properly.

In other words:

netwatch-1.0a - works (no '_' in there)
netwatch-1.0_pre3 - would work (no 1.0b)
netwacth-1.0b_pre3 - does not work

emerge info:

Portage 2.0.50-r5 (default-x86-1.4, gcc-3.3.3, glibc-2.3.3_pre20040207-r0,
2.6.5-gentoo)
=================================================================
System uname: 2.6.5-gentoo i686 AMD Athlon(TM) XP 1600+
Gentoo Base System version 1.4.7
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="ftp://cs.ubishops.ca/pub/gentoo
ftp://sunsite.ualberta.ca/pub/unix/Linux/gentoo/ ftp://gentoo.agsn.ca/
http://adelie.polymtl.ca/ http://mirror.cpsc.ucalgary.ca/mirror/gentoo.org
ftp://mirror.cpsc.ucalgary.ca/mirror/gentoo.org "
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X alsa apache2 apm avi berkdb cdr crypt cups curl directfb encode esd
foomaticdb gdbm gif gpm gtk gtk2 guile imap imlib jack jpeg kde ldap libg++
libwww mad maildir mbox mikmod mmx motif mozilla mpeg mpeg3 mysql ncurses nls
nptl oggvorbis opengl oss pam pdflib perl png python quicktime readline sasl sdl
slang spell ssl svga tcpd tetex tiff truetype x86 xinerama xml2 xmms xv zlib"
Comment 1 Jim Ramsay (lack) (RETIRED) gentoo-dev 2004-04-14 15:27:17 UTC
The following patch to 'portage.py' seems to work (very very lightly tested):

--- portage.py.orig     2004-04-14 16:25:43.528967658 -0600
+++ portage.py  2004-04-14 16:24:13.590817677 -0600
@@ -2504,7 +2504,13 @@
        mynewver=string.split(myver,"_")
        if len(mynewver)==2:
                #an endversion
-               number=string.atof(mynewver[0])
+               divider=len(mynewver[0])-1
+               if mynewver[0][divider:] not in "1234567890":
+                       #letter at end
+                       p1=ord(mynewver[0][divider:])
+                       number=string.atof(mynewver[0][0:divider])
+               else:
+                       number=string.atof(mynewver[0])  
                match=0
                for x in endversion_keys:
                        elen=len(x)
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2004-04-14 15:59:40 UTC
I thought I fixed that already ...
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2004-04-14 16:23:33 UTC
Nick, is -r6 an update of the -r1 branch or the -r2 branch? Seems that the fix for  #17172 is only on the -r2 branch.
Comment 4 Marius Mauch (RETIRED) gentoo-dev 2004-04-14 17:55:04 UTC
I removed the ebuild for now. Jeremy, Nick, we have the following options:
- wait until portage-2.0.51 is stable for some time
- include the 17172 fix in a -r7 release of portage and wait a little while so that 99% of the users have it
- rename the ebuild so it's using a version that doesn't break portage
- keep the ebuild removed
Comment 5 Jeremy Huddleston (RETIRED) gentoo-dev 2004-04-14 21:18:43 UTC
hmm... 2.0.50-r2 didn't complain about it, so I waited a while to commit... I didn't realize that -r6 removed fixes that were in -r2...
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2004-04-16 23:50:41 UTC
*** Bug 47873 has been marked as a duplicate of this bug. ***
Comment 7 Brian Harring (RETIRED) gentoo-dev 2004-08-10 22:35:48 UTC
I'd assume this was closed out in .50; meanwhile, it is fixed in .51.