Skip to content

Commit

Permalink
eapi8-dosym.eclass: Don't add a spurious newline to the path
Browse files Browse the repository at this point in the history
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: d5638e4
Signed-off-by: Ulrich Müller <[email protected]>
  • Loading branch information
ulm committed Jun 7, 2023
1 parent 5165cc0 commit 6010e06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eclass/eapi8-dosym.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion eclass/tests/eapi8-dosym.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6010e06

Please sign in to comment.