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
pyinstaller 4.1 executables have incorrect references to non-extant archives #5330
Comments
Maybe fixed by #5232? |
@tfoote can you try with locally rebuilt PyInstaller's bootloader? |
Hm, it looks like the pre-compiled bootloaders in the new release were built with PIE enabled. I.e., 4.0: vs. 4.1: If I rebuild bootloader from And it seems
|
I tried building the bootloader this way and it didn't make a difference. The below is how I tested it.
|
Good eye @BoboTiG I confirmed that this PR does resolve this issue. For reference I was testing against: a34a2c5
And it passes both
|
In the first case you are recompiling the bootloader, but you are not installing the updated version. So you're still using the pre-compiled bootloader from the In the second case, you are not building the bootloader at all, so you're using the pre-compiled version that's part of repository (and corresponds to the old, non-PIE version). So using any commit from before the bootloader was rebuilt for the 4.1 release (3873f04) will seemingly "fix" the issue... |
In the console output I saw it installing some things during the waf build so I though it had done enough:
How can I install the version? I'm going based on the documentation I found at: https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html |
You need to run In your case, that would probably be |
CC @htgoebel on this one, as he's the one building the bootloaders. |
As far as I understand, it's perfectly legal for We could expand that search window, but I think it would actually be better to implement full back-to-front scan of the file. This way, we can avoid assumptions about cookie location and also avoid OS-specific parameters; currently on linux, we scan last 4096+ |
…okie Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes pyinstaller#5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
…okie Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes pyinstaller#5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
…okie Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes pyinstaller#5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
…okie Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes pyinstaller#5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
…okie Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes pyinstaller#5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
…okie (#5511) Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes #5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
Description of the issue
Context information (for bug reports)
Output of
pyinstaller --version
:4.1
andlatest
(This is a regression since4.0
which works)Version of Python: e.g. 3.7
Platform: Debian Buster
Did you also try this on another platform? It fails on Stretch too.
try the latest development version, using the following command:
(https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
Make sure everything is packaged correctly
--onefile
option--noupx
or setupx=False
in your .spec-file--debug
topyi-makespec
orpyinstaller
or useEXE(..., debug=1, ...)
in your .spec file.A minimal example program which shows the error
To build the image to reproduce:
docker build -t pyi_error .
Stacktrace / full error message
To run the results
docker run -ti --rm pyi_error
As you can see this works with the bare executable generated by pyinstaller but fails when it's converted to a static object. This was working until the 4.1 release.
There is an issue with a very similiar backtrace: #5257 but it has an associated fix #5258 which I believe is in the release.
This is explicitly being exposed by the interaction with staticx, and similar issues have been seen before: JonathonReinhart/staticx#71
But because this is a specific regression since the latest release here I'm filing the issue here.
I have worked around this issue on my project by pinning back to 4.0: osrf/rocker#106
The text was updated successfully, but these errors were encountered: