summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-06-07 08:52:46 +0200
committerUlrich Müller <ulm@gentoo.org>2023-06-07 08:58:58 +0200
commit6010e062fbaf504c3f3d4c78f6e7fa506af8a49d (patch)
treefe2af558992bdaaed3e1f2bc3ea91f520ea61264
parentdev-util/nvidia-cuda-toolkit: update dependency on openssl (diff)
downloadgentoo-6010e062fbaf504c3f3d4c78f6e7fa506af8a49d.tar.gz
gentoo-6010e062fbaf504c3f3d4c78f6e7fa506af8a49d.tar.bz2
gentoo-6010e062fbaf504c3f3d4c78f6e7fa506af8a49d.zip
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: d5638e49ee79c0f7e4672d5537e97a4ccc7f2eb2 Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--eclass/eapi8-dosym.eclass2
-rwxr-xr-xeclass/tests/eapi8-dosym.sh4
2 files changed, 4 insertions, 2 deletions
diff --git a/eclass/eapi8-dosym.eclass b/eclass/eapi8-dosym.eclass
index 93b11dda7fd6..e139b74cfea0 100644
--- a/eclass/eapi8-dosym.eclass
+++ b/eclass/eapi8-dosym.eclass
@@ -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
diff --git a/eclass/tests/eapi8-dosym.sh b/eclass/tests/eapi8-dosym.sh
index 9290026a26de..cae66e3bb2ee 100755
--- a/eclass/tests/eapi8-dosym.sh
+++ b/eclass/tests/eapi8-dosym.sh
@@ -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