quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH v2] inspect-wrapper: procfs resolves links


From: Jean Delvare
Subject: [Quilt-dev] [PATCH v2] inspect-wrapper: procfs resolves links
Date: Tue, 24 Nov 2020 15:41:37 +0100
User-agent: Evolution 3.34.4

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>
---
 quilt/scripts/inspect-wrapper.in |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- 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" ]

-- 
Jean Delvare
SUSE L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]