Bug 493434 - Add --track-fds=bad mode (no "leak" tracking)
Summary: Add --track-fds=bad mode (no "leak" tracking)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.22 GIT
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Alexandra Hajkova
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-21 12:22 UTC by Mark Wielaard
Modified: 2025-06-27 11:33 UTC (History)
2 users (show)

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


Attachments
patch (7.39 KB, patch)
2025-06-20 08:11 UTC, Alexandra Hajkova
Details
patch (12.45 KB, patch)
2025-06-24 15:43 UTC, Alexandra Hajkova
Details
cmdline2 non-linux expected (15.11 KB, text/plain)
2025-06-24 20:27 UTC, Paul Floyd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2024-09-21 12:22:42 UTC
Currently --track-fds=yes or --track-fds=all report both bad usage and never closed file descriptors. Sometimes users are only interested in bad file descriptor usage errors, but don't care about never close file descriptors. Instead of making them create suppressions for the never closed file descriptors we could have an --track-fds=bad mod that only reports errors on bad usage.

This might also make an interesting mode that we might want to enable by default.
Comment 1 Mark Wielaard 2025-05-22 12:08:55 UTC
So the only difference between yes/all and bad would be the printing of the still open file descriptors in VG_(show_open_fds).
Note that gdbserver can also call show_open_fds. That should probably still show the list. So you should check the when argument (Which is "" when called from gdbserver).
Comment 2 Alexandra Hajkova 2025-06-20 08:11:55 UTC
Created attachment 182411 [details]
patch

Add "bad" option for --track-fds.
    
    When --track-fds=bad is specified, do not warn about
    leaked file descriptors and only warn about file decriptors
    which was not opened or already closed.
    
    Add none/tests/track_bad test to test the new option.
    
    Adjust none/tests/cmdline1 and  none/tests/cmdline2 expected
    output.
Comment 3 Mark Wielaard 2025-06-21 23:06:37 UTC
We discussed a bit on irc and we updated the docs and the usage string.
You should also update none/tests/cmdline1.stdout.exp-non-linux and none/tests/cmdline2.stdout.exp-non-linux
And none/tests/track_bad.stderr.exp is missing.
Comment 4 Alexandra Hajkova 2025-06-24 15:43:06 UTC
Created attachment 182607 [details]
patch
Comment 5 Paul Floyd 2025-06-24 20:27:03 UTC
Created attachment 182619 [details]
cmdline2 non-linux expected

All OK apart from this expected.
Comment 6 Alexandra Hajkova 2025-06-27 11:33:54 UTC
Pushed:
commit 2942c04c485076d84a2df8ee6bb901bb0f014c51 
Author: Alexandra Hájková <ahajkova@redhat.com>
Date:   Fri Jun 20 03:21:41 2025 -0400

    Add "bad" option for --track-fds.
    
    When --track-fds=bad is specified, do not warn about
    leaked file descriptors and only warn about file decriptors
    which was not opened or already closed.
    
    Update the documentation in docs/xml/manual-core.xml.
    
    Add none/tests/track_bad test to test the new option.
    
    Adjust none/tests/cmdline1 and  none/tests/cmdline2 expected
    outputs.
    
    https://bugs.kde.org/show_bug.cgi?id=493434