diff options
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/path-info.cc | 11 | ||||
-rw-r--r-- | src/nix/verify.cc | 8 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/nix/path-info.cc b/src/nix/path-info.cc index 8497d708c3f0..d144ef082977 100644 --- a/src/nix/path-info.cc +++ b/src/nix/path-info.cc @@ -4,6 +4,7 @@ #include "store-api.hh" #include <iomanip> +#include <algorithm> using namespace nix; @@ -48,14 +49,14 @@ struct CmdPathInfo : StorePathsCommand for (auto & storePath : storePaths) pathLen = std::max(pathLen, storePath.size()); - for (auto & storePath : storePaths) { - if (!store->isValidPath(storePath)) - throw Error(format("path ‘%s’ is not valid") % storePath); + for (auto storePath : storePaths) { + auto info = store->queryPathInfo(storePath); + storePath = info->path; // FIXME: screws up padding - std::cout << storePath << std::string(pathLen - storePath.size(), ' '); + std::cout << storePath << std::string(std::max(0, (int) pathLen - (int) storePath.size()), ' '); if (showSize) { - std::cout << '\t' << std::setw(11) << store->queryPathInfo(storePath)->narSize; + std::cout << '\t' << std::setw(11) << info->narSize; } if (showClosureSize) { diff --git a/src/nix/verify.cc b/src/nix/verify.cc index fdbc2b0fde33..3844535e77df 100644 --- a/src/nix/verify.cc +++ b/src/nix/verify.cc @@ -98,7 +98,7 @@ struct CmdVerify : StorePathsCommand if (!noContents) { HashSink sink(info->narHash.type); - store->narFromPath(storePath, sink); + store->narFromPath(info->path, sink); auto hash = sink.finish(); @@ -106,7 +106,7 @@ struct CmdVerify : StorePathsCommand corrupted = 1; printMsg(lvlError, format("path ‘%s’ was modified! expected hash ‘%s’, got ‘%s’") - % storePath % printHash(info->narHash) % printHash(hash.first)); + % info->path % printHash(info->narHash) % printHash(hash.first)); } } @@ -138,7 +138,7 @@ struct CmdVerify : StorePathsCommand for (auto & store2 : substituters) { if (validSigs >= actualSigsNeeded) break; try { - doSigs(store2->queryPathInfo(storePath)->sigs); + doSigs(store2->queryPathInfo(info->path)->sigs); } catch (InvalidPath &) { } catch (Error & e) { printMsg(lvlError, format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what()); @@ -151,7 +151,7 @@ struct CmdVerify : StorePathsCommand if (!good) { untrusted++; - printMsg(lvlError, format("path ‘%s’ is untrusted") % storePath); + printMsg(lvlError, format("path ‘%s’ is untrusted") % info->path); } } |