From: Dave Chinner Date: Mon, 24 Oct 2016 22:52:21 +0000 (+1100) Subject: libxfs_apply: filterdiff can't handle /dev/null properly X-Git-Tag: v4.9.0-rc1~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae11d3088dd73df1000855102ef90177d102dd52;p=thirdparty%2Fxfsprogs-dev.git 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 --- 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 }