From ae11d3088dd73df1000855102ef90177d102dd52 Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Tue, 25 Oct 2016 09:52:21 +1100 Subject: [PATCH] libxfs_apply: filterdiff can't handle /dev/null properly Because we are mangling the diff source/destination locations, we have to add prefixes to them to get them to apply cleanly as -p1 patches. This is all fine until we create or remove a file and the the src/dest is /dev/null. Applying a prefix here causes the diff to be malformed and it won't apply. Add another hack to work around this limitation of filterdiff when reformatting the diff into readable format. Signed-off-by: Dave Chinner --- tools/libxfs-apply | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/tools/libxfs-apply b/tools/libxfs-apply index 50f628a03..8df1a49dc 100755 --- a/tools/libxfs-apply +++ b/tools/libxfs-apply @@ -140,13 +140,18 @@ filter_kernel_patch() ls -1 fs/xfs/libxfs/*.[ch] | sed -e "s%.*/\(.*\)%*\1%" > $_libxfs_files # Create the new patch + # filterdiff will have screwed up files that source/sink /dev/null. + # fix that up with some sed magic. filterdiff \ - --verbose \ - -I $_libxfs_files \ - --strip=1 \ - --addoldprefix=a/fs/xfs/ \ - --addnewprefix=b/fs/xfs/ \ - $_patch + --verbose \ + -I $_libxfs_files \ + --strip=1 \ + --addoldprefix=a/fs/xfs/ \ + --addnewprefix=b/fs/xfs/ \ + $_patch | \ + sed -e 's, [ab]\/fs\/xfs\/\(\/dev\/null\), \1,' \ + -e '/^diff --git/d' + rm -f $_libxfs_files } @@ -164,13 +169,17 @@ filter_xfsprogs_patch() lsdiff $_patch | sed -e "s%.*/\(.*\)%*libxfs/\1%" > $_libxfs_files # Create the new patch + # filterdiff will have screwed up files that source/sink /dev/null. + # fix that up with some sed magic. filterdiff \ - --verbose \ - -I $_libxfs_files \ - --strip=3 \ - --addoldprefix=a/ \ - --addnewprefix=b/ \ - $_patch + --verbose \ + -I $_libxfs_files \ + --strip=3 \ + --addoldprefix=a/ \ + --addnewprefix=b/ \ + $_patch | \ + sed -e 's, [ab]\/\(\/dev\/null\), \1,' \ + -e '/^diff --git/d' rm -f $_libxfs_files } -- 2.47.2