mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
fix: Resolve CLI parent symlinks before adding to store
Fixes https://github.com/NixOS/nix/issues/11941
This commit is contained in:
parent
c0b64f3377
commit
ddbbf53767
3 changed files with 44 additions and 3 deletions
|
@ -183,7 +183,7 @@ static void opAdd(Strings opFlags, Strings opArgs)
|
|||
if (!opFlags.empty()) throw UsageError("unknown flag");
|
||||
|
||||
for (auto & i : opArgs) {
|
||||
auto sourcePath = PosixSourceAccessor::createAtRoot(i);
|
||||
auto sourcePath = PosixSourceAccessor::createAtRoot(makeParentCanonical(i));
|
||||
cout << fmt("%s\n", store->printStorePath(store->addToStore(
|
||||
std::string(baseNameOf(i)), sourcePath)));
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ static void opAddFixed(Strings opFlags, Strings opArgs)
|
|||
opArgs.pop_front();
|
||||
|
||||
for (auto & i : opArgs) {
|
||||
auto sourcePath = PosixSourceAccessor::createAtRoot(i);
|
||||
auto sourcePath = PosixSourceAccessor::createAtRoot(makeParentCanonical(i));
|
||||
std::cout << fmt("%s\n", store->printStorePath(store->addToStoreSlow(
|
||||
baseNameOf(i),
|
||||
sourcePath,
|
||||
|
|
|
@ -37,7 +37,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
|
|||
{
|
||||
if (!namePart) namePart = baseNameOf(path);
|
||||
|
||||
auto sourcePath = PosixSourceAccessor::createAtRoot(path);
|
||||
auto sourcePath = PosixSourceAccessor::createAtRoot(makeParentCanonical(path));
|
||||
|
||||
auto storePath = dryRun
|
||||
? store->computeStorePath(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue