Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46096 - fixdbentries breaks vardb and binaries
Summary: fixdbentries breaks vardb and binaries
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High blocker (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 45912 46466 49872 52289 53213 58468 58801 58804 58884 59157 59415 59466 59532 59577 60073 60230 60433 61104 61667 62052 64915 68639 91889 (view as bug list)
Depends on:
Blocks: 48545
  Show dependency tree
 
Reported: 2004-03-29 03:47 UTC by Jason Stubbs (RETIRED)
Modified: 2005-05-10 10:58 UTC (History)
28 users (show)

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


Attachments
Fixes the corruption (portage-2.0.50-r2-fixdbentries.patch,775 bytes, patch)
2004-03-29 04:02 UTC, Jason Stubbs (RETIRED)
Details | Diff
Fixes the corruption and missing files (portage-2.0.50-r2-fixdbentries.patch,732 bytes, patch)
2004-03-29 04:27 UTC, Jason Stubbs (RETIRED)
Details | Diff
Reverted to previous latter pair (against -r4) (portage-2.0.50-r4-fixdbentries.patch,815 bytes, patch)
2004-04-08 21:17 UTC, Jason Stubbs (RETIRED)
Details | Diff
Script to fix /var/db/pkg (fixvardbentries,1.73 KB, text/plain)
2004-04-10 04:10 UTC, Jason Stubbs (RETIRED)
Details
Patch to portage to fix corruption automatically (portage-2.0.50-r4-dbcorruption.patch,2.62 KB, patch)
2004-04-10 05:51 UTC, Jason Stubbs (RETIRED)
Details | Diff
Script to fix /var/db/pkg (fixvardbentries,2.33 KB, text/plain)
2004-07-31 21:55 UTC, Jason Stubbs (RETIRED)
Details
Script to fix /var/db/pkg (fixvardbentries,2.75 KB, text/plain)
2004-08-11 04:36 UTC, Jason Stubbs (RETIRED)
Details
/var/db/pkg/media-sound/sox-12.17.4-r1/sox-12.17.4-r1.ebuild (bug46096-sox-12.17.4-r1.ebuild,1.25 KB, text/plain)
2004-08-16 06:44 UTC, Sascha Silbe
Details
Patch against the script from comment #45 to fix the quote fixing (fixvardbentries-quotefix.patch,566 bytes, patch)
2004-08-16 09:12 UTC, Sascha Silbe
Details | Diff
The fixed script (fixvardbentries,2.85 KB, text/plain)
2004-08-16 09:13 UTC, Sascha Silbe
Details
New version of the script with support for unpacked "environment" (fixvardbentries,3.00 KB, text/plain)
2004-08-16 09:54 UTC, Sascha Silbe
Details
Script to fix /var/db/pkg (fixvardbentries,4.15 KB, text/plain)
2004-08-17 06:54 UTC, Jason Stubbs (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Stubbs (RETIRED) gentoo-dev 2004-03-29 03:47:30 UTC
bash-2.05b$ cat test
EOL after test/pkg
test/pkg with space
test/pkg-1.2 with version

bash-2.05b$ python -c 'import portage; portage.fixdbentries("test/pkg","test/done",".")'

bash-2.05b$ cat test
EOL after test/donetest/donewith space
test/done.2 with version

...and with less...
EOL after test/done^Atest/done^Awith space
test/done^A.2 with version


It also seems to miss some files but I have been unable to manually reproduce it thus far.
Comment 1 Jason Stubbs (RETIRED) gentoo-dev 2004-03-29 04:02:34 UTC
Created attachment 28274 [details, diff]
Fixes the corruption

Very simple. The regexps were using a single '\' and python was escaping it.

Still not sure on why files are being missed though. Will investigate further.
Comment 2 Jason Stubbs (RETIRED) gentoo-dev 2004-03-29 04:27:16 UTC
Created attachment 28275 [details, diff]
Fixes the corruption and missing files

I'll go through my changes.

- mycontent = re.sub(old_value+"$", new_value, mycontent)
- mycontent = re.sub(old_value+"(\s)", new_value+"\1", mycontent)
+ mycontent = re.sub(old_value+"(\\s)", new_value+"\\1", mycontent)

\s already catches newlines so the $ test isn't needed.

- mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\1", mycontent)
- mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\1", mycontent)
+ mycontent = re.sub(old_value+"(-[0-9])", new_value+"\\1", mycontent)

The originals here were not catching ">=some/pkg-1.2". I'm not sure exactly
what they are meant to do, but my change will ensure that any replacements are
done without affecting package names that include the moved package as a
substring. eg. "net-p2p/gift-openft" won't be affected by a change to
"net-p2p/gift"
Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2004-04-01 18:23:34 UTC
*** Bug 46466 has been marked as a duplicate of this bug. ***
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-04-01 18:28:01 UTC
Upgrading severity to blocker as it's preventing uninstallation of affected packages.
Comment 5 Jason Stubbs (RETIRED) gentoo-dev 2004-04-07 07:25:49 UTC
I don't mind if it's changed because I'm not sure what the latter two regex's were meant to do but this really needs to go into the next release.

If I am able to do it myself, let me know. I don't feel like experimenting that much. :)
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2004-04-08 07:45:51 UTC
Okay, I can see what the original second pair is meant to do and it seems to be correct. I'll investigate why it wasn't working and fix this up.
Comment 7 Jason Stubbs (RETIRED) gentoo-dev 2004-04-08 21:17:39 UTC
Created attachment 28929 [details, diff]
Reverted to previous latter pair (against -r4)

The previous fix would not catch "foo/bar)" which is what the second pair of
regexps addressed in the originals. The cause for them not catching previously
seems to be due to the earlier corruption.

Anyway, this one works.
Comment 8 Masatomo Nakano (RETIRED) gentoo-dev 2004-04-09 09:49:14 UTC
jstubbs: The patch seems good.

But why did you remove this line?
mycontent = re.sub(old_value+"$", new_value, mycontent)

If the line doesn't exists, just "cat/pkg-ver" would not match.
Comment 9 Jason Stubbs (RETIRED) gentoo-dev 2004-04-09 19:14:50 UTC
Because the strings include newlines, re.sub seems to automatically switch to multi-line mode. This causes \s to match newline characters as well. I haven't yet found documentation to back this up, but my testing shows that it is not required.
Comment 10 Masatomo Nakano (RETIRED) gentoo-dev 2004-04-09 19:25:01 UTC
There is a file with no newline character sometimes. (only 1 line or in last line)
And if we don't remove the line, there would not be bug.

So, I think we should not remove the line.
Comment 11 Marius Mauch (RETIRED) gentoo-dev 2004-04-09 19:54:42 UTC
Sorry for not getting earlier to his, I'm a bit distracted atm.
Comment 12 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 04:10:06 UTC
Created attachment 29014 [details]
Script to fix /var/db/pkg

Doesn't consider $ROOT or binary packages. Will add support for those next.
Comment 13 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 05:51:11 UTC
Created attachment 29020 [details, diff]
Patch to portage to fix corruption automatically

Adds a "corrupted" key to mtimedb["updates"] and performs the same function as
the previous script if the key is not defined.

Small bug in the previous script.
- if "\1" not in orig:
+ if "\1" not in "".join(orig):

I *will* get out of the habit of making last minute changes without retesting.
Comment 14 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 05:56:22 UTC
By the way, I didn't modify the script/patch to fix *DEPEND and xxx.ebuild and fixed in the xpak of tbz2s or in ${ROOT}var/db/pkg because do_update doesn't do it either. Is this a problem?
Comment 15 Jason Stubbs (RETIRED) gentoo-dev 2004-04-10 07:07:41 UTC
forgot to add this so that updates get reprocessed after fixing corruption:

  if not mtimedb["updates"].has_key("corrupted"):
+     mtimedb["updates"] = {}
      for cat in os.listdir("/"+VDB_PATH):
Comment 16 Adrian Head 2004-04-21 19:34:48 UTC
So am I correct to assume that Bug# 48545 is a duplicate to this bug?

If so to get things running again - should I just run the "Script to fix /var/db/pkg" above? or the patch?

Should I be recording things when running the script for latter analysis?

What other information can I give to help sort this out?
Comment 17 Adrian Head 2004-04-21 19:52:00 UTC
As my Bug# 48545 was closed - I tried running the above "Script to fix /var/db/pkg".   This didn't change the symptoms of my problem as shown below:

Does anyone have any suggestions?

>>> sys-kernel/linux-headers-2.4.22 merged.

>>> clean: No packages selected for removal.

>>> Auto-cleaning packages ...

 net-firewall/shorewall
    selected: 1.4.10b
   protected: 2.0.1
     omitted: none

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

>>> Waiting 5 seconds before starting...
>>> (Control-C to abort)...
>>> Unmerging in: 5 4 3 2 1
>>> Unmerging net-firewall/shorewall-1.4.10b...
No package files given... Grabbing a set.
/usr/sbin/ebuild.sh: /var/db/pkg/net-firewall/shorewall-1.4.10b/shorewall-1.4.10b.ebuild: line 39: unexpected EOF while looking for matching `"'
/usr/sbin/ebuild.sh: /var/db/pkg/net-firewall/shorewall-1.4.10b/shorewall-1.4.10b.ebuild: line 41: syntax error: unexpected end of file

!!! ERROR: net-firewall/shorewall-1.4.10b failed.
!!! Function , Line 1291, Exitcode 1
!!! error sourcing ebuild

!!! FAILED prerm: 1

Thanks for your time.
Comment 18 Adrian Head 2004-04-21 20:48:17 UTC
After hunting through everything I know; I found that the ebuild in /var/db/pkg/net-firewall/shorewall-1.4.10b/  had a ^A character instead of " after the DEPEND.  I changed it back to a " and the unemerge problem was resolved.

I've just run a badblocks and have picked up nothing - so I'm at a loss as to how that ^A character came to be.

Therefore, I appologise for the noise.
Comment 19 Jason Stubbs (RETIRED) gentoo-dev 2004-04-21 21:42:09 UTC
The "Script to fix /var/db/pkg" should have fixed the shorewall ebuild. Finding and fixing the ^A is exactly what it is designed to do. You said that the final quote had been replaced by a ^A, though. I think I missed out that case. Will do some more testing and fix. :)
Comment 20 Brian O'Kelley 2004-05-03 14:09:43 UTC
*** Bug 49872 has been marked as a duplicate of this bug. ***
Comment 21 Jason Stubbs (RETIRED) gentoo-dev 2004-06-07 15:16:41 UTC
*** Bug 53213 has been marked as a duplicate of this bug. ***
Comment 22 Andy Dalton 2004-07-08 00:00:15 UTC
After saving the previously attached script and running it, I get the following error and am still unable to cleanly purge shorewall without manual modification  of /var/db/pkg/net-firewall/shorewall-1.4.10b/shorewall-1.4.10b.ebuild

# ./fix
Traceback (most recent call last):
  File "./fix", line 69, in ?
    fix_entries(vardb+cat+"/"+pkg)
  File "./fix", line 10, in fix_entries
    ebuildfile = open(path+ebuild)
IOError: [Errno 2] No such file or directory: '/var/db/pkg/media-sound/madplay-0.14.2b-r2/madplay-0.14.2b-r2.ebuild'

It seems it's expecting the file to be named differently than it is:
# ls /var/db/pkg/media-sound/madplay-0.14.2b-r2/mad*
mad-0.14.2b-r2.ebuild

Should the script be modified to ignore such "No such file" errors?
Comment 23 Andy Dalton 2004-07-08 00:08:05 UTC
Hum, I overlooked the bug in the script.
- if "\1" not in orig:
+ if "\1" not in "".join(orig)

After making that change, the script executes successfully.

# ./fix
broken ebuild mailx-8.1.2.20021129-r2.ebuild
#

However, shorewall still does not purge successfully, failing with the same error.
Comment 24 Sascha Silbe 2004-07-25 16:26:58 UTC
The "Script to fix /var/db/pkg" does not work on my system because there is no file "environment.bz2" but a file "environment".

Comment 25 Sascha Silbe 2004-07-25 16:43:33 UTC
After bzip2'ing the environment file manually, I get the same output as in Comment #23:

broken ebuild mailx-8.1.2.20021129-r2.ebuild

Since it's bailing out, the ebuild does not get repaired.

Comment 26 Sascha Silbe 2004-07-26 09:43:42 UTC
On another one of my hosts, there's a package installed that has neither "environment" nor "environment.bz2":

[normal system update]
 mail-client/mailx
    selected: 8.1.2.20021129-r2
   protected: 8.1.2.20021129-r3
     omitted: none

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

>>> Unmerging mail-client/mailx-8.1.2.20021129-r2...
No package files given... Grabbing a set.
/usr/sbin/ebuild.sh: /var/db/pkg/mail-client/mailx-8.1.2.20021129-r2/mailx-8.1.2.20021129-r2.ebuild: line 40: unexpected EOF while looking for matching `"'
/usr/sbin/ebuild.sh: /var/db/pkg/mail-client/mailx-8.1.2.20021129-r2/mailx-8.1.2.20021129-r2.ebuild: line 67: syntax error: unexpected end of file

!!! ERROR: mail-client/mailx-8.1.2.20021129-r2 failed.
!!! Function , Line 1294, Exitcode 1
!!! error sourcing ebuild

!!! FAILED prerm: 1
root@hybrid:~# ./2004-07-23-fixvardbentries 
bunzip2: Can't open input file /var/db/pkg/app-admin/logrotate-3.6.5-r1/environment.bz2: No such file or directory.
Traceback (most recent call last):
  File "./2004-07-23-fixvardbentries", line 70, in ?
    fix_entries(vardb+cat+"/"+pkg)
  File "./2004-07-23-fixvardbentries", line 17, in fix_entries
    envfile = open(path+"environment")
IOError: [Errno 2] No such file or directory: '/var/db/pkg/app-admin/logrotate-3.6.5-r1/environment'
root@hybrid:~# ls /var/db/pkg/app-admin/logrotate-3.6.5-r1/
CATEGORY  CC       CFLAGS  CONTENTS  CXX       DEPEND   PDEPEND  PROVIDE  SLOT  logrotate-3.6.5-r1.ebuild
CBUILD    CDEPEND  CHOST   COUNTER   CXXFLAGS  LICENSE  PF       RDEPEND  USE
root@hybrid:~# emerge info
Portage 2.0.50-r9 (default-1.0, gcc-2.95.3, glibc-2.2.5-r4,2.2.5-r9, 2.4.25-hybrid-1)
=================================================================
System uname: 2.4.25-hybrid-1 i586 AMD-K6(tm) 3D processor
Gentoo Base System version 1.4.16
distcc 2.13 i586-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-mcpu=k6"
CHOST="i586-pc-linux-gnu"
COMPILER=""
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/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/afs/C /etc/afs/afsws /etc/afs/modload /etc/gconf /etc/make.globals /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://192.168.1.2/gentoo http://mirrors.sec.informatik.tu-darmstadt.de/gentoo http://ftp.easynet.nl/mirror/gentoo/ ftp://ftp.easynet.nl/mirror/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://hybrid.sascha.silbe.org/gentoo-portage"
USE="3dnow X acl afs berkdb cdr crypt gdbm imlib ipv6 j-noaim j-nomsn j-noyahoo jpeg krb4 libg++ libwww mikmod mmx mpeg nas ncurses nls oggvorbis oss pam pdflib perl png python readline scanner slang spell ssl tetex tiff truetype x86 xml2"

root@hybrid:~#

Comment 27 Sascha Silbe 2004-07-26 09:45:36 UTC
On another one of my hosts, there's a package installed that has neither "environment" nor "environment.bz2":  [normal system update]  mail-client/mailx     selected: 8.1.2.20021129-r2    protected: 8.1.2.20021129-r3      omitted: none  >>> 'Selected' packages are slated for removal. >>> 'Protected' and 'omitted' packages will not be removed.  >>> Unmerging mail-client/mailx-8.1.2.20021129-r2... No package files given... Grabbing a set. /usr/sbin/ebuild.sh: /var/db/pkg/mail-client/mailx-8.1.2.20021129-r2/mailx-8.1.2.20021129-r2.ebuild: line 40: unexpected EOF while looking for matching `"' /usr/sbin/ebuild.sh: /var/db/pkg/mail-client/mailx-8.1.2.20021129-r2/mailx-8.1.2.20021129-r2.ebuild: line 67: syntax error: unexpected end of file  !!! ERROR: mail-client/mailx-8.1.2.20021129-r2 failed. !!! Function , Line 1294, Exitcode 1 !!! error sourcing ebuild  !!! FAILED prerm: 1 root@hybrid:~# ./2004-07-23-fixvardbentries  bunzip2: Can't open input file /var/db/pkg/app-admin/logrotate-3.6.5-r1/environment.bz2: No such file or directory. Traceback (most recent call last):   File "./2004-07-23-fixvardbentries", line 70, in ?     fix_entries(vardb+cat+"/"+pkg)   File "./2004-07-23-fixvardbentries", line 17, in fix_entries     envfile = open(path+"environment") IOError: [Errno 2] No such file or directory: '/var/db/pkg/app-admin/logrotate-3.6.5-r1/environment' root@hybrid:~# ls /var/db/pkg/app-admin/logrotate-3.6.5-r1/ CATEGORY  CC       CFLAGS  CONTENTS  CXX       DEPEND   PDEPEND  PROVIDE  SLOT  logrotate-3.6.5-r1.ebuild CBUILD    CDEPEND  CHOST   COUNTER   CXXFLAGS  LICENSE  PF       RDEPEND  USE root@hybrid:~# emerge info Portage 2.0.50-r9 (default-1.0, gcc-2.95.3, glibc-2.2.5-r4,2.2.5-r9, 2.4.25-hybrid-1) ================================================================= System uname: 2.4.25-hybrid-1 i586 AMD-K6(tm) 3D processor Gentoo Base System version 1.4.16 distcc 2.13 i586-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] Autoconf: sys-devel/autoconf-2.59-r3 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-mcpu=k6" CHOST="i586-pc-linux-gnu" COMPILER="" 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/alias /var/qmail/control" CONFIG_PROTECT_MASK="/etc/afs/C /etc/afs/afsws /etc/afs/modload /etc/gconf /etc/make.globals /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -mcpu=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://192.168.1.2/gentoo http://mirrors.sec.informatik.tu-darmstadt.de/gentoo http://ftp.easynet.nl/mirror/gentoo/ ftp://ftp.easynet.nl/mirror/gentoo/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://hybrid.sascha.silbe.org/gentoo-portage" USE="3dnow X acl afs berkdb cdr crypt gdbm imlib ipv6 j-noaim j-nomsn j-noyahoo jpeg krb4 libg++ libwww mikmod mmx mpeg nas ncurses nls oggvorbis oss pam pdflib perl png python readline scanner slang spell ssl tetex tiff truetype x86 xml2"  root@hybrid:~#  
Comment 28 Jason Stubbs (RETIRED) gentoo-dev 2004-07-29 08:07:57 UTC
The escaping in fixdbentries isn't fixed in 2.0.50-r9. Nick, can you add the following in and push out another release? The longer this waits, the more corruption occurs...

-		mycontent = re.sub(old_value+"(\s)", new_value+"\1", mycontent)
-		mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\1", mycontent)
-		mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\1", mycontent)
+		mycontent = re.sub(old_value+"(\\s)", new_value+"\\1", mycontent)
+		mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\\1", mycontent)
+		mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\\1", mycontent)

As for the corruption that's already out there, I'll see if I can fix that script.
Comment 29 Tom P. 2004-07-29 14:46:34 UTC
This is a difficult bug to search for :-)

I just found and fixed 4 /var/db/pkg/XXX.ebuild's with corruption in them.  I found the first because of this error when emerge was cleaning old sox after upgrade today:
>>> Unmerging media-sound/sox-12.17.4-r1...
No package files given... Grabbing a set.
/usr/sbin/ebuild.sh: /var/db/pkg/media-sound/sox-12.17.4-r1/sox-12.17.4-r1.ebuild: line 27: unexpected EOF while looking for matching `"'
/usr/sbin/ebuild.sh: /var/db/pkg/media-sound/sox-12.17.4-r1/sox-12.17.4-r1.ebuild: line 45: syntax error: unexpected end of file


I found an a char 0x01 (hex 01) in this file.  Searching /var/db/pkg/*.ebuild found 3 more of this bogus char in ebuilds.  Only 1 of the four ebuilds, sox, was actually missing an " in the DEPEND line maybe overwritten by the bad char?

Looking at the past entries in this bug makes me wonder if this is related to this error:
Invalid package name: xfree-4.3.0-r6/xfree-4.3.0-r6
when trying to emerge --usepkg xfree

The full bug I was about to enter:

I tried to switch to xorg so I made quickpkg's of xfree.  After trying xorg and wanting to switch back to xfree I got this error and had to compile the whole xfree package again.

1.  I can ftp this package to another box and emerge it with no problems.  It must be specific to this one box.  

2.  This box can emerge other packages with the sampling I've tested, just not xfree or xorg.

3. I have emerged portage and gentoolkit again on this box.

It seems to me that after unpacking the binary emerge is called with a bad package category.  Can someone point me to in the right direction?

The error message comes from /usr/lib/portage/pym/portage.py lines 3577-3582
===================
	elif operator in [">", ">=", "<", "<="]:
		for x in candidate_list:
			try:
				result = pkgcmp(pkgsplit(x), [cat+"/"+pkg,ver,rev])
			except:
				writemsg("\nInvalid package name: %s\n" % x)
=================



The whole failed event-----
gate1 root # quickpkg xfree
 * Building package for xfree-4.3.0-r6...                                                                             [ ok ]

 * Packages now in /usr/portage/packages:
 * xfree-4.3.0-r6: 55M
gate1 root # emerge --usepkg xfree
Calculating dependencies ...done!
>>> emerge (1 of 1) x11-base/xfree-4.3.0-r6 to /
>>> extracting info
>>> extracting xfree-4.3.0-r6
>>> Merging x11-base/xfree-4.3.0-r6 to /

Invalid package name: xfree-4.3.0-r6/xfree-4.3.0-r6
gate1 root # emerge info
Portage 2.0.50-r9 (default-x86-2004.2, gcc-3.3.3, glibc-2.3.3.20040420-r0, 2.6.6-rc2-love2)
=================================================================
System uname: 2.6.6-rc2-love2 i686 Pentium II (Deschutes)
Gentoo Base System version 1.4.16
distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium2 -O2  -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /usr/X11R6/bin/startx /etc/env.d"
CXXFLAGS="-march=pentium2 -O2  -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org http://www.gtlib.cc.gatech.edu/pub/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X alsa apache1 apm arts avi berkdb bonobo cdr crypt cups directfb dvd dvdr encode foomaticdb gdbm gif gphoto2 imlib java jpeg kde libwww mikmod mmx mozilla mpeg mysql ncurses oggvorbis opengl oss pam perl png python qt quicktime readline samba scanner sdl slang spell ssl svga tcpd truetype usb x86 xml2 xmms xv xvid zlib"

Comment 30 Marius Mauch (RETIRED) gentoo-dev 2004-07-30 09:50:54 UTC
*** Bug 58884 has been marked as a duplicate of this bug. ***
Comment 31 Jeremy Huddleston (RETIRED) gentoo-dev 2004-07-30 14:29:02 UTC
*** Bug 58804 has been marked as a duplicate of this bug. ***
Comment 32 Jason Stubbs (RETIRED) gentoo-dev 2004-07-31 21:55:49 UTC
Created attachment 36556 [details]
Script to fix /var/db/pkg

Scans for the ebuild instead of assuming the filename matches the directory.
Checks and fixes unbalanced quotes caused by \001.
Comment 33 Sascha Silbe 2004-08-01 09:42:42 UTC
Even the new version of the script is unable to fix sox-12.17.4-r1 and it certainly does not like being called several times:  broken ebuild sox-12.17.4-r1.ebuild Traceback (most recent call last):   File "./2004-07-23-fixvardbentries", line 108, in ?     del portage.mtimedb["updates"] KeyError: 'updates'  
Comment 34 Jeremy Huddleston (RETIRED) gentoo-dev 2004-08-02 12:32:47 UTC
*** Bug 59157 has been marked as a duplicate of this bug. ***
Comment 35 Jeremy Huddleston (RETIRED) gentoo-dev 2004-08-02 12:34:05 UTC
*** Bug 58801 has been marked as a duplicate of this bug. ***
Comment 36 SpanKY gentoo-dev 2004-08-02 20:02:25 UTC
*** Bug 52289 has been marked as a duplicate of this bug. ***
Comment 37 Tom Knight (RETIRED) gentoo-dev 2004-08-04 11:19:32 UTC
*** Bug 59426 has been marked as a duplicate of this bug. ***
Comment 38 Tom Knight (RETIRED) gentoo-dev 2004-08-04 11:22:13 UTC
*** Bug 59415 has been marked as a duplicate of this bug. ***
Comment 39 Jon Hood (RETIRED) gentoo-dev 2004-08-04 14:35:11 UTC
*** Bug 58468 has been marked as a duplicate of this bug. ***
Comment 40 Tom Knight (RETIRED) gentoo-dev 2004-08-05 09:59:16 UTC
*** Bug 59532 has been marked as a duplicate of this bug. ***
Comment 41 Tom Knight (RETIRED) gentoo-dev 2004-08-05 10:09:23 UTC
*** Bug 45912 has been marked as a duplicate of this bug. ***
Comment 42 Jeremy Huddleston (RETIRED) gentoo-dev 2004-08-05 13:15:48 UTC
*** Bug 59466 has been marked as a duplicate of this bug. ***
Comment 43 Frank van de Pol (RETIRED) gentoo-dev 2004-08-10 11:34:40 UTC
*** Bug 59577 has been marked as a duplicate of this bug. ***
Comment 44 crusaderky 2004-08-11 03:43:22 UTC
./fixvardbentries
Traceback (most recent call last):
  File "./fixvardbentries", line 105, in ?
    fix_entries(vardb+cat+"/"+pkg)
  File "./fixvardbentries", line 86, in fix_entries
    quotes += orig[x].count('"')
IndexError: list index out of range
Comment 45 Jason Stubbs (RETIRED) gentoo-dev 2004-08-11 04:36:39 UTC
Created attachment 37209 [details]
Script to fix /var/db/pkg

Please try this one
Comment 46 Bryan Østergaard (RETIRED) gentoo-dev 2004-08-13 13:21:21 UTC
*** Bug 60230 has been marked as a duplicate of this bug. ***
Comment 47 Jason Stubbs (RETIRED) gentoo-dev 2004-08-16 04:13:36 UTC
*** Bug 60433 has been marked as a duplicate of this bug. ***
Comment 48 Sascha Silbe 2004-08-16 06:42:02 UTC
Output of the new script (comment #45):

Unfixable ebuild sox-12.17.4-r1.ebuild
Please attach it to bug 46906


I'll attach the ebuild to this bug (#46096).

Comment 49 Sascha Silbe 2004-08-16 06:44:33 UTC
Created attachment 37526 [details]
/var/db/pkg/media-sound/sox-12.17.4-r1/sox-12.17.4-r1.ebuild
Comment 50 Sascha Silbe 2004-08-16 09:12:18 UTC
Created attachment 37536 [details, diff]
Patch against the script from comment #45 to fix the quote fixing

There are 2 errors in the script from comment #45 (and probably in the ones
before, too):

1. Improper check for even number of quotes
   quotecount/2 always is the same as int(quotecount/2). Use (quotecount % 2)
instead.

2. orig[x] is a string and as such cannot be modified
   Use 
   orig[x] = orig[x][:y] + '"' + orig[x][y+1:]
   instead of 
   orig[x][y] = '"'


The attached patch fixes both bugs.
Comment 51 Sascha Silbe 2004-08-16 09:13:25 UTC
Created attachment 37537 [details]
The fixed script

The script with the above patch applied.
Comment 52 Sascha Silbe 2004-08-16 09:54:43 UTC
Created attachment 37541 [details]
New version of the script with support for unpacked "environment"

This version will compress an "environment" file if found. Fixes the "no
environment.bz2 found => package not fixed" problem.
Comment 53 Sascha Silbe 2004-08-16 18:15:17 UTC
The current script (from comment #52) fixes the broken ebuilds on all but one of my hosts.
On the remaining host the "environment[.bz2]" file is missing, maybe by accident.

Comment 54 Jason Stubbs (RETIRED) gentoo-dev 2004-08-17 06:54:51 UTC
Created attachment 37591 [details]
Script to fix /var/db/pkg

Thanks for the work Sascha. I guess I was confusing languages again...

Incorporated your fixes and added friendly output at each of the failure
points. Still won't be able to fix all ebuilds though, but will usually be able
to do enough to be able to unmerge.
Comment 55 Frank van de Pol (RETIRED) gentoo-dev 2004-08-20 10:57:07 UTC
*** Bug 60073 has been marked as a duplicate of this bug. ***
Comment 56 Frank van de Pol (RETIRED) gentoo-dev 2004-08-22 05:53:25 UTC
*** Bug 61104 has been marked as a duplicate of this bug. ***
Comment 57 Jason Stubbs (RETIRED) gentoo-dev 2004-08-25 16:45:15 UTC
*** Bug 61667 has been marked as a duplicate of this bug. ***
Comment 58 Jeremy Huddleston (RETIRED) gentoo-dev 2004-08-29 03:19:34 UTC
*** Bug 62052 has been marked as a duplicate of this bug. ***
Comment 59 Nicholas Jones (RETIRED) gentoo-dev 2004-09-07 17:06:32 UTC
in 50-r11
Comment 60 Sascha Silbe 2004-09-12 09:40:42 UTC
I've now found another (previously untouched) host where the environment file is missing:

snake root # ls /var/db/pkg/mail-client/mailx-8.1.2.20021129-r2      
CATEGORY  CC       CFLAGS  CONTENTS  CXX       DEPEND   PDEPEND  PROVIDE  SLOT  mailx-8.1.2.20021129-r2.ebuild
CBUILD    CDEPEND  CHOST   COUNTER   CXXFLAGS  LICENSE  PF       RDEPEND  USE
snake root # emerge info
Portage 2.0.50-r11 (default-x86-1.4, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.4.22-gentoo-r2)
=================================================================
System uname: 2.4.22-gentoo-r2 i686 AMD Athlon(tm) XP 1600+ 
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-mcpu=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/make.globals /etc/terminfo /etc/env.d"
CXXFLAGS="-mcpu=athlon-xp -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache fixpackages sandbox"
GENTOO_MIRRORS="ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dfx X aalib avi berkdb bitmap-fonts cdr crypt dvd encode esd gdbm gif gnome gphoto2 gtk gtk2 guile imlib ipv6 java jpeg kde libg++ libwww mad maildir mikmod motif mozilla mpeg ncurses nls oggvorbis opengl oss pam pdflib png quicktime readline sdl slang spell ssl svga tcpd truetype usb x86 xml2 xprint xv zlib"

snake root # 

Comment 61 SpanKY gentoo-dev 2004-09-21 17:15:14 UTC
*** Bug 64915 has been marked as a duplicate of this bug. ***
Comment 62 Nicholas Jones (RETIRED) gentoo-dev 2004-10-22 08:47:49 UTC
Bug has been fixed and released in stable portages on or before 2.0.51-r2
Comment 63 Marius Mauch (RETIRED) gentoo-dev 2004-10-23 07:55:09 UTC
*** Bug 68639 has been marked as a duplicate of this bug. ***
Comment 64 Aaron Walker (RETIRED) gentoo-dev 2005-05-10 10:58:27 UTC
*** Bug 91889 has been marked as a duplicate of this bug. ***