Bruno Haible via GNU coreutils General Discussion <[email protected]>
writes:

> * clang with ASAN and UBSAN sanitizers
>
> FAIL: tests/misc/warning-errors
> ===============================

This is similar to a previous issue [1]. The 'closeout' module won't
close standard error with ASAN enabled, otherwise we wouldn't be able to
see the errors. This also means we don't see the write error in this
case, which would change the exit status to 1.

I've attached a patch that fixes it. I'll hold off pushing in case
Pádraig has a better idea.

Collin

[1] https://lists.gnu.org/archive/html/coreutils/2025-12/msg00006.html

>From 1b4a15292ba95ed4b4bfba0758bf6bee8808653b Mon Sep 17 00:00:00 2001
Message-ID: <1b4a15292ba95ed4b4bfba0758bf6bee8808653b.1772516869.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Mon, 2 Mar 2026 21:43:22 -0800
Subject: [PATCH] tests: avoid false test failure when using address sanitizer

* tests/misc/warning-errors.sh: Skip commands which have been built with
sanitizers, since standard error will not be closed and checked for
errors.
Reported by Bruno Haible.
---
 tests/misc/warning-errors.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/misc/warning-errors.sh b/tests/misc/warning-errors.sh
index 5a1f25457..848b3c65d 100755
--- a/tests/misc/warning-errors.sh
+++ b/tests/misc/warning-errors.sh
@@ -54,6 +54,9 @@ expected_failure_status_env=0  # env's exec resets default exit handlers
 
 while read writer; do
   cmd=$(printf '%s\n' "$writer" | cut -d ' ' -f1) || framework_failure_
+  # We don't close standard error with sanitizers, which may need to print.
+  # Therefore, these programs may succeeded when they otherwise wouldn't.
+  sanitizer_build_ $cmd && continue
   eval "expected=\$expected_failure_status_$cmd"
   test x$expected = x && expected=1
   returns_ $expected \
-- 
2.53.0

Reply via email to