[PATCH 3/3] builders: avoid shell pipeline for disk space check

Anders Heimer <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
The disk space probe used a shell pipeline to run findmnt and awk.
Ask findmnt for the available-byte field directly and pass the
command as argv, avoiding shell interpretation.

AI-Generated: Claude Opus 4.6 <[email protected]>
Signed-off-by: Anders Heimer <[email protected]>
---
 builders.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builders.py b/builders.py
index 418ef1b..1b65e55 100644
--- a/builders.py
+++ b/builders.py
@@ -81,7 +81,9 @@ def canStartBuild(builder, wfb, request):
 
         bytes_in_gb = 1024 * 1024 * 1024
 
-        cmd = yield shell("findmnt -T %s --df -n --bytes | awk '{print $5}'" % mountpoint, wfb.worker, builder)
+        cmd = yield shell(["findmnt", "-T", mountpoint, "--df", "-n", "--bytes",
+                           "-o", "AVAIL"],
+                          wfb.worker, builder)
         space = int(cmd.stdout.strip())
         if space < threshold * bytes_in_gb:
             log.msg("Detected {0} GB of space available on {1}, less than threshold of {2} GB. Can't start build".format(space / bytes_in_gb, name, threshold))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.