This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Testsuite: Ensure changing directory does not break the log file
- From: Tom Tromey <tom at tromey dot com>
- To: Alan Hayward <Alan dot Hayward at arm dot com>
- Cc: "gdb-patches\@sourceware.org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Thu, 21 Feb 2019 15:40:18 -0700
- Subject: Re: [PATCH] Testsuite: Ensure changing directory does not break the log file
- References: <20190221103420.18162-1-alan.hayward@arm.com>
>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
Alan> get_compiler_info switches to a new log file before checking the compiler
Alan> to ensure the checks are not logged.
Haha, that seems pretty gross.
Alan> The simpler and safer solution is to override the builtin cd function. The
Alan> new function checks the current log file and if the path is relative, then
Alan> it resets the logging using an absolute path. Finally it calls the builtin
Alan> cd. This ensures get_compiler_info (and any other code) can correctly
Alan> backup and restore the current log file.
Makes sense to me.
Alan> + if { [regexp "^-a \[^/\]" $saved_log match] } {
It may be better here to just extract the file name and either use "file normalize"
(could be done unconditionally) or look at it with "file pathtype".
See https://www.tcl.tk/man/tcl8.4/TclCmd/file.htm
Tom