All portage components stop working if /var/cache/edb/mtimedb is corrupted. There should be some way to recover from this.
Created attachment 5994 [details] The corrupted mtimedb
This won't happen in a current (2.0.44) portage. Include 'emerge info' and a traceback in your report if upgrading doesn't fix the problem.
Someting closely related I think: Two days ago, while I was using portage-2.0.45-r? (don't remember exactly, but I'm using ~x86 and update quite often), I had a segfault at the end of an emerge. I then tried to re-run the command, but had some error messages from emerge (sorry, I don't have any log, but it was pointing to code that checks thing in the mtimedb). My first thought was to untar the emergency portage (sorry, don't know the version, but my tree was only a few days old) to check if it was a bug of my current version... but it raised the same error. I've then moved away the mtimedb file, which was probably corrupted, and ask for an "emerge -u world". This time, without the corrupted mtimedb, portage was able to run fine. The first package to update was "sed"... building worked fine, then merging, then cleaning out the old version... ouch! the newly installed "sed" program was also removed. It was really painfull for me to get back a working system, because without "sed" you can't run a single configure script, even the sed's one... But this is a different story, it was just very bad luck that sed was the first one to be updated this day. The real problem is that if you remove your mtimedb, then portage (at least this recovery version, which is supposed to be a safe one) can remove some just merged files. Maybe it was a very bad idea to remove the mtimedb, or maybe I should have run some commands to rebuild a db after having installed recovery portage, I don't know... but their is something dangerous somewhere that portage can probably prevent (for example: avoid cleaning files if you can't check their date). PS: sorry for the lack of precise version numbers, logs, etc... but my first thought was really far from the bugreporting.
Sounds like you have a corrupt set of counters... portage-2.0.46 fixes this a lot better.