| Summary: | Using relative paths for --suppressions and/or --log-file breaks --trace-children | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | nickb <pgnickb> |
| Component: | memcheck | Assignee: | Julian Seward <jseward> |
| Status: | REPORTED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 3.25.1 | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
nickb
2025-12-15 15:31:40 UTC
Running valgrind with `-v` shows: ``` ==00:00:00:00.027 33639== FATAL: can't open suppressions file "valgrind.supp" ``` Reproduced the error. For me, I see plenty of kevent syscall param errors on FreeBSD. Need to check that the wrapper is doing its job. For the error itself, the problem is that cwd has changed to the pgdata directory. -61399:0: main Getting the working directory at startup --61399:0: main ... /tmp/vg_repro/pgdata ==61399== Memcheck, a memory error detector ==61399== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==61399== Using Valgrind-3.27.0.GIT and LibVEX; rerun with -h for copyright info ==61399== Command: /bin/sh -c /usr/bin/true ==61399== ==61399== FATAL: can't open suppressions file "postgresql/src/tools/valgrind.supp" Looking at the potgresql code I see several calls to ChangeToDataDir(). If it is doing a fork(), ChangeToDataDir(), exec() then that would explain what we are seeing. I'm not sure that we can do much. Possibly change the suppressions path to absolute before any exec? I don't insist on my interpretation being correct, but I find it dubious that this behavior is (a) not clearly documented and (b) depends on the code executed in the child process. When I invoke a cli-application I expect the application to treat any path I supplied as relative to the `cwd` of the environment the application was called in. I imagine this behavior is a consequence of the way valgrind is implemented, but I think it shouldn't be too hard to convert any relative path into an absolute one before continuing execution. That being said, I can imagine this kind of behavior being useful for the case when each executable has a `.supp` file in its `cwd` and we want to dynamically use those as we chain call through those. But it seems like a very special case and given this behavior isn't documented, I doubt anyone ever realized this was an option, let alone use it in any real context. That being said, I'm not opposed to the idea of implementing the fix I've outlined above or documenting the current behavior if anyone is willing to review the fix/doc patch. Let me know. |