Bug 405205 - tests/filter_libc: remove the line holding the futex syscall error entirely
Summary: tests/filter_libc: remove the line holding the futex syscall error entirely
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.15 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-08 07:53 UTC by Stefan Maksimovic
Modified: 2019-04-11 16:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Proposed solution (457 bytes, text/plain)
2019-03-08 07:53 UTC, Stefan Maksimovic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Maksimovic 2019-03-08 07:53:33 UTC
Created attachment 118641 [details]
Proposed solution

SUMMARY

At the moment the message reported by glibc is removed by the perl substitute command, leaving an empty line it its place.
This change alters tests/filter_libc so as to remove the line containing the futex error message completely; effectively we skip printing the line altogether.

Need for this arose when observing a build process initiated by a buildbot, in which case the 'make regtest' command was invoked via ssh.
In that case a terminal isn't spawned so the abovementioned message is printed to stderr which gets filtered by tests/filter_libc (cf. building valgrind regularly; the message is printed directly to the terminal, not stderr, hence does not get filtered).

After this change no empty line is printed instead of the message, so there are no conflicts with the existing stderr.exp files for the helgrind/tests/{tc18_semabuse,tc20_verifywrap}.
These two tests were the ones where the stderr failure was observed.
I did not observe any regressions for mips32, mips64 or x86 after this change.

STEPS TO REPRODUCE
1. Run either a single test or 'make regtest' via ssh remotely
2. Run the same command locally
3. Observe the difference in the futex syscall error message being printed to stderr in the first case, whereas it is printed directly to the terminal in the second case for the two tests mentioned

OBSERVED RESULT

An additional newline appears in the tc18_semabuse and tc20_verifywrap stderr.out files

EXPECTED RESULT

No empty line generated
Comment 1 Stefan Maksimovic 2019-04-10 09:23:25 UTC
Did anyone have a chance to take a look at this?
Comment 2 Mark Wielaard 2019-04-10 22:34:43 UTC
(In reply to Stefan Maksimovic from comment #1)
> Did anyone have a chance to take a look at this?

Sorry, missed this.

You are right that the whole line needs to be removed.
The problem is that older glibc versions didn't emit a newline.
See https://sourceware.org/PR20271
This was fixed in glibc-2.29.

So a fix should remove the message with or without newline at the end.
Comment 3 Mark Wielaard 2019-04-10 22:45:20 UTC
I am unable to replicate the issue on my setup. But I think the following would work:

diff --git a/tests/filter_libc b/tests/filter_libc
index 9607db5..8eb9911 100755
--- a/tests/filter_libc
+++ b/tests/filter_libc
@@ -37,6 +37,8 @@ while (<>)
     s/(at.*)operator delete\[\]\(void\*\)/$1...operator delete[].../;
 
     # Some glibc versions complain about unexpected futex syscall errors.
+    # With or without newline (see sourceware PR20271).
+    next if /^The futex facility returned an unexpected error code.$/;
     s/The futex facility returned an unexpected error code.//;
 
     print;

Does that work for your setup?
Comment 4 Mark Wielaard 2019-04-11 16:05:27 UTC
Approved on irc by Julian.

commit eacf885df231037fd6a02ada7a7cafb44ce6b89c
Author: Mark Wielaard <mark@klomp.org>
Date:   Thu Apr 11 18:01:24 2019 +0200

    filter_libc: remove the line holding the futex syscall error entirely
    
    The current filter might leave empty lines behind.
    This is caused by the fact that glibc used to not include a newline
    in the message. But since glibc 2.29 it does.
    
    https://bugs.kde.org/show_bug.cgi?id=405205
    Reported-by: Stefan Maksimovic <stefan.maksimovic@rt-rk.com>