daemon: Canonicalize gids to 0.

Previously files in the Nix store were owned by root or by nixbld,
depending on whether they were created by a substituter or by a
builder. This doesn't matter much, but causes spurious diffoscope
differences. So use root everywhere.
This commit is contained in:
Eelco Dolstra 2016-01-12 17:27:40 +01:00 committed by Ludovic Courtès
parent 7f3b2510d6
commit 56b8f56788
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -606,10 +606,10 @@ static void canonicalisePathMetaData_(const Path & path, uid_t fromUid, InodesSe
users group); we check for this case below. */
if (st.st_uid != geteuid()) {
#if HAVE_LCHOWN
if (lchown(path.c_str(), geteuid(), (gid_t) -1) == -1)
if (lchown(path.c_str(), geteuid(), getegid()) == -1)
#else
if (!S_ISLNK(st.st_mode) &&
chown(path.c_str(), geteuid(), (gid_t) -1) == -1)
chown(path.c_str(), geteuid(), getegid()) == -1)
#endif
throw SysError(format("changing owner of `%1%' to %2%")
% path % geteuid());