[PATCH 1/5] tests/Makefile.am: Add --track-fds=yes to valgrind_cmd

2025-01-30 Thread Aaron Merey
`valgrind --track-fds=yes` will report errors for file descriptor leaks and attempts at closing invalid file descriptors. Signed-off-by: Aaron Merey --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 8f087798..625

[PATCH 5/5] tests: Avoid leaking file descriptors

2025-01-30 Thread Aaron Merey
Add calls to close for all test programs that leak file descriptors in order to prevent test failures when run under valgrind --track-fds=yes. Signed-off-by: Aaron Merey --- tests/all-dwarf-ranges.c| 2 ++ tests/alldts.c | 1 + tests/dwarf-getmacros.c | 3 ++- tests/dwarf-ra

[PATCH 3/5] tests/backtrace-subr.sh: Avoid valgrind track-fds in check_native_core

2025-01-30 Thread Aaron Merey
valgrind --track-fds=yes might incorrectly report an error due to the use of inherited file descriptors in check_native_core. Prevent this false positive by temporarily removing "--track-fds=yes" from $VALGRIND_CMD for the duration of the testrun in check_native_core. Signed-off-by: Aaron Merey

[PATCH 4/5] tests/test-elf_cntl_gelf_getshdr.c: Close fd unconditionally

2025-01-30 Thread Aaron Merey
test-elf_cntl_gelf_getshdr conditionally closes a file descriptor depending on a command line argument. This causes an error when run under valgrind --track-fds=yes. Fix this by unconditionally closing the fd. Signed-off-by: Aaron Merey --- tests/test-elf_cntl_gelf_getshdr.c | 20 +-

[PATCH 2/5] libdwfl/offline.c: Avoid closing invalid fd

2025-01-30 Thread Aaron Merey
process_archive may be called with an fd argument of -1, which libelf interprets as "no file opened". However when closing the fd process_archive does not check whether the fd is valid and may attempt to close an fd of -1. Signed-off-by: Aaron Merey --- libdwfl/offline.c | 3 ++- 1 file changed

Re: [PATCH] stacktrace: Add missing locale.h

2025-01-30 Thread Mark Wielaard
On Thu, Jan 30, 2025 at 11:05:20AM +, parona wrote: > > Could you show the configure/build flags and the error the compiler > > gives? I think the patch is correct, but I have trouble replicating > > the issue. > > export CFLAGS="-O0 -pipe" > autoreconf -fi > ./configure --enable-stacktrace --

Re: [PATCH] stacktrace: Add missing locale.h

2025-01-30 Thread parona
Hello, On Thursday, January 30th, 2025 at 12:59 PM, Mark Wielaard wrote: > Hi, > > On Thu, Jan 30, 2025 at 12:05:59AM +, parona wrote: > > > While building elfutils on musl with different features enabled I > > hit this. > > > > Curiously this also affects glibc if you explicitly build w

Re: [PATCH] stacktrace: Add missing locale.h

2025-01-30 Thread Mark Wielaard
Hi, On Thu, Jan 30, 2025 at 12:05:59AM +, parona wrote: > While building elfutils on musl with different features enabled I > hit this. > > Curiously this also affects glibc if you explicitly build without > optimizations. Could you show the configure/build flags and the error the compiler gi