commit: e32009dfab8f4d22e3fb29817cd493ef1ff40768
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jun 8 19:06:44 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 9 02:51:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e32009df
ecompress: use mktemp(1) in guess_suffix()
Though mktemp(1) is not a standard utility, it is already being employed
elsewhere. Namely by "emerge-webrsync", "estrip", "etc-update" and the
"helper-functions.sh" library. Should the decision be made in the future
that it is inappropriate to rely on the presence of the utility, there
remains the possibility of implementing it as a function in the case
that the utility is found to be unavailable.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/ecompress | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bin/ecompress b/bin/ecompress
index 037e5b80df..b63763ed30 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -122,8 +122,7 @@ guess_suffix() {
trap 'rm -rf -- "${tmpdir}"' RETURN
- tmpdir=${T}/.ecompress$$.${RANDOM}
- mkdir -- "${tmpdir}" \
+ tmpdir=$(mktemp -d -p "${T:-/tmp}") \
&& cd -- "${tmpdir}" \
|| return