[FIX] OS argument limit can be reached by pre/post launch metadata variables#5404
[FIX] OS argument limit can be reached by pre/post launch metadata variables#5404Nyte-Sky wants to merge 6 commits intoHeroic-Games-Launcher:mainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
c1df4c2 to
700ce9c
Compare
|
I have read the CLA Document and I hereby sign the CLA |
|
I wonder if we could make this automatic? I'm thinking we could calculate how long the command will be if we use inline env variables and if it's more than some number we automatically use an env file? my concerns is that users will have no idea when to use or not that, or if they have the issue they'll have no idea this check solves that issue if we can automate that and make it transparent for the user it would be way more user-friendly an alternative would be to never set the SETTINGS and INFO env variables and always have those in a file, then I imagine it would never be that long and we don't need an option or automate any length calculation |
|
I wanted to keep functionality the same for existing scripts that use these variables, I think it would be very confusing if your pre-launch script suddenly stops working. However, the number of people who actually use these variables is probably quite low. |
|
hmmm maybe the logic of calculating the length and setting a file or not depending on that can be implemented as a way to still support scripts that currently use them and at the same time automatically fix these issues when the metadata is too long without the user having to know this issue or that there's even a limit in arguments at the OS level (for many users that will be just a lot of random tech terms) |
…cial case for E2BIG. Also updates option text to be more descriptive.
|
I think the issue with that is the user doesn't see whether or not their script gets a file or the direct variables. People can change their PATH, for example, and now maybe they reach the limit where before they didn't. Scripts that expect direct variables won't work for people who's system requires passing via a file. Of course we're still talking about probably a very small number of scripts that actually require game metadata at all. The most likely case I can think of is some sort of stream overlay. |
|
Since you can reproduce the issue, can you confirm if you have verboseLogs enabled for the game? Because I see that if the I was wondering if we can catch the error message and print something in the logs like "The script couldn't run because the arguments list is too long, configure the game to use an environment file for the before/after scripts instead and use the HEROIC_METADATA_FILE env variable" (or whatever makes it clear for the user the using the option will fix the problem) |
|
or maybe we need a try/catch around the line that calls |
When a pre/post launch script is ran, a game's metadata passed as environment variables to the script. When this metadata is too long, it can reach the OS maximum argument limit, causing the script to fail silently. This PR adds an option to instead write the metadata to a file, and pass the path to this file as a singular variable.
This fixes #5243
Use the following Checklist if you have changed something on the Backend or Frontend: