Bug 486488

Summary: poor handling of invalid --log-fd
Product: [Developer tools] valgrind Reporter: Oswald Buddenhagen <ossi>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.24 GIT   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Oswald Buddenhagen 2024-05-03 09:17:28 UTC
> $ valgrind --log-fd=13 /bin/echo
> ==3786620== Valgrind: failed to move log file descriptor into safe range, using stderr
> ==3786620== Memcheck, a memory error detector
> [...]
> ==3786620== Warning: invalid file descriptor 2 in syscall close()
> ==3786620==    Use --log-fd=<number> to select an alternative log fd.
> [...]

firstly, the error message is very unhelpful, as the root cause is that the source descriptor is invalid.

secondly, the message should be separated with an empty line from the blurb below, as otherwise it's way too easy to overlook.

lastly, these warning messages (there can be lots of them; the particular syscalls vary depending on the traced program) make no sense; apparently something doesn't get reset properly.