[gentoo-user] messagebus keeps 0wning my files

2010-06-22 Thread Albert Hopkins
I've had this problem for a while now but it's finally driven me mad.

I have a directory with some local mercurial repos.  I'm the only user
who touches these repos.

Things will go fine for a while, and suddenly I'll do a commit and then
hg will die with 

abort: Permission denied:

on one of the ./hg/* files.  When I look at the file I'll find it's
owned by 1000:messagebus.  So I'm too busy to investigate so I just
sudo chown -R $USER:users ~/path/to/repo and go along my way... then
the next day—or whenever—the same thing happens again!

It's weird because I don't have a user with uid=1000 in /etc/passwd, but
messagebus has a gid=1000.  Also the seems to only happen to the two Hg
repos I am working on.

The last time this happened (just now), the mtime on the file is 18
June.  The ctime is 19 June (the fs is mounted with noatime).  The last
time I did the chown thing was on the 20th (so the ctime kinda doesn't
make sense, if I understand correctly), so could this possibly be a bug
in the fs (ext4)?







Re: [gentoo-user] messagebus keeps 0wning my files [SOLVED]

2010-06-22 Thread Albert Hopkins
Well this was interesting...

One thing that mercurial does is if you clone a repo and the target
directory is on the same filesystem as the source, it create hardlinks
of files on the destination for efficiency.  Well this is fine, but...

One of the things my project does is create a virtual appliance of
itself, and how it does that is it creates a chroot, installs gentoo,
installs itself, and then copies the chroot to a disk image.  Well, this
happens on the same filesystem (as root) and in the appliance-making
process a user is created in the chroot and also the rep is cloned
inside the chroot and chowned to that user.  Well the first regular uid
is 1000 and since hg clone was making symlinks, my repo got ownership
changed to the user inside the chroot :|

So the fix is to use hg clone with the --pull option to prevent
mercurial from creating hard links.