GNU bug report logs - #40072
Incorrect escaping on MinGW 32-bit

Previous Next

Package: libtool;

Reported by: noloader <at> gmail.com

Date: Sun, 15 Mar 2020 11:42:01 UTC

Severity: normal

Full log


Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jeffrey Walton <noloader <at> gmail.com>
To: Bob Friesenhahn <bfriesen <at> simple.dallas.tx.us>
Cc: 40072 <at> debbugs.gnu.org, bug-libtool <at> gnu.org
Subject: Re: bug#40072: Incorrect escaping on MinGW 32-bit
Date: Sun, 15 Mar 2020 15:00:52 -0400
[Message part 1 (text/plain, inline)]
On Sun, Mar 15, 2020 at 10:48 AM Jeffrey Walton <noloader <at> gmail.com> wrote:
>
> On Sun, Mar 15, 2020 at 9:59 AM Bob Friesenhahn
> <bfriesen <at> simple.dallas.tx.us> wrote:
> >
> > On Sun, 15 Mar 2020, Jeffrey Walton wrote:
> > ...
> Maybe libtool can do the same. Supply a small C program, compile it
> and call it from the libtool scripts. Its would be quite easy to
> supply the path in argv[1], and get back either (1) the original name
> (no spaces), (2) a short file name or (3) a quoted long file name. If
> the path gets split and shows up in pieces across argv[1]...argv[n-1],
> then just combine the pieces because you know what is supposed to
> happen.

Bob, see what you think about a program like the one attached. The C
code will be messier, but it is the same concept.

Here's what it returns during testing. The -c options means returns
string to use as a C declare.

With USE_WINDOWS_API (tested under MSYS):

    $ ./quote_path.exe "C:\Users\Jeffrey" "Walton\Desktop"
    C:\Users\JEFFRE~1\Desktop

    $ ./quote_path.exe -c "C:\Users\Jeffrey" "Walton\Desktop"
    "C:\\Users\\JEFFRE~1\\Desktop";

    $ ./quote_path.exe -c C:\\Users
    C:\\Users

Without USE_WINDOWS_API (tested under MSYS):

    $ ./quote_path.exe "C:\Users\Jeffrey" "Walton\Desktop"
    "C:\Users\Jeffrey Walton\Desktop"

    $ ./quote_path.exe -c "C:\Users\Jeffrey" "Walton\Desktop"
    "\"C:\\Users\\Jeffrey Walton\\Desktop\"";

    $ ./quote_path.exe C:\\Users\\Jeffrey Walton\\Desktop
    "C:\Users\Jeffrey Walton\Desktop"

    $ ./quote_path.exe -c C:\\Users\\Jeffrey Walton\\Desktop
    "\"C:\\Users\\Jeffrey Walton\\Desktop\"";

    $ ./quote_path.exe -c C:\\Users
    C:\\Users

I think offloading to an external program written for the specific
problem will probably simplify libtool and its helpers. It will make
your life a lot easier.

Jeff
[quote_path.cpp (text/x-c++src, attachment)]

This bug report was last modified 5 years and 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.