diff --git a/mk/relpath.sh b/mk/relpath.sh
index c2f82f430bb47a90150fd5f4851653493db1d1db..a9bb55409f2c58536e91d3a117d61d5152f9f9cb 100755
--- a/mk/relpath.sh
+++ b/mk/relpath.sh
@@ -15,7 +15,7 @@ target="$2"
 common_part="$src"
 result=""
 
-while test "${target#$common_part}" = "${target}" ; do
+while test "${target#"$common_part"}" = "${target}" ; do
     #echo "common_part is now : \"$common_part\""
     #echo "result is now      : \"$result\""
     #echo "target#common_part : \"${target#$common_part}\""
@@ -39,7 +39,7 @@ fi
 
 # since we now have identified the common part,
 # compute the non-common part
-forward_part="${target#$common_part}"
+forward_part="${target#"$common_part"}"
 #echo "forward_part = \"$forward_part\""
 
 if test -n "$result" && test -n "$forward_part" ; then