From 06557299b30f53c6d4a1a2e3068f36d9ef3df904 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 21 Sep 2021 13:45:11 +0200 Subject: [PATCH] Allow relative paths anywhere into the parent's store path --- src/libfetchers/path.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc index b35c04cfc..fb5702c4c 100644 --- a/src/libfetchers/path.cc +++ b/src/libfetchers/path.cc @@ -95,8 +95,11 @@ struct PathInputScheme : InputScheme absPath = nix::absPath(path, parent); // for security, ensure that if the parent is a store path, it's inside it - if (store->isInStore(parent) && !isInDir(absPath, parent)) - throw BadStorePath("relative path '%s' [%s] points outside of its parent's store path '%s'", path, absPath, parent); + if (store->isInStore(parent)) { + auto storePath = store->printStorePath(store->toStorePath(parent).first); + if (!isInDir(absPath, storePath)) + throw BadStorePath("relative path '%s' points outside of its parent's store path '%s'", path, storePath); + } } else absPath = path;