[PATCH 2/6] cargo.eclass: avoid heredoc in global scope

Sam James <[email protected]> Fri, 10 Jul 2026 17:41:08 +0100
Newsgroups gmane.linux.gentoo.devel
Message-ID <455cc1e4a23aced184bd70ba8fae308db59693a5.1783701660.git.sam@gentoo.org>
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 <[email protected]>
---
 eclass/cargo.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index bf2a820537878..185531490a25a 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -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
-- 
2.55.0