mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Merge pull request #11726 from Mic92/warn-large-threshold
warn-large-path-threshold: define 0 as number to disable warnings
This commit is contained in:
commit
7b7a61b3d7
2 changed files with 5 additions and 6 deletions
|
@ -1227,14 +1227,13 @@ public:
|
||||||
|
|
||||||
Setting<uint64_t> warnLargePathThreshold{
|
Setting<uint64_t> warnLargePathThreshold{
|
||||||
this,
|
this,
|
||||||
// n.b. this is deliberately int64 max rather than uint64 max because
|
0,
|
||||||
// this goes through the Nix language JSON parser and thus needs to be
|
|
||||||
// representable in Nix language integers.
|
|
||||||
std::numeric_limits<int64_t>::max(),
|
|
||||||
"warn-large-path-threshold",
|
"warn-large-path-threshold",
|
||||||
R"(
|
R"(
|
||||||
Warn when copying a path larger than this number of bytes to the Nix store
|
Warn when copying a path larger than this number of bytes to the Nix store
|
||||||
(as determined by its NAR serialisation).
|
(as determined by its NAR serialisation).
|
||||||
|
Default is 0, which disables the warning.
|
||||||
|
Set it to 1 to warn on all paths.
|
||||||
)"
|
)"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -171,7 +171,7 @@ std::pair<StorePath, Hash> StoreDirConfig::computeStorePath(
|
||||||
PathFilter & filter) const
|
PathFilter & filter) const
|
||||||
{
|
{
|
||||||
auto [h, size] = hashPath(path, method.getFileIngestionMethod(), hashAlgo, filter);
|
auto [h, size] = hashPath(path, method.getFileIngestionMethod(), hashAlgo, filter);
|
||||||
if (size && *size >= settings.warnLargePathThreshold)
|
if (settings.warnLargePathThreshold && size && *size >= settings.warnLargePathThreshold)
|
||||||
warn("hashed large path '%s' (%s)", path, renderSize(*size));
|
warn("hashed large path '%s' (%s)", path, renderSize(*size));
|
||||||
return {
|
return {
|
||||||
makeFixedOutputPathFromCA(
|
makeFixedOutputPathFromCA(
|
||||||
|
@ -214,7 +214,7 @@ StorePath Store::addToStore(
|
||||||
auto sink = sourceToSink([&](Source & source) {
|
auto sink = sourceToSink([&](Source & source) {
|
||||||
LengthSource lengthSource(source);
|
LengthSource lengthSource(source);
|
||||||
storePath = addToStoreFromDump(lengthSource, name, fsm, method, hashAlgo, references, repair);
|
storePath = addToStoreFromDump(lengthSource, name, fsm, method, hashAlgo, references, repair);
|
||||||
if (lengthSource.total >= settings.warnLargePathThreshold)
|
if (settings.warnLargePathThreshold && lengthSource.total >= settings.warnLargePathThreshold)
|
||||||
warn("copied large path '%s' to the store (%s)", path, renderSize(lengthSource.total));
|
warn("copied large path '%s' to the store (%s)", path, renderSize(lengthSource.total));
|
||||||
});
|
});
|
||||||
dumpPath(path, *sink, fsm, filter);
|
dumpPath(path, *sink, fsm, filter);
|
||||||
|
|
Loading…
Reference in a new issue