Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 190128
Collapse All | Expand All

(-)bin/ebuild.sh (-5 / +44 lines)
Lines 1054-1061 Link Here
1054
	echo "${USE}"		> USE
1054
	echo "${USE}"		> USE
1055
	echo "${EAPI:-0}"	> EAPI
1055
	echo "${EAPI:-0}"	> EAPI
1056
	set +f
1056
	set +f
1057
	set                     >  environment
1057
1058
	export | sed 's:^declare -rx:declare -x:' >> environment
1058
	save_ebuild_env > environment
1059
	bzip2 -f9 environment
1059
	bzip2 -f9 environment
1060
1060
1061
	cp "${EBUILD}" "${PF}.ebuild"
1061
	cp "${EBUILD}" "${PF}.ebuild"
Lines 1467-1472 Link Here
1467
	PATH="${stripped_path}"
1467
	PATH="${stripped_path}"
1468
}
1468
}
1469
1469
1470
save_ebuild_env() {
1471
	# In bash-3.2_p20+ an attempt to assign BASH_*, FUNCNAME, GROUPS or any
1472
	# readonly variable cause the shell to exit while executing the "source"
1473
	# builtin command. To avoid this problem, this function filters those
1474
	# variables out and discards them. See bug #190128.
1475
	local readonly_vars=$(readonly | while read line; \
1476
		do [[ ${line} == "declare -"*" "*"="* ]] || continue ; \
1477
		x=${line%%=*} ; echo ${x##* } ; done)
1478
	local x var_grep=""
1479
	for x in BASH SANDBOX ; do
1480
		var_grep="${var_grep}|(^|^declare[[:space:]]+-[^[:space:]]+[[:space:]]+)${x}_[_[:alnum:]]*=.*"
1481
	done
1482
	for x in ${readonly_vars} var_grep LD_PRELOAD FAKEROOTKEY FUNCNAME GROUPS ; do
1483
		var_grep="${var_grep}|(^|^declare[[:space:]]+-[^[:space:]]+[[:space:]]+)${x}=.*"
1484
	done
1485
	var_grep=${var_grep:1} # strip the first |
1486
	unset x readonly_vars
1487
	(
1488
		# There's no need to bloat environment.bz2 with internally defined
1489
		# functions and variables, so filter them out if possible.
1490
1491
		unset -f dump_trace diefunc quiet_mode vecho elog_base eqawarn elog \
1492
			esyslog einfo einfon ewarn eerror ebegin _eend eend KV_major \
1493
			KV_minor KV_micro KV_to_int get_KV unset_colors set_colors has \
1494
			hasv hasq qa_source qa_call addread addwrite adddeny addpredict \
1495
			lchown lchgrp esyslog use usev useq has_version portageq \
1496
			best_version use_with use_enable register_die_hook check_KV \
1497
			keepdir unpack strip_duplicate_slashes econf einstall gen_wrapper \
1498
			dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
1499
			insopts diropts exeopts libopts abort_handler abort_compile \
1500
			abort_test abort_install dyn_compile dyn_test dyn_install \
1501
			dyn_preinst dyn_help debug-print debug-print-function \
1502
			debug-print-section inherit EXPORT_FUNCTIONS newdepend newrdepend \
1503
			newpdepend do_newdepend remove_path_entry killparent \
1504
			save_ebuild_env
1505
1506
		set
1507
		export
1508
	) | egrep -v -e "${var_grep}"
1509
}
1510
1470
# === === === === === === === === === === === === === === === === === ===
1511
# === === === === === === === === === === === === === === === === === ===
1471
# === === === === === functions end, main part begins === === === === ===
1512
# === === === === === functions end, main part begins === === === === ===
1472
# === === === === === functions end, main part begins === === === === ===
1513
# === === === === === functions end, main part begins === === === === ===
Lines 1779-1787 Link Here
1779
	unset myarg
1820
	unset myarg
1780
	# Save current environment and touch a success file. (echo for success)
1821
	# Save current environment and touch a success file. (echo for success)
1781
	umask 002
1822
	umask 002
1782
	set | egrep -v -e "^SANDBOX_" -e "^LD_PRELOAD=" -e "^FAKEROOTKEY=" > "${T}/environment" 2>/dev/null
1823
	save_ebuild_env > "${T}/environment" 2>/dev/null
1783
	export | egrep -v -e "^declare -x SANDBOX_" -e "^declare -x LD_PRELOAD=" -e "^declare -x FAKEROOTKEY=" | \
1784
		sed 's:^declare -rx:declare -x:' >> "${T}/environment" 2>/dev/null
1785
	chown portage:portage "${T}/environment" &>/dev/null
1824
	chown portage:portage "${T}/environment" &>/dev/null
1786
	chmod g+w "${T}/environment" &>/dev/null
1825
	chmod g+w "${T}/environment" &>/dev/null
1787
fi
1826
fi

Return to bug 190128