richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ac3a84
From ca92c2e035d5702f23f9a8d1cd705425b5605822 Mon Sep 17 00:00:00 2001
ac3a84
From: Frantisek Sumsal <frantisek@sumsal.cz>
ac3a84
Date: Mon, 7 Nov 2022 11:55:29 +0100
ac3a84
Subject: [PATCH] test: don't ignore non-existent paths in inst_recursive()
ac3a84
ac3a84
The process substitution in the while loop hides errors raised by the
ac3a84
find utility, which might (and did), in turn, hide errors in test setup.
ac3a84
ac3a84
(cherry picked from commit eb5d7730e1b3b1bddecb80be37e5a4c938183f61)
ac3a84
ac3a84
Related #2138081
ac3a84
---
ac3a84
 test/test-functions | 4 ++++
ac3a84
 1 file changed, 4 insertions(+)
ac3a84
ac3a84
diff --git a/test/test-functions b/test/test-functions
ac3a84
index 16d9da637b..80ce383e64 100644
ac3a84
--- a/test/test-functions
ac3a84
+++ b/test/test-functions
ac3a84
@@ -2773,6 +2773,10 @@ inst_recursive() {
ac3a84
     local p item
ac3a84
 
ac3a84
     for p in "$@"; do
ac3a84
+        # Make sure the source exists, as the process substitution below
ac3a84
+        # suppresses errors
ac3a84
+        stat "$p" >/dev/null || return 1
ac3a84
+
ac3a84
         while read -r item; do
ac3a84
             if [[ -d "$item" ]]; then
ac3a84
                 inst_dir "$item"