mirror of
https://github.com/NixOS/nix
synced 2025-06-28 05:21:16 +02:00
UnionSourceAccessor: Don't filter out underlying files of the wrong type
https://github.com/NixOS/nix/pull/12512#discussion_r1961567140
This commit is contained in:
parent
99e78c37f7
commit
584ddd1b4d
2 changed files with 3 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
||||||
#include "eval.hh"
|
#include "eval.hh"
|
||||||
#include "store-api.hh"
|
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct UnionSourceAccessor : SourceAccessor
|
||||||
{
|
{
|
||||||
for (auto & accessor : accessors) {
|
for (auto & accessor : accessors) {
|
||||||
auto st = accessor->maybeLstat(path);
|
auto st = accessor->maybeLstat(path);
|
||||||
if (st && st->type == Type::tRegular)
|
if (st)
|
||||||
return accessor->readFile(path);
|
return accessor->readFile(path);
|
||||||
}
|
}
|
||||||
throw FileNotFound("path '%s' does not exist", showPath(path));
|
throw FileNotFound("path '%s' does not exist", showPath(path));
|
||||||
|
@ -37,7 +37,7 @@ struct UnionSourceAccessor : SourceAccessor
|
||||||
DirEntries result;
|
DirEntries result;
|
||||||
for (auto & accessor : accessors) {
|
for (auto & accessor : accessors) {
|
||||||
auto st = accessor->maybeLstat(path);
|
auto st = accessor->maybeLstat(path);
|
||||||
if (!st || st->type != Type::tDirectory)
|
if (!st)
|
||||||
continue;
|
continue;
|
||||||
for (auto & entry : accessor->readDirectory(path))
|
for (auto & entry : accessor->readDirectory(path))
|
||||||
// Don't override entries from previous accessors.
|
// Don't override entries from previous accessors.
|
||||||
|
@ -50,7 +50,7 @@ struct UnionSourceAccessor : SourceAccessor
|
||||||
{
|
{
|
||||||
for (auto & accessor : accessors) {
|
for (auto & accessor : accessors) {
|
||||||
auto st = accessor->maybeLstat(path);
|
auto st = accessor->maybeLstat(path);
|
||||||
if (st && st->type == Type::tSymlink)
|
if (st)
|
||||||
return accessor->readLink(path);
|
return accessor->readLink(path);
|
||||||
}
|
}
|
||||||
throw FileNotFound("path '%s' does not exist", showPath(path));
|
throw FileNotFound("path '%s' does not exist", showPath(path));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue