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
Remove limits on output file size. #256
Conversation
@andrewla I know this is probably not helpful, but PRs with tests have a higher chance of getting merged. I do not have ideas how to make a dummy big output. |
I'm going to put this on hold. As a stress test, I used this as an overlay for patchelf in nix, I'm getting errors trying to build gcc. Not clear if this is patchelf related or some configuration problem, but for the moment I don't consider this safe to merge. |
FWIW, this patch seems to work for me. I tried this patch, and also tried just boosting the buffer size to 256MB. The output of each method was identical. Unfortunately I am not able to share my test case, because of IP reasons. I haven't reviewed the changes to make sure there are no lingering pointers, but at least it passes valgrind. |
I'm all but positive that the errors encountered are related to how nix does bootstrapping of the compiler, rather than related to this change specifically. |
Hey. I joined the maintainer team of patchelf recently if you could resolve the merge conflicts I give this a test. |
I applied the latest changes; I get a strange test failure locally because it can't find the "strip" utility but that appears to be some autoconf issue that is probably local to my machine; running the strip manually (to produce |
Does Line 3 in c62988a
|
So one way to test this is to link in a large binary blob (can be created with |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-work-around-patchelf-maximum-file-size-exceeded-error/14920/2 |
I think the problem is not in original binary size, but in limited growth that
|
Ran into this issue while attempting to package tensorflow 2.6.0:
|
Oddly enough, I've not been able to reproduce the failure outside of the nix build environment. I've been trying to provide a test case for this, but patchelf isn't failing outside of nix-build. In my
And I get output:
(You can find the full code to reproduce in NixOS/nixpkgs#137069, But when I try to test patchelf outside of nix-build:
But then... it works oddly enough 😕 But @trofi's test case looks simpler anyhow! |
Here's a branch with a full reproduction: https://github.com/samuela/nixpkgs/tree/samuela/pr-256-does-not-work. Just run EDIT: I'm thoroughly confused how I'm still seeing this error message at all considering the word "maximum" doesn't even show up anywhere in EDIT 2: Mystery solved... the subtlety was that it was failing in |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-work-around-patchelf-maximum-file-size-exceeded-error/14920/3 |
Thanks. I try to add this test case as soon as I can. |
To be honest I'm surprised that the test works, because each resize is for the same amount, which is less that 32MB. I guess the shifting or alignment makes it a cumulative effect. Regardless, it takes a long time for this to run, and the produced executable doesn't run because the needed libraries aren't found. If we use add-rpath instead, we get the same effect (overflow), and we can run the produced executable, but we can only add one rpath per command line so it's a little less efficient. Considering a patch that would allow text arguments to be prefixed with @ to indicate that the argument should be read from a file instead of directly from the command line; that way we can just pass in a 40MB rpath string in one go. |
Created #316 for the |
The |
The use of self-pointers into a vector<> meant that the vector could not be relocated, which meant that any growth in the file had to fit within the inital reservation. Now, instead of a pointer to a header and a pointer to the contents, those values are computed dynamically from the underlying vector().
Added a test that attempts to grow the file. Have confirmed that this fails on the current master:
|
We also build now for clang for regression testing. I fixed the tests for that. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-work-around-patchelf-maximum-file-size-exceeded-error/14920/5 |
I made an attempt at writing a test that would provide coverage, but couldn't make it work. If you have suggestions for writing a test to test this functionality, please let me know and I'll give it a shot.