Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couple of fixes for MinGW-w64 #6199

Merged
merged 4 commits into from
Sep 11, 2021
Merged

Couple of fixes for MinGW-w64 #6199

merged 4 commits into from
Sep 11, 2021

Conversation

rokm
Copy link
Member

@rokm rokm commented Sep 10, 2021

Fixes for the two issues from #6196 and a problem with string handling in exception dialog.

Suppress two format-truncation warnings in the windows-only
codepath, which end up treated as errors by the winlibs mingw
toolchain.

The warnings arise because we do not check the return value of
the snprintf() calls (which might truncate the message), but in
those particular instances, we do not care about truncation.
Therefore, explicitly suppress the warnings via pragmas instead of
trying to work around them.
When assembling Windows executable, first remove all resources from
the copy of bootloader file. This ensures that executable contains
no embedded manifest, even if the bootloader was compiled using a
toolchain that forcibly embeds a default manifest (e.g., mingw gcc
toolchain from msys2).

In onefile builds, the manifest (if already present) is rewritten
later on, so it poses no problem. In onedir builds, however, an
already present manifest makes Windows ignore the generated
external manifest. This means that options such as uac-admin are
effectively ignored, and that Common Controls v6 are not loaded
for windowed bootloaders, resulting in an entry point for
LoadIconMetric not being found.
It seems that with MinGW-w64 gcc, the %s format argument in a
wide-char swprintf() function call does not correspond to wide-char
(as it does under MSVC), but rather to single-char. Therefore, with
mingw-compiled bootloader, the exception dialog displays only initial
letters of script name and exception message.

Use %ls to remove all ambiguity.
@rokm rokm added the needs backport This pull request needs cherry picking onto the v4 branch. label Sep 10, 2021
@rokm rokm merged commit d5792f5 into pyinstaller:develop Sep 11, 2021
@rokm rokm removed the needs backport This pull request needs cherry picking onto the v4 branch. label Sep 11, 2021
@rokm rokm deleted the fix-mingw branch September 11, 2021 11:30
@rokm rokm added the backported Backported to v4 branch label Sep 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backported Backported to v4 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants