From 8cfb1e2f00c1d427200b098c3111ef3cb191fb65 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Tue, 6 Jul 2021 16:34:47 +0000 Subject: Fix inifinite loop on missing files status.core.log should always be there but some from 2017/208 are missing. --- autobuild/results.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/autobuild/results.php b/autobuild/results.php index f2dfa18..da18802 100644 --- a/autobuild/results.php +++ b/autobuild/results.php @@ -67,17 +67,20 @@ $prev_failure = Array(); if ($prev) { $status_name = array_shift(glob("cauldron/*/core/$prev/status.core.log")); $status_file = fopen($status_name, "r"); - while (!feof($status_file)) { - $line = fgets($status_file); - if (preg_match("/^(.*): (.*)$/", $line, $matches)) { - $rpm = parse_package($matches[1]); - $status = $matches[2]; - if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch") { - $prev_failure[$rpm['package']] = 1; + if ($status_file !== false) { + // The file should always be there but better not get an infinite loop flooding the logs when it disappears + while (!feof($status_file)) { + $line = fgets($status_file); + if (preg_match("/^(.*): (.*)$/", $line, $matches)) { + $rpm = parse_package($matches[1]); + $status = $matches[2]; + if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch") { + $prev_failure[$rpm['package']] = 1; + } } } + fclose($status_file); } - fclose($status_file); } $success = Array(); -- cgit v1.2.1