commit:     5461ae06e8cdfe7a6b275713ed5226258b528af1
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  7 08:44:38 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Jun  7 08:56:55 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5461ae06

dosym: Fix another corner case of strange input

echo doesn't work as expected when the first argument is "-e".
Thanks to tirnanog in #gentoo-portage for pointing this out.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 bin/ebuild-helpers/dosym | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
index c87cf42b2..89ee66a96 100755
--- a/bin/ebuild-helpers/dosym
+++ b/bin/ebuild-helpers/dosym
@@ -33,7 +33,7 @@ if [[ ${option_r} ]]; then
        dosym_canonicalize() {
                local path slash i prev out IFS=/
 
-               read -r -d '' -a path < <(echo -n "${1}")
+               read -r -d '' -a path < <(printf '%s\0' "${1}")
                [[ ${1} == /* ]] && slash=/
 
                while true; do
@@ -58,7 +58,7 @@ if [[ ${option_r} ]]; then
                done
 
                out="${slash}${path[*]}"
-               echo "${out:-.}"
+               printf "%s\n" "${out:-.}"
        }
 
        # Expansion makes sense only for an absolute target path

Reply via email to