Bug 474160 - If errors-for-leak-kinds is specified, exit-on-first-error should only exit on one of the listed errors.
Summary: If errors-for-leak-kinds is specified, exit-on-first-error should only exit o...
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.22 GIT
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-04 21:56 UTC by Eyal
Modified: 2024-03-25 10:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch with working code and unit test (7.46 KB, patch)
2023-09-04 21:57 UTC, Eyal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal 2023-09-04 21:56:00 UTC
SUMMARY
***
 `exit-on-first-error` should *not* exit on any error that is not listed in the `errors-for-leak-kinds` list.
***

STEPS TO REPRODUCE
1. Build and install in the usual way: ./autogen.sh && ./configure --prefix=$HOME/.local && make -j 20 && make -j 20 check && make install
2. From root directory of valgrind, run: valgrind --error-exitcode=127 --errors-for-leak-kinds=definite --leak-check=full -s --exit-on-first-error=yes memcheck/tests/leak-cases

OBSERVED RESULT

Despite setting errors-for-leak-kinds to "definite", the test is exiting on a non-"definite" leak.

EXPECTED RESULT

The test should only exit on leak types listed in the errors-for-leak-kinds.  If that list is empty only then should it exit on all types of leaks.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  3.22 git commit c086bbdd6

ADDITIONAL INFORMATION

More details here: https://github.com/eyal0/valgrind/pull/5#issuecomment-1705724572
Working fix with unit test here: https://github.com/eyal0/valgrind/pull/5/files
Comment 1 Eyal 2023-09-04 21:57:33 UTC
Created attachment 161405 [details]
patch with working code and unit test

This fixes the issue and adds a unit test.  Also here: https://github.com/eyal0/valgrind/pull/5/files
Comment 2 Eyal 2024-03-03 21:31:38 UTC
Let me know if there's anything that you'd like me to do here!  The patch and testing is pretty straight-forward.  I think that the new behavior will be more inline with valgrind user expectation.
Comment 3 Paul Floyd 2024-03-07 09:40:28 UTC
Probably next on my list after FreeBSD arm64.
Comment 4 Paul Floyd 2024-03-24 07:01:57 UTC
Thanks!

Added to NEWS and changed commit message

commit ca58f30a5e728cda2802c7fafdc0770a45a5f8cb (HEAD -> master, origin/master, origin/HEAD)
Author: Eyal Soha <eyalsoha@gmail.com>
Date:   Tue Mar 2 14:42:38 2021 -0700

    Bug 474160 - If errors-for-leak-kinds is specified, exit-on-first-error should only exit on one of the listed errors.
    
    It's possible for the user to specify in the memcheck that some errors
    should not cause an exit with the error-exitcode value.  For those
    errors which would not cause an error exitcode, do not count them for
    the purposes of exiting after the first error.