Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 114133 - Portage world files sometimes gets truncated
Summary: Portage world files sometimes gets truncated
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: x86 Linux
: High critical (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
: 128362 (view as bug list)
Depends on:
Blocks: 115839
  Show dependency tree
 
Reported: 2005-12-01 04:28 UTC by Jo Are Rosland
Modified: 2006-07-25 20:54 UTC (History)
1 user (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 Jo Are Rosland 2005-12-01 04:28:33 UTC
My Portage world file seems to have been emptied sometime during the last few
weeks.  It currently only contains names of a few recently emerged packages.

Specifics of my system:

- I run /var as a separate partition (4GB)

- Some time ago I got an error from 'emerge -vpuDN world' which turned out to be
due to /var having filled up (My /var/log/messages file had grown to over 3GB,
due to excessive amounts of logging from a kernel module)

From this I guess the problem is related to how the world file is updated: that
maybe this is done in a way that may fail if eg. the partition is full.

I've seen some comments attached to other bugs that hint to similar problems;
nobody have been able to pin point the exact conditions under which this is
happening, though.


Reproducible: Didn't try
Steps to Reproduce:
1. Fill /var partition
2. Try to run an emerge



Expected Results:  
Emerge should fail early if the world file can not be updated safely for some
reason.
Comment 1 Brian Harring (RETIRED) gentoo-dev 2005-12-01 23:34:01 UTC
writedict calls lack any form of error checking...
I'm inclined to just have them throw an exception when failures occur.
This immediately makes any failing code puke instead of silently swallowing it.
 Also deviates from the grab/write norms though.

Thoughts?
Comment 2 Jason Stubbs (RETIRED) gentoo-dev 2005-12-21 08:19:06 UTC
writedict() swallows the exception when it can't open the file for writing, but it has nothing after that. It would seem that there's no way to know that the write has failed...
Comment 3 Brian Harring (RETIRED) gentoo-dev 2005-12-21 23:24:59 UTC
So... throw the exception, imo.
We add in an optional swallow_exceptions=False, sed the existing code to set it to true ('cept where we need to have it puke), then gradually ween the code away from swallow_exceptions=True

Thoughts?
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2005-12-22 03:58:11 UTC
My point is that the only time an exception is raised is when it fails to open the file. If the open fails, no data will be lost. What seems to be happening is that the file is opened successfully (and truncated), data is written into the buffer and then the file is closed yet the close fails without any exception being raised.
Comment 5 Brian Harring (RETIRED) gentoo-dev 2005-12-24 01:07:40 UTC
write to a tmp file, mv it into place via a rename...
nice way to handle atomicity issues also.
Comment 6 Brian Harring (RETIRED) gentoo-dev 2005-12-24 02:08:24 UTC
fixed in svn.
Comment 7 Zac Medico gentoo-dev 2006-07-25 20:54:02 UTC
*** Bug 128362 has been marked as a duplicate of this bug. ***