diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 18c4c7fa32c..a98319e4af1 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -28,7 +28,7 @@ deps_public_maybe_subproject = [ subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/big-objs') -# Check for each of these functions, and create a define like `#define HAVE_LCHOWN 1`. +# Check for each of these functions, and create a define like `#define HAVE_SYSCONF 1`. check_funcs = [ 'sysconf', ] diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 3bd4796b73e..4d9b22f56f9 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -68,10 +68,8 @@ endif summary('can hardlink to symlink', can_link_symlink, bool_yn : true) configdata_priv.set('CAN_LINK_SYMLINK', can_link_symlink.to_int()) -# Check for each of these functions, and create a define like `#define HAVE_LCHOWN 1`. +# Check for each of these functions, and create a define like `#define HAVE_POSIX_FALLOCATE 1`. check_funcs = [ - # Optionally used for canonicalising files from the build - 'lchown', 'posix_fallocate', 'statvfs', ] diff --git a/src/libstore/posix-fs-canonicalise.cc b/src/libstore/posix-fs-canonicalise.cc index fe1d0031622..7af63755e5d 100644 --- a/src/libstore/posix-fs-canonicalise.cc +++ b/src/libstore/posix-fs-canonicalise.cc @@ -107,19 +107,9 @@ canonicalisePathMetaData_(const Path & path, CanonicalizePathMetadataOptions opt canonicaliseTimestampAndPermissions(path, st); #ifndef _WIN32 - /* Change ownership to the current uid. If it's a symlink, use - lchown if available, otherwise don't bother. Wrong ownership - of a symlink doesn't matter, since the owning user can't change - the symlink and can't delete it because the directory is not - writable. The only exception is top-level paths in the Nix - store (since that directory is group-writable for the Nix build - users group); we check for this case below. */ + /* Change ownership to the current uid. */ if (st.st_uid != geteuid()) { -# if HAVE_LCHOWN if (lchown(path.c_str(), geteuid(), getegid()) == -1) -# else - if (!S_ISLNK(st.st_mode) && chown(path.c_str(), geteuid(), getegid()) == -1) -# endif throw SysError("changing owner of '%1%' to %2%", path, geteuid()); } #endif @@ -135,17 +125,6 @@ canonicalisePathMetaData_(const Path & path, CanonicalizePathMetadataOptions opt void canonicalisePathMetaData(const Path & path, CanonicalizePathMetadataOptions options, InodesSeen & inodesSeen) { canonicalisePathMetaData_(path, options, inodesSeen); - -#ifndef _WIN32 - /* On platforms that don't have lchown(), the top-level path can't - be a symlink, since we can't change its ownership. */ - auto st = lstat(path); - - if (st.st_uid != geteuid()) { - assert(S_ISLNK(st.st_mode)); - throw Error("wrong ownership of top-level store path '%1%'", path); - } -#endif } void canonicalisePathMetaData(const Path & path, CanonicalizePathMetadataOptions options)