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

Do not export PMS variables in EAPI 9 #1407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Flowdalic
Copy link
Member

Instead of passing PMS variables as part of the process environment, we pass them via a file that is later sourced by the ebuild's bash.

Since, for example, A is usually the greatest contributor to the process environment, removing it from the process environment significantly avoids running into MAX_ARG_STRLEN when spawning a new child process.

This means that A and other PMS variables are no longer exported in the ebuild and hence unavaiable to child processes. However, A is mostly used as part of the default_src_unpack function and there A does not need to be exported.

This started as a change that only unexported A, but was later extended to most PMS variables as suggested by ulm in https://bugs.gentoo.org/721088#c23.

Thanks to Zac Medico for helpful input on this change.

Closes: https://bugs.gentoo.org/721088

@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from 13610de to 6753aea Compare December 30, 2024 15:44
@Flowdalic Flowdalic changed the title WIP: Do not export PMS variables in EAPI 9 Do not export PMS variables in EAPI 9 Dec 30, 2024
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 5 times, most recently from 879a6fb to 67106ed Compare December 30, 2024 18:40
lib/portage/const.py Outdated Show resolved Hide resolved
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 2 times, most recently from 4ba182a to a8e44e3 Compare December 31, 2024 09:20
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from a8e44e3 to 834f78c Compare January 1, 2025 14:24
Flowdalic added a commit to Flowdalic/gentoo that referenced this pull request Jan 1, 2025
Once a future EAPI does no longer export PMS variables (bug #721088 and
[1]), we need to explicitly ensure that those are exported to helper
commands which expect certain PMS variables in their process
environment.

While the portage ebuild is usually deliberately not using the latest
EAPI, it may be a good idea to make it explicit that the _compat_upgrade
helpers expect ED in their process environment.

1: gentoo/portage#1407

Signed-off-by: Florian Schmaus <[email protected]>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Jan 1, 2025
Once a future EAPI does no longer export PMS variables (bug #721088 and
[1]), we need to explicitly ensure that those are exported to helper
commands which expect certain PMS variables in their process
environment.

While the portage ebuild is usually deliberately not using the latest
EAPI, it may be a good idea to make it explicit that the _compat_upgrade
helpers expect ED in their process environment.

1: gentoo/portage#1407

Signed-off-by: Florian Schmaus <[email protected]>
Closes: #39934
Signed-off-by: Sam James <[email protected]>
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 2 times, most recently from bed117b to 7ef309a Compare January 7, 2025 13:19
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 5 times, most recently from 5562b8e to ba9955e Compare January 8, 2025 18:37
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 4 times, most recently from c3264d6 to b4201dd Compare January 9, 2025 10:18
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 3 times, most recently from 6e5e977 to 4f097cd Compare January 9, 2025 12:35
bin/isolated-functions.sh Outdated Show resolved Hide resolved
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from 4f097cd to 1c4b427 Compare January 10, 2025 07:45
@Flowdalic
Copy link
Member Author

Now is a good time for others to test this patch and the feature. Set FEATURES="${FEATURES} -export-pms-vars" in make.conf to enable the behavior in all existing EAPIs. Make sure to use sys-apps/portage-9999, since sys-apps/portage was the only ebuild I have encountered so far that is affected by this change, and the -9999 ebuild of portage takes it into consideration.

@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 7 times, most recently from 4b8a7d3 to 5fe52d3 Compare January 11, 2025 19:30
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 5 times, most recently from bff62ca to 3edb8dc Compare January 12, 2025 14:05
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch 5 times, most recently from b0dec44 to f82b561 Compare January 17, 2025 08:14
Instead of passing PMS variables as part of the process environment,
we pass them via a file that is later sourced by the ebuild's
bash.

Since, for example, A is usually the greatest contributor to the
process environment, removing it from the process environment
significantly avoids running into MAX_ARG_STRLEN when spawning a new
child process.

This means that A and other PMS variables are no longer exported in
the ebuild and hence unavaiable to child processes. However, A is
mostly used as part of the default_src_unpack function and there A
does not need to be exported.

This started as a change that only unexported A, but was later
extended to most PMS variables as suggested by ulm in
https://bugs.gentoo.org/721088#c23.

Thanks to Zac Medico for helpful input on this change, and to Eli
Schwartz for suggesting that (bash) helpers should simply source the
environment file introduced by this change.

Closes: https://bugs.gentoo.org/721088
Signed-off-by: Florian Schmaus <[email protected]>
@Flowdalic Flowdalic force-pushed the pass-env-via-file-dont-export-pms-vars branch from f82b561 to ec32784 Compare January 18, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants