Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/Windows testsuite: Embed asInvoker manifest in test executables
Date: Wed, 22 Jul 2026 15:16:17 +0100	[thread overview]
Message-ID: <e92387ae-2b0e-4305-ac63-3d0038c81b30@palves.net> (raw)
In-Reply-To: <86ldbijbyr.fsf@gnu.org>

Hi!

On 2026-07-11 07:07, Eli Zaretskii wrote:
>> Date: Fri, 10 Jul 2026 19:59:17 +0100
>> Cc: gdb-patches@sourceware.org
>> From: Pedro Alves <pedro@palves.net>
>>
>> It's curious that you bring up patch.exe.  In the downstream testcase
>> I mention, the initial comment that I wrote there mentioned "patch" as "bad"
>> word too (as some docs somewhere mention it), and then after the initial fix,
>> I noticed that "patch" is actually OK, and so I dropped it from the comment
>> in a follow up patch.
> 
> It used to be a problem in some older builds of Windows 11 (and nasty
> one not even a manifest could work around it), but ceased to be a
> problem a few system updates ago.  I have no idea what is the
> situation on Windows 10, though.
> 
>>  $ mv update.exe patch.exe
>>  $ ./patch.exe
>>  Hello!
>>
>> So looks like Microsoft decided that "patch" wasn't a bad word after all
>> at some point more recently...
> 
> Yes.  

> But do we want to rely on the test suite being run only on the
> latest builds of Windows?

Right.  I meant more like, I thought that the docs I had found were wrong, and that
"patch" had never been forbidden.  But from your explanations, I now understand
that is instead that Microsoft started allowing "patch" more recently.

> 
>> Also, I noticed that executables produced by the GCC 16 that comes with
>> MSYS2 do not have the issue. (??!)  Digging a bit, it turns out that both MSYS2 and
>> Cygwin ship a default-manifest.o object file that GCC pulls in via a spec file.
>> This default-manifest.o file is in a separate optional package, which may be
>> removed, and GCC keeps working, just won't link in the default manifest.
>>
>>   https://gcc.gnu.org/legacy-ml/gcc-patches/2014-04/msg01378.html
>>   https://sourceforge.net/p/mingw-w64/wiki2/default_manifest/
> 
> Thanks, that's good to know.
> 
>> Find below the new patch adding a manifest to every executable in the testsuite.  WDYT of this one?
> 
> LGTM.

Thanks, I merged it.

> 
>> +    # Embed our manifest file.  Pass it in Windows-native form.
>> +    # MSYS2's argument conversion treats a "/foo:/bar" argument as a
>> +    # colon-separated list of POSIX paths and mistakenly rewrites it
>> +    # to a semicolon-separated list of Windows paths.  E.g.:
>> +    #
>> +    #  "/manifestinput:/c/gdb/.../windows.manifest"
>> +    #    =>
>> +    #  "C:\msys64\manifestinput;C:\gdb\...\windows.manifest"
>> +    #
>> +    # I.e., the flag name itself gets converted as if it were a path,
>> +    # and the ":" becomes ";".
>> +    #
>> +    # What triggers the conversion is the value after the colon looking
>> +    # like an absolute POSIX path (a leading "/").  "/manifest:embed"
>> +    # above is left alone because "embed" doesn't.  Passing the value
>> +    # as a native "C:/..." path likewise avoids it.
>> +    set manifest [host_file_normalize ${srcdir}/lib/windows.manifest]
>> +    lappend ldflags ldflags=-Wl,/manifestinput:${manifest}
> 
> IME, you can work around this incorrect conversion by setting
> MSYS_NO_PATHCONV=1.

That doesn't help here -- we do want the unix -> windows conversion to happen
for all filename arguments, like in "gcc /c/foo.c -o /c/foo.o".
Setting MSYS_NO_PATHCONV=1 would break all those.

msys2 also allows disabling conversion for one specific argument by using double slash,
like //option instead of /option, but here in this case the slash does not appear at
the front of the argument, it's after -Wl, so it doesn't work, as it is the compiler
that calls the linker, and the compiler is always native windows, doesn't invoke the linker
via msys2/bash.

An in any case, if it worked, then we'd be stopping the conversion
for /manifestinput _and_ the manifest path (the ${manifest} var) at the same time, as
it's all part of the same option split by ":", so we'd have to do the manual
conversion anyhow.  Just like the patch is already doing.


  reply	other threads:[~2026-07-22 14:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 17:43 [PATCH] gdb/Windows testsuite: Avoid "bad" words in exe names Pedro Alves
2026-07-10  5:18 ` Eli Zaretskii
2026-07-10 18:59   ` [PATCH] gdb/Windows testsuite: Embed asInvoker manifest in test executables Pedro Alves
2026-07-10 19:09     ` Pedro Alves
2026-07-11  6:07     ` Eli Zaretskii
2026-07-22 14:16       ` Pedro Alves [this message]
2026-07-10 14:41 ` [PATCH] gdb/Windows testsuite: Avoid "bad" words in exe names Andrew Burgess
2026-07-10 19:14   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e92387ae-2b0e-4305-ac63-3d0038c81b30@palves.net \
    --to=pedro@palves.net \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox