-
Notifications
You must be signed in to change notification settings - Fork 8
[ISV-5621] Fix "Argument list too long" error. #450
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
Conversation
b03767e
to
db73987
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one doubt: if the root cause is the size of the environment, why are the external commands issued in opp-oprt.sh
after the variables have been exported not affected by this problem?
Perhaps the call to the other script at the end of the script adds just enough extra variables to trigger the behaviour? If that's the case I'm afraid we will see this issue coming back with larger PRs and will need to address this in a different way.
That may be right. I guess we can perform the export right before the subshell with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if this is not ideal, I would still give it a try.
As long as we are relying on environment variables to pass those values, we are pretty much guaranteed we will hit the limit sooner or later, but a proper solution would probably require using files instead so it might not be a trivial change.
Edit: another approach that might be worth exploring is the following: instead of calling the next script using bash, we could try sourcing the next script instead: it would not require any execve()
and the variables would not even require to be exported but it might cause other issues (for example the environment in the second script would be polluted by the environment from non-exported variables in the first script) so it would require careful testing.
ci/scripts/opp-oprt.sh
Outdated
export OPP_RENAMED_FILES | ||
export OPP_ADDED_MODIFIED_FILES | ||
export OPP_ADDED_MODIFIED_RENAMED_FILES | ||
bash <(echo "$OPP_SCRIPT_FILE_CONTENTS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will still issue an execve()
under the hood (to run bash) so I'm not sure this will make any difference.
Signed-off-by: Marek Szymutko <mszymutk@redhat.com>
a10699a
to
a3f9dd9
Compare
I have decided to use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! 👍
This error resolves "Argument list too long". As specified in the comment, the error was occurring when too many files were changed because their names were stored in a variable that was exported in a previous script. This overflowed the buffers in Bash (https://linux.die.net/man/2/execve) and caused any invoked command to raise the mentioned issue (even commands like
sleep 1
).To replicate this, I have exported the variables from the failed pipeline run and created this env file:
And named is as
prepare.sh
. Then I have ransource prepare.sh
, adjusted theci/scripts/opp-opprt.sh
to not fail on git commands as well as calling the local/path/to/repo/ci/scripts/opp-env.sh
file instead ofcurl
ing it. Then I issued the commandbash ci/scripts/opp-opprt.sh
.The run has succeeded.
If you wish to replicate it, the pipeline will mess with your local git config, so sorry for committing as "Test User".