cargo.eclass: avoid heredoc in global scope

A heredoc may cause the use of a temporary file with < EAPI 9 and even
then still with >= EAPI 9 if the input is large. This becomes a problem
if sandboxing is applied to metadata generation.

Bug: https://bugs.gentoo.org/978857
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-07-10 17:20:59 +01:00
parent 0733f7f614
commit b982445cd7

View File

@@ -310,7 +310,7 @@ _cargo_set_crate_uris() {
local crate commit crate_uri crate_dir host repo_ext feat_expr
for crate in "${!GIT_CRATES[@]}"; do
IFS=';' read -r crate_uri commit crate_dir host <<< "${GIT_CRATES[${crate}]}" || die "${ECLASS}: could not create heredoc"
IFS=';' read -rd '' crate_uri commit crate_dir host < <(printf %s "${GIT_CRATES[${crate}]}")
if [[ -z ${host} ]]; then
case "${crate_uri}" in