LocalStoreAccessor: Fix handling of diverted stores

This commit is contained in:
Eelco Dolstra 2017-05-02 15:07:11 +02:00
parent 7f6837a0f6
commit c5bea16611
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -31,7 +31,7 @@ struct LocalStoreAccessor : public FSAccessor
auto realPath = toRealPath(path); auto realPath = toRealPath(path);
struct stat st; struct stat st;
if (lstat(path.c_str(), &st)) { if (lstat(realPath.c_str(), &st)) {
if (errno == ENOENT || errno == ENOTDIR) return {Type::tMissing, 0, false}; if (errno == ENOENT || errno == ENOTDIR) return {Type::tMissing, 0, false};
throw SysError(format("getting status of %1%") % path); throw SysError(format("getting status of %1%") % path);
} }
@ -51,7 +51,7 @@ struct LocalStoreAccessor : public FSAccessor
{ {
auto realPath = toRealPath(path); auto realPath = toRealPath(path);
auto entries = nix::readDirectory(path); auto entries = nix::readDirectory(realPath);
StringSet res; StringSet res;
for (auto & entry : entries) for (auto & entry : entries)
@ -73,7 +73,8 @@ struct LocalStoreAccessor : public FSAccessor
ref<FSAccessor> LocalFSStore::getFSAccessor() ref<FSAccessor> LocalFSStore::getFSAccessor()
{ {
return make_ref<LocalStoreAccessor>(ref<LocalFSStore>(std::dynamic_pointer_cast<LocalFSStore>(shared_from_this()))); return make_ref<LocalStoreAccessor>(ref<LocalFSStore>(
std::dynamic_pointer_cast<LocalFSStore>(shared_from_this())));
} }
void LocalFSStore::narFromPath(const Path & path, Sink & sink) void LocalFSStore::narFromPath(const Path & path, Sink & sink)