summaryrefslogtreecommitdiffstats
path: root/config.tests/unix
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-10-25 20:31:44 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-30 23:26:58 +0100
commitbf0c9c3becbe1f4e42a836f8564b62c18529ef55 (patch)
treead7fb3c4aea7d74ef26542b398e1cdb693cc64da /config.tests/unix
parent54c8c7a96a9303e7a56ca3cef8dcb1e91f23f2ac (diff)
turn makeabs into a proper cleanPath()
normalize away all ".." and ".". fewer surprises that way. Change-Id: Iaa56c634aed5c8351966eaea7a73b85cb8235ead Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'config.tests/unix')
-rwxr-xr-xconfig.tests/unix/makeabs14
1 files changed, 7 insertions, 7 deletions
diff --git a/config.tests/unix/makeabs b/config.tests/unix/makeabs
index 4df26f769f..d2f65d19e9 100755
--- a/config.tests/unix/makeabs
+++ b/config.tests/unix/makeabs
@@ -15,13 +15,13 @@ elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then
true
else
RES="$PWD/$FILE"
- test -d "$RES" && RES="$RES/"
- RES=`echo "$RES" | sed "s,/\(\./\)*,/,g"`
-
-# note: this will only strip 1 /path/../ from RES, i.e. given /a/b/c/../../../, it returns /a/b/../../
- RES=`echo "$RES" | sed "s,\(/[^/]*/\)\.\./,/,g"`
-
- RES=`echo "$RES" | sed "s,//,/,g" | sed "s,/$,,"`
fi
+RES=$RES/
+while true; do
+ nres=`echo "$RES" | sed "s,/[^/][^/]*/\.\./,/,g; s,/\./,/,g"`
+ test x"$nres" = x"$RES" && break
+ RES=$nres
+done
+RES=`echo "$RES" | sed "s,//,/,g; s,/$,,"`
echo $RES #return