From 151afd84dc9bf8f13de79a689f7f163fba7254ec Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 31 May 2016 17:58:46 +0200 Subject: daemon: Substitute queries return immediately when substitutes are disabled. Reported by Federico Beffa at . * nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths) (LocalStore::querySubstitutablePathInfos): Return when 'settings.useSubstitutes' is false. * tests/store.scm ("references/substitutes missing reference info"): Make sure to return #f on failure. * tests/store.scm ("substitutable-path-info when substitutes are turned off"): ("substitutable-paths when substitutes are turned off"): New tests. --- nix/libstore/local-store.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nix/libstore') diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc index 1eed0ca77f..347e8a703f 100644 --- a/nix/libstore/local-store.cc +++ b/nix/libstore/local-store.cc @@ -1213,6 +1213,9 @@ template T LocalStore::getIntLineFromSubstituter(RunningSubstituter & r PathSet LocalStore::querySubstitutablePaths(const PathSet & paths) { PathSet res; + + if (!settings.useSubstitutes) return res; + foreach (Paths::iterator, i, settings.substituters) { if (res.size() == paths.size()) break; RunningSubstituter & run(runningSubstituters[*i]); @@ -1239,6 +1242,8 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths) void LocalStore::querySubstitutablePathInfos(const Path & substituter, PathSet & paths, SubstitutablePathInfos & infos) { + if (!settings.useSubstitutes) return; + RunningSubstituter & run(runningSubstituters[substituter]); startSubstituter(substituter, run); if (run.disabled) return; -- cgit v1.2.3