[pacman-dev] [PATCH 2/6] repo-add: fail early if repo can not be created
shiningxc at gmail.com
Sun Mar 1 05:49:55 EST 2009
On Sun, Mar 1, 2009 at 6:57 AM, Allan McRae <allan at archlinux.org> wrote:
> I thought about this too but I was less scared when I noticed that this is
> only done when the db file is not found. So you are only removing the db
> file created in the touch statement.
Indeed. However when the db file is found, I didn't even check it was
also writable in that case.
And we have a race condition huge like a mountain here. There can be
several minutes spent between this write/creation check is made, and
the actual write of the new database.
It would probably be a good idea to write a lock file for each
database ($REPO.lck) so that there is never more than one repo-add
instance running for one given db.
For these reasons, I will just drop that patch for now, for rewriting it later.
More information about the pacman-dev