From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29347 invoked by alias); 17 May 2013 07:45:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 29330 invoked by uid 89); 17 May 2013 07:45:54 -0000 X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,MAY_BE_FORGED,RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from vigilia.groessler.org (HELO vigilia.groessler.org) (178.63.177.85) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 17 May 2013 07:45:52 +0000 Received: from [10.23.1.38] (gaga.groessler.org [212.168.189.235] (may be forged)) by vigilia.groessler.org (8.14.6/8.14.6) with ESMTP id r4H7k6Zo003456 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Fri, 17 May 2013 09:46:06 +0200 (CEST) Message-ID: <5195E023.10203@groessler.org> Date: Fri, 17 May 2013 07:45:00 -0000 From: Christian Groessler User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Sergio Durigan Junior CC: gdb@sourceware.org, gdb-patches@sourceware.org Subject: Re: [patch]: testsuite: run bash instead of sh when using brace expansion References: <51936596.8010205@groessler.org> In-Reply-To: Content-Type: multipart/mixed; boundary="------------070803030001080702010907" X-Virus-Found: No X-SW-Source: 2013-05/txt/msg00672.txt.bz2 This is a multi-part message in MIME format. --------------070803030001080702010907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1753 On 05/16/13 01:24, Sergio Durigan Junior wrote: > Next time, please make sure to send patches to > gdb-patches@sourceware.org. Also I don't see you on gdb/MAINTAINERS, > do you have copyright assignment for GDB? This patch is simple enough > to go in without a copyright assignment, but if you intend to send > more patches please let me know (in off) and I can get you started on > the process. I think I have an assignment for gdb, but I'm not 100 percent sure. I've moved recently and don't find my papers at the moment. Could someone verify please that the assignment is in place? >> * gdb.dwarf2/dw2-dir-file-name.exp: Use bash instead of sh, since >> brace expansion is not available in sh. > ^^^^^^^^ > You're using spaces instead of a TAB here. That was the result of copy-n-paste into the mail. > I am not sure what others think, but instead of depending on bash (which > may not be available on all platforms), I'd rather rewrite those > commands to avoid brace expansions at all, thus making them compatible > with sh. I am not a maintainer however, so you'd better wait for one > until you do that. How about the following patch? My tcl fu is not that strong, so I explicitly wrote out the expanded strings instead of computing them. 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? regards, chris 2013-05-17 Christian Groessler * gdb.dwarf2/dw2-dir-file-name.exp: Don't use brace expansion, since it's not supported in all shells. Write out the expanded names directly. --------------070803030001080702010907 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="diffs" Content-length: 2549 Index: gdb.dwarf2/dw2-dir-file-name.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp,v retrieving revision 1.4 diff -u -p -r1.4 dw2-dir-file-name.exp --- gdb.dwarf2/dw2-dir-file-name.exp 15 Mar 2013 01:41:28 -0000 1.4 +++ gdb.dwarf2/dw2-dir-file-name.exp 16 May 2013 14:50:18 -0000 @@ -322,10 +322,64 @@ if { [gdb_compile "${asmsrcfile} ${srcdi return -1 } -remote_exec host "sh -c \"rm -f ${srcabsdir}{/rdir,}{/xdir,}{/compdir,}{/ldir,}{/fdir,}/${srctmpfile}\"" -remote_exec host "sh -c \"rmdir ${srcabsdir}{/rdir,}{/xdir,}{/compdir,}{/ldir,}{/fdir,}\"" -remote_exec host "sh -c \"mkdir ${srcabsdir}{,/rdir}{,/xdir}{,/compdir}{,/ldir}{,/fdir}\"" -remote_exec host "sh -c \"for d in ${srcabsdir}{,/rdir}{,/xdir}{,/compdir}{,/ldir}{,/fdir};do cp ${srcdir}/${subdir}/${srcfile} \\\$d/${srctmpfile}; done\"" +set dirs { \ + "" \ + "/fdir" \ + "/ldir" \ + "/ldir/fdir" \ + "/compdir" \ + "/compdir/fdir" \ + "/compdir/ldir" \ + "/compdir/ldir/fdir" \ + "/xdir" \ + "/xdir/fdir" \ + "/xdir/ldir" \ + "/xdir/ldir/fdir" \ + "/xdir/compdir" \ + "/xdir/compdir/fdir" \ + "/xdir/compdir/ldir" \ + "/xdir/compdir/ldir/fdir" \ + "/rdir" \ + "/rdir/fdir" \ + "/rdir/ldir" \ + "/rdir/ldir/fdir" \ + "/rdir/compdir" \ + "/rdir/compdir/fdir" \ + "/rdir/compdir/ldir" \ + "/rdir/compdir/ldir/fdir" \ + "/rdir/xdir" \ + "/rdir/xdir/fdir" \ + "/rdir/xdir/ldir" \ + "/rdir/xdir/ldir/fdir" \ + "/rdir/xdir/compdir" \ + "/rdir/xdir/compdir/fdir" \ + "/rdir/xdir/compdir/ldir" \ +} + +proc reverse {lst} { + set retlst {} + for {set i [expr "[llength $lst] - 1"]} {$i >= 0} {set i [expr "$i - 1"]} { + lappend retlst [lindex $lst $i] + } + return $retlst +} + +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 +} + +set filelist [pathexpand $srcabsdir $dirs "/$srctmpfile"] +set dircreatelist [pathexpand $srcabsdir $dirs ""] +set dirremovelist [pathexpand $srcabsdir [reverse $dirs] ""] + +remote_exec host "sh -c \"rm -f $filelist\"" +remote_exec host "sh -c \"rmdir $dirremovelist\"" +remote_exec host "sh -c \"mkdir $dircreatelist\"" +remote_exec host "sh -c \"for d in $dircreatelist; do cp ${srcdir}/${subdir}/${srcfile} \\\$d/${srctmpfile}; done\"" clean_restart ${testfile} --------------070803030001080702010907--