Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [gentoo-dev-portage] [PATCH] prevent world file corruption by writing atomically
Date: Tue, 24 Jan 2006 09:07:57
Message-Id: 20060124090609.GB31519@nightcrawler.had1.or.comcast.net
In Reply to: [gentoo-portage-dev] [gentoo-dev-portage] [PATCH] prevent world file corruption by writing atomically by Zac Medico
1 On Tue, Jan 24, 2006 at 12:48:55AM -0800, Zac Medico wrote:
2 > -----BEGIN PGP SIGNED MESSAGE-----
3 > Hash: SHA1
4 >
5 > Hi all,
6 >
7 > There is dangerous handling of world file updates throughout
8 > portage. The attached patch wraps all world file updates in a
9 > write_atomic() function which is designed to prevent interprocess
10 > interference and prevent corruption when an 'out of space' error
11 > occurs. Brian pointed out that portage_util.writedict() already
12 > does a similar routine, but it is designed exclusively to write a
13 > dictionary object.
14
15 the atomic writing of data in writedict could be gutted out to a
16 derivative of the file class; via that, same underlying atomic update
17 code for writedict and wordfile updates...
18
19 Zach, game for that mod? ;)
20 ~harring

Replies