This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [patch]: testsuite: run bash instead of sh when using brace expansion
- From: Tom Tromey <tromey at redhat dot com>
- To: Christian Groessler <chris at groessler dot org>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, gdb at sourceware dot org, gdb-patches at sourceware dot org
- Date: Fri, 17 May 2013 10:44:38 -0600
- Subject: Re: [patch]: testsuite: run bash instead of sh when using brace expansion
- References: <51936596 dot 8010205 at groessler dot org> <m3hai3kes8 dot fsf at redhat dot com> <5195E023 dot 10203 at groessler dot org>
>>>>> ">" == Christian Groessler <chris@groessler.org> writes:
>> How about the following patch? My tcl fu is not that strong, so I
>> explicitly wrote out the expanded strings instead of computing them.
You can do something like:
set dirs {}
foreach l {/ldir ""} {
foreach r {/rdir ""} {
... more foreaches here ...
lappend dirs [join [list $l $r $...]]
}
}
>> The shell command line could get quite long with this change,
>> depending how deep
>> the build directory is located in the hierarchy. I could invoke the
>> shell for each path separately, but
>> this would be slower. Any opinions?
If the result is too long we could batch it.
But I would not worry about it for now.
>> +proc reverse {lst} {
We have 'lreverse' in new Tcl, plus a compatibility proc in future.exp.
>> +proc pathexpand {prefix dirlst suffix} {
>> + set retlst {}
>> + for {set i 0} {$i < [llength $dirlst]} {incr i} {
>> + lappend retlst "$prefix[lindex $dirlst $i]$suffix"
>> + }
>> + return $retlst
foreach is more idiomatic.
Tom