https://bugs.kde.org/show_bug.cgi?id=479661

            Bug ID: 479661
           Summary: Valgrind leaks file descriptors
    Classification: Developer tools
           Product: valgrind
           Version: 3.22.0
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: wojciechmale...@protonmail.com
  Target Milestone: ---

Created attachment 164819
  --> https://bugs.kde.org/attachment.cgi?id=164819&action=edit
Output of valgrind --trace-children=yes -v --track-fds=yes ./test

SUMMARY
When running valgrind with --trace-children=yes --track-fds=yes on program uses
fork and exec, valgrind reports open descriptors, even if the program does not
open anything.

CODE
```test.c
#include <unistd.h>
#include <sys/wait.h>

int main(int argc, char **argv) {

    if (!fork()) {
        execlp("echo", "echo", NULL);
    }

    wait(NULL);
    return 0;
}
```
STEPS TO REPRODUCE
1. Compile the code above: `gcc test.c -o test`
2. Run ` valgrind --trace-children=yes --track-fds=yes ./test`

OBSERVED RESULT
==86569== Open file descriptor 10:
==86569==    <inherited from parent>
==86569== 
==86569== Open file descriptor 8:
==86569==    <inherited from parent>

EXPECTED RESULT
Those descriptors should not be open.

ADDITIONAL INFORMATION
The full output with -v flag in attachment.

output of uname -a:
Linux pangolingila 6.6.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 14 Dec 2023
03:45:42 +0000 x86_64 GNU/Linux

This issue is not present in valgrind 3.19.

I think the bug was introduced in commit
0432ce486d61f84f6fcbeab0d812bb1f61c57561.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to