Re: [PATCH] Testsuite: Ensure changing directory does not break the log file

Tom Tromey
2019-02-21T22:40:26Z

>>>>> "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