From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by sourceware.org (Postfix) with ESMTPS id AE30B3945057 for ; Wed, 11 Mar 2020 18:41:04 +0000 (GMT) Received: by mail-ot1-x342.google.com with SMTP id t28so539291ott.5 for ; Wed, 11 Mar 2020 11:41:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jcsPH6CNp+EIk4pptbu+FIv4tcGSiSDiBCvUPacUo/Y=; b=Ld2PwlUG4kU/fklanuUjgusznVoWt+kK5gTt3jh4VRs/4AkKdvWZVN9T5fXQSltlmv 7lp2pdNYFpDyWZmiNsEGB/bOZQ20rgOywBu/hzgxI7R73/exkA72s1MyY5ZP0yWC8Ko3 A3tgS1mdq+UW/PdXqbXkW7Aqi21U2Nqb1pnaKsjei4J1HFZLA80K5sb3tt3A6igkSv7Y cvAhlNgo9K8zatgzOcInP70484cPR7aX/tc/1Ukvg+X9lxIcp6kQNhJpEpW/y2gkwSy/ B2Xg5j7dNvgfFlVZE3d48fHUjnsBbSp/VG725zjBmSiEyLbUxeHh03RtHOQbVUrUOJwx lpFA== X-Gm-Message-State: ANhLgQ2iOXmhQhTBZrfu9AfQGY8dExyMYKzKT1q22Tg5QNyjcWYov+ul iK8AoKlffMqXstZktMd/Hm3fOJuinFrBZmyNoo/IZViu X-Google-Smtp-Source: ADFU+vsQh0EYG25UFBTT9RjLU5oGyTO89kg5rWzsmeFjoarNgSxziFPFTgo0dWwhn/uYEULS9FXN30avQ9ZPXBkB4HA= X-Received: by 2002:a05:6830:1c7:: with SMTP id r7mr3498754ota.129.1583952063700; Wed, 11 Mar 2020 11:41:03 -0700 (PDT) MIME-Version: 1.0 References: <20200311183212.28601-1-simon.marchi@efficios.com> In-Reply-To: <20200311183212.28601-1-simon.marchi@efficios.com> From: Christian Biesinger Date: Wed, 11 Mar 2020 13:40:22 -0500 Message-ID: Subject: Re: [PATCH] testsuite: use cygpath to convert from Unix to Windows paths To: Simon Marchi Cc: gdb-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-42.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2020 18:41:05 -0000 On Wed, Mar 11, 2020 at 1:32 PM Simon Marchi via Gdb-patches wrote: > > When on a MinGW host, standard_output_file uses a regular expression to > convert Unix-style paths of the form "/c/foo" to "c:/foo". This is > needed because the paths we pass to GDB (for example, with the "file" > command) need to be in the Windows form. > > However, the regexp only works if your binutils-gdb repo is under a > `/[a-z]/...` path (the Unix paths mapping to Windows drives). > Presumably, that works if you clone the repo in Windows, then access it > through `/c/...`. > > In my case, I've cloned the repository directly inside my MinGW shell, > so in /home/smarchi. The regexp therefore doesn't work for me. The > path doesn't get transformed, and the file command fails when running > any test: > > (gdb) file /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent > /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent: No such file or directory. > > A safer way to do this conversion would be to use the cygpath utility. > It can be used to convert any MinGW path into its Windows equivalent. > > Note that despite originally coming from Cygwin, the cygpath utility is > distributed by mingw-w64 and can be used in that environment. > > With this, the file command in the test succeeds: > > (gdb) file C:/msys64/home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent > Reading symbols from C:/msys64/home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent... > > gdb/testsuite/ChangeLog: > > * lib/gdb.exp (standard_output_file): Use cygpath to convert > from Unix to Windows path. > --- > gdb/testsuite/lib/gdb.exp | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 9614e8dc87cd..ac16e0e85c99 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -4899,8 +4899,10 @@ proc standard_output_file {basename} { > file mkdir $dir > # If running on MinGW, replace /c/foo with c:/foo > if { [ishost *-*-mingw*] } { > - set dir [regsub {^/([a-z])/} $dir {\1:/}] > + set dir [exec cygpath --mixed "${dir}"] This is fine, but out of curiosity, why --mixed instead of --windows? > + > } Why the empty line above? > + > return [file join $dir $basename] > } > > -- > 2.25.1 >