Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 830854 (package-manager-specific-env-vars-usage)

Summary: [TRACKER] Packages using leaked package-manager-specific environmental variables
Product: Quality Assurance Reporter: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Component: TrackersAssignee: Gentoo Quality Assurance Team <qa>
Status: CONFIRMED ---    
Severity: normal CC: esigra
Priority: Normal Keywords: Tracker
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 830857, 830858, 830859, 830855, 830860    
Bug Blocks: 721088    

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} ...