Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 830854 (package-manager-specific-env-vars-usage) - [TRACKER] Packages using leaked package-manager-specific environmental variables
Summary: [TRACKER] Packages using leaked package-manager-specific environmental variables
Status: CONFIRMED
Alias: package-manager-specific-env-vars-usage
Product: Quality Assurance
Classification: Unclassified
Component: Trackers (show other bugs)
Hardware: All All
: Normal normal
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords: Tracker
Depends on: 830857 830858 830859 830855 830860
Blocks: 721088
  Show dependency tree
 
Reported: 2022-01-09 15:58 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2022-02-26 16:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2022-01-09 15:58:08 UTC
Tracker for packages using leaked package-manager-specific environmental variables.

Future EAPI will possibly change package-manager-specific environmental variables (e.g. ROOT, EROOT) to be only set, but not exported. These environmental variables are designed to be used only by ebuilds / eclasses, and may be harmful for tools originating from outside of Gentoo which use identically named environmental variables for different purposes.

(Environmental variables documented in external standards such as POSIX (e.g. HOME, LANG, LC_*, PATH, TMPDIR) will not be affected.)

Some tools called by ebuilds / eclasses use some of package-manager-specific environmental variables.

Usual solutions:

1. Changing tools to retrieve some values through command-line options instead of environmental variables.
E.g. if some tool uses ROOT environmental variable, then it can be changed to accept --root=... command-line option.

Example:
	${tool} --root="${ROOT}" ...

2. Exporting necessary environmental variables before calling tools.

Example 1:
	(
		export ROOT
		${tool} ...
	)

Example 2:
	(
		declare -g -x ROOT
		${tool} ...
	)

Example 3:
	export ROOT
	${tool} ...
	export -n ROOT

Example 4:
	declare -g -x ROOT
	${tool} ...
	declare -g +x ROOT

Example 5:
	env ROOT="${ROOT}" ${tool} ...