SHA256
1
0
forked from pool/quilt
quilt/hackweek-11-16-setup-fix-create_symlink-corner-case.patch

26 lines
720 B
Diff
Raw Normal View History

From: Jean Delvare <jdelvare@suse.de>
Subject: setup: Fix a corner case in create_symlink
Upstream: Submitted (2015-02-03)
References: boo#916007
When a link's target is the directory it lives in, create_symlink
would erroneously link to "..". Fix the code to properly link to "."
instead.
Credits to Robert Milasan for spotting the bug.
---
quilt/setup.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -97,7 +97,7 @@ create_symlink()
do
set -- "${1#*/}" "${2#*/}"
done
- up=$(echo "${2%/*}" | sed -re 's:[^/]+:..:g')
+ up=$(echo "$2" | sed -r -e 's:(^|/)[^/]*$::' -e 's:[^/]+:..:g')
set -- "${up:+$up/}$1"
set -- "${1%/}"
ln -s "${1:-.}" "$link"