testsuite: Fix remote_send_file behavior on missing file

Message ID 20261123153748.42077-1-akarpovich@ilbers.de
State Under Review
Headers show
Series testsuite: Fix remote_send_file behavior on missing file | expand

Commit Message

Aliaksei Karpovich Nov. 23, 2026, 3:37 p.m. UTC
Fix an issue where remote_send_file() is called with a path to a
nonexistent source file. In this case remote_send_file() returns
0 (success) and creates a 0-byte destination file.
Solution: Use the 'head' command to read 1 byte and check that the
source file exists and is readable.
---
 testsuite/cibuilder.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 0565f158..488ff770 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -455,7 +455,7 @@  class CIBuilder(Test):
         )
 
         proc = subprocess.run(
-            f"cat {src} | {cmd_prefix} install -m {mode} /dev/stdin {dest}",
+            f"head -c1 {src} >/dev/null && cat {src} | {cmd_prefix} install -m {mode} /dev/stdin {dest}",
             shell=True,
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,