Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 50332 - emerge (portage) crashes when performing global update and there is 3rd level subdir in var/db/pkg
Summary: emerge (portage) crashes when performing global update and there is 3rd level...
Status: RESOLVED DUPLICATE of bug 51584
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-07 03:09 UTC by Konstantin Münning
Modified: 2005-07-17 13:06 UTC (History)
0 users

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 Konstantin Münning 2004-05-07 03:09:07 UTC
When there is a 3rd level directory in /var/db/pkg when a global update is due /usr/lib/portage/pym/portage.py aborts with the python error message:

Performing Global Updates: /usr/portage/profiles/updates/2Q-2004
(Could take a couple minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  @='/var/db move'
  s='/var/db SLOT move' S='binary SLOT move'
.............................@Traceback (most recent call last):
  File "/usr/bin/emerge", line 14, in ?
    import portage
  File "/usr/lib/portage/pym/portage.py", line 6343, in ?
    do_upgrade(mykey)
  File "/usr/lib/portage/pym/portage.py", line 6263, in do_upgrade
    db["/"]["vartree"].dbapi.move_ent(mysplit)
  File "/usr/lib/portage/pym/portage.py", line 4050, in move_ent
    fixdbentries(origcp, newcp, pkgdir)
  File "/usr/lib/portage/pym/portage.py", line 3409, in fixdbentries
    f = open(dbdir+"/"+myfile, "r")
IOError: [Errno 21] Is a directory

As far as I can remember this third level directory appeared after I had done something like

ebuild /var/db/pkg/net-mail/uw-imap-2002e-r1/uw-imap-2002e-r1.ebuild digest

after changing compile options in that ebuild to suit my needs. However, after inspected fixdbentries in portage.py there it is simply assumed that in

3408:         for myfile in [f for f in os.listdir(dbdir) if not f == "CONTENTS"]:

every entry returned by os.listdir(dbdir) is a file. In my case there was the directory files which caused the error. So adding an os.path.isdir() check and skipping (or deleting) the wrong entry would be a good idea IMHO.


Reproducible: Always
Steps to Reproduce:
1. create a 3rd-level directory in var/db/pkg like:
mkdir -p /var/db/pkg/a/b/c/
2. If there are no updates due then (maybe that's not the best way):
touch /usr/portage/profiles/updates/2Q-2004
3. emerge

Actual Results:  
See program output shown in Details.

Expected Results:  
Perform global update.
Comment 1 Daniel Black (RETIRED) gentoo-dev 2004-05-07 09:50:29 UTC
which version of portage?
Comment 2 Konstantin Münning 2004-05-07 13:01:16 UTC
Should be most recent: 2.0.50-r6
Comment 3 Nicholas Jones (RETIRED) gentoo-dev 2004-05-20 11:56:34 UTC
Requires more fixing than just that particular problem.
I'd rather leave it tracebacking on strange layouts than
simply ignoring that something has done something wrong.

*** This bug has been marked as a duplicate of 51584 ***
Comment 4 FUJINAKA Tohru 2004-07-02 01:49:17 UTC
In my case it crushed because of qmail/files/.
 /var/db/pkg/mail-mta/qmail-1.03-r13:
drwxr-xr-x  3 root root   624 Jun 17 14:15 ./
drwxr-xr-x  3 root root    80 Jun 11 14:21 ../
-rw-r--r--  1 root root     9 Jun 11 14:21 CATEGORY
  -- snip --
drwxr-xr-x  3 root root    72 Jun 17 14:15 files/
-rw-r--r--  1 root root 14101 Jun 11 14:21 qmail-1.03-r13.ebuild


emerge should report on what is wrong and continue things instead of be crushed. Or it will make gentoo users waste a much of time. 

Now you know that the layout would have wrong directory, don't you?
So please help users won't face the crush.

I think you can make (small) test tool checks correctness of the layout.