eapi8-dosym.eclass: Don't add a spurious newline to the path

Bash's <<< operator will append a newline to the string, therefore use
echo -n instead.

Add a couple of test cases that would have caught this.

Fixes: d5638e49ee
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
This commit is contained in:
Ulrich Müller
2023-06-07 08:52:46 +02:00
parent 5165cc0405
commit 6010e062fb
2 changed files with 4 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ esac
_dosym8_canonicalize() {
local path slash i prev out IFS=/
read -r -d '' -a path <<< "$1"
read -r -d '' -a path < <(echo -n "$1")
[[ $1 == /* ]] && slash=/
while true; do

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2020 Gentoo Authors
# Copyright 2020-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -50,8 +50,10 @@ done
teq . _dosym8_canonicalize .
teq foo _dosym8_canonicalize foo
teq foo _dosym8_canonicalize ./foo
teq foo _dosym8_canonicalize foo/.
teq ../foo _dosym8_canonicalize ../foo
teq ../baz _dosym8_canonicalize foo/bar/../../../baz
teq '*' _dosym8_canonicalize '*'
for f in ref_dosym_r "dosym8 -r"; do
teq ../../bin/foo ${f} /bin/foo /usr/bin/foo