aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2025-03-11 17:43:35 -0400
committerJason Merrill <jason@redhat.com>2025-03-12 11:23:59 -0400
commit90f5dabddbdc47bfbabaabb5b560d3d5cc2acf9c (patch)
tree01643f3c8ead757d425e452f2bb7deb3edca14e5
parent758e617bcf224dc9d4a7e26dd858d43c1e63b916 (diff)
downloadgcc-90f5dabddbdc47bfbabaabb5b560d3d5cc2acf9c.zip
gcc-90f5dabddbdc47bfbabaabb5b560d3d5cc2acf9c.tar.gz
gcc-90f5dabddbdc47bfbabaabb5b560d3d5cc2acf9c.tar.bz2
contrib: relpath.sh /lib /include [PR119081]
Previously, if the common ancestor of the two paths is / we would print the absolute second argument, but this PR asks for a relative path in that case as well, which makes sense for the libstdc++.modules.json use case. PR libstdc++/119081 contrib/ChangeLog: * relpath.sh: Give relative path even at /.
-rwxr-xr-xcontrib/relpath.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/relpath.sh b/contrib/relpath.sh
index ac6b769..1b329fc 100755
--- a/contrib/relpath.sh
+++ b/contrib/relpath.sh
@@ -59,9 +59,9 @@ while [ "${to#$from}" = "$to" ]; do
from=$(dirname $from);
back=../$back
- if [ "$from" = "/" ]; then
- echo $to
- exit 0
+ if [ "$from" = / ] && [ "${to#/}" = "$to" ]; then
+ echo no common ancestor between $1 and $2 >&2
+ exit 1
elif [ "$from" = . ]; then
echo no common ancestor between $1 and $2 >&2
exit 1