From: Jason Merrill Date: Tue, 11 Mar 2025 21:43:35 +0000 (-0400) Subject: contrib: relpath.sh /lib /include [PR119081] X-Git-Tag: basepoints/gcc-16~1552 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90f5dabddbdc47bfbabaabb5b560d3d5cc2acf9c;p=thirdparty%2Fgcc.git 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 /. --- diff --git a/contrib/relpath.sh b/contrib/relpath.sh index ac6b769ef81..1b329fc04a7 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