* [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question
@ 2021-09-01 19:05 Tobias Geerinckx-Rice via Guix-patches via
2021-09-01 19:25 ` [bug#50327] [PATCH 1/2] daemon: Print which disk(s) are how full Tobias Geerinckx-Rice via Guix-patches via
2021-09-18 9:55 ` Ludovic Courtès
0 siblings, 2 replies; 5+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2021-09-01 19:05 UTC (permalink / raw)
To: 50327
[-- Attachment #1: Type: text/plain, Size: 654 bytes --]
Guix,
This improves the warning given when free space looks sus.
From:
note: build failure may have been caused by lack of free disk
space
to:
note: only 0.01 MiB available in ‘/gnu/store’
note: only 5.00 MiB available in ‘/tmp/guix-build-foo.drv-0’
note: build failure may have been caused by lack of free disk
space
It also raises the warning threshold from 8 to 64 MiB, which is a
much prettier arbitrary integer.
Question: shouldn't all of nix/ have licence headers added too?
As it stands, there are two very lonely ones in
nix/libstore/builtins.{cc,hh} and that's it.
Kind regards,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#50327] [PATCH 1/2] daemon: Print which disk(s) are how full.
2021-09-01 19:05 [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question Tobias Geerinckx-Rice via Guix-patches via
@ 2021-09-01 19:25 ` Tobias Geerinckx-Rice via Guix-patches via
2021-09-01 19:25 ` [bug#50327] [PATCH 2/2] daemon: Suspect low disk space sooner Tobias Geerinckx-Rice via Guix-patches via
2021-09-18 9:53 ` [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question Ludovic Courtès
2021-09-18 9:55 ` Ludovic Courtès
1 sibling, 2 replies; 5+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2021-09-01 19:25 UTC (permalink / raw)
To: 50327
* nix/libstore/build.cc (pathFull): New function.
(DerivationGoal::buildDone): Use it.
---
nix/libstore/build.cc | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 5697ae5a43..963cddb98b 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1297,6 +1297,25 @@ void replaceValidPath(const Path & storePath, const Path tmpPath)
deletePath(oldPath);
}
+static bool pathFull(Path path)
+{
+#if HAVE_STATVFS
+ unsigned long long required = 8ULL * 1024 * 1024; // FIXME: make configurable
+ struct statvfs st;
+
+ if (statvfs(path.c_str(), &st) == 0) {
+ unsigned long long free = (unsigned long long) st.f_bavail * st.f_bsize;
+ if (free < required) {
+ printMsg(lvlError, format("note: only %1$.2f MiB available in ‘%2%’")
+ % (free / (1024.0 * 1024.0)) % path);
+ return true;
+ }
+ }
+#endif
+
+ return false;
+}
+
MakeError(NotDeterministic, BuildError)
@@ -1355,16 +1374,10 @@ void DerivationGoal::buildDone()
of knowing whether the build actually got an ENOSPC.
So instead, check if the disk is (nearly) full now. If
so, we don't mark this build as a permanent failure. */
-#if HAVE_STATVFS
- unsigned long long required = 8ULL * 1024 * 1024; // FIXME: make configurable
- struct statvfs st;
- if (statvfs(settings.nixStore.c_str(), &st) == 0 &&
- (unsigned long long) st.f_bavail * st.f_bsize < required)
+ if (pathFull(settings.nixStore))
diskFull = true;
- if (statvfs(tmpDir.c_str(), &st) == 0 &&
- (unsigned long long) st.f_bavail * st.f_bsize < required)
+ if (pathFull(tmpDir))
diskFull = true;
-#endif
deleteTmpDir(false);
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question
2021-09-01 19:05 [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question Tobias Geerinckx-Rice via Guix-patches via
2021-09-01 19:25 ` [bug#50327] [PATCH 1/2] daemon: Print which disk(s) are how full Tobias Geerinckx-Rice via Guix-patches via
@ 2021-09-18 9:55 ` Ludovic Courtès
1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-09-18 9:55 UTC (permalink / raw)
To: Tobias Geerinckx-Rice; +Cc: 50327
Hi,
Tobias Geerinckx-Rice <me@tobias.gr> skribis:
> This improves the warning given when free space looks sus.
>
> From:
>
> note: build failure may have been caused by lack of free disk space
>
> to:
>
> note: only 0.01 MiB available in ‘/gnu/store’
> note: only 5.00 MiB available in ‘/tmp/guix-build-foo.drv-0’
> note: build failure may have been caused by lack of free disk space
>
> It also raises the warning threshold from 8 to 64 MiB, which is a much
> prettier arbitrary integer.
LGTM. :-)
Eventually we should i18n messages coming from the daemon.
> Question: shouldn't all of nix/ have licence headers added too? As it
> stands, there are two very lonely ones in
> nix/libstore/builtins.{cc,hh} and that's it.
Yeah well, they were taken as-is from Nix. I wouldn’t bother,
especially since we wouldn’t what copyright holders to list in there.
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-18 9:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-01 19:05 [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question Tobias Geerinckx-Rice via Guix-patches via
2021-09-01 19:25 ` [bug#50327] [PATCH 1/2] daemon: Print which disk(s) are how full Tobias Geerinckx-Rice via Guix-patches via
2021-09-01 19:25 ` [bug#50327] [PATCH 2/2] daemon: Suspect low disk space sooner Tobias Geerinckx-Rice via Guix-patches via
2021-09-18 9:53 ` [bug#50327] [PATCH 0/2] Improved ‘free disk space’ message + a question Ludovic Courtès
2021-09-18 9:55 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).