diff options
author | Jean Delvare <jdelvare@suse.de> | 2020-12-09 11:39:50 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2020-12-09 11:39:50 +0100 |
commit | 6363f217b08b07cabbbe09d2d2ddc68596502e38 (patch) | |
tree | e1f6ac22810a91462e9fb02e72dfa30605bc75b6 | |
parent | 877075d3f525e0beed4c8416c6aa40d61b685c50 (diff) | |
download | quilt-6363f217b08b07cabbbe09d2d2ddc68596502e38.tar.gz |
inspect-wrapper: procfs resolves links
When patch files are passed through stdin, we get the actual patch
file name from procfs. It turns out that procfs resolves symbolic
links, and that breaks our later attempt to strip the prefix from
the path to extract a relative path to the patch file.
This is solved by also resolving symbolic links in the prefix
before stripping it.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
-rw-r--r-- | quilt/scripts/inspect-wrapper.in | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/quilt/scripts/inspect-wrapper.in b/quilt/scripts/inspect-wrapper.in index 7f7eb82..af165e9 100644 --- a/quilt/scripts/inspect-wrapper.in +++ b/quilt/scripts/inspect-wrapper.in @@ -268,7 +268,15 @@ esac if [ -n "$QUILT_SETUP_FAST" -a -z "$inputfile" ] then inputfile=$(readlink /proc/self/fd/0) - [ "${inputfile:0:1}" = / -a -f "$inputfile" ] || inputfile= + if [ "${inputfile:0:1}" = / -a -f "$inputfile" ] + then + # procfs resolved the symlinks, so do the same, otherwise the + # path prefix won't match + RPM_SOURCE_DIR=$(cd -P "$RPM_SOURCE_DIR" && echo "$PWD")/ + else + # Didn't work, so fall back to the slow method + inputfile= + fi fi if [ -n "$inputfile" ] |