Repository navigation
Conversation
TraceStream.cc and launch_debugger.cc called basename() on a const char*, which only works with the GNU declaration from <string.h>. That declaration isn't available outside glibc, so include <libgen.h> and pass the POSIX version a mutable copy instead. Fixes rr-debugger#4019.
GitMensch
left a comment
There was a problem hiding this comment.
LGTM - thanks for the PR, seems like I haven't checked that in at all...
I've had a quick moment of "why not setting the fixed part once - but the output of trace_save_dir() is cached inside and that's not a tight loop in the first place - still good that you've moved the copy + basename call out of it.
|
Was this produced by AI? If so, please say so according to the AI usage policy:
|
|
Yes. An AI agent wrote this change, ran the build and checks described above, and wrote the PR description. I missed the policy when it was opened, sorry about that. I've now read the diff and I'm the person responsible for it; if you'd rather not take it on that basis, feel free to close it. |
|
I'm not sure it's safe to modify the characters at |
Fixes #4019.
TraceStream.ccandlaunch_debugger.cccallbasename()on aconst char*, which relies on the GNU declaration that glibc puts in<string.h>. Outside glibc that declaration isn't there, which is theTraceStream.ccfailure from the #4009 build log.As agreed in the issue, both call sites now use the POSIX version: include
<libgen.h>and handbasename()a copy of the path, since POSIX allows it to modify its argument. Inmake_trace_dir()the name is now worked out once, before the retry loop.For ordinary paths the result is the same. I compared old and new on glibc for absolute, relative and bare names and got identical output. They only differ for a path ending in
/, which an executable path or the temp script name can't be.Testing: built
rron Debian 13 (GCC 14, glibc 2.41).rr recordcreatedtrue-0,true-1andbn_test-0under_RR_TRACE_DIR, so the trace directory naming and the nonce retry still work. This machine has no hardware perf counters, so recording stops right after that and I couldn't runmake check.@GitMensch you'd offered to do this one. It looked idle, so I put up the small version, but I'm happy to close this if you already have a branch.