]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs_apply: filterdiff can't handle /dev/null properly
authorDave Chinner <david@fromorbit.com>
Mon, 24 Oct 2016 22:52:21 +0000 (09:52 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 24 Oct 2016 22:52:21 +0000 (09:52 +1100)
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 <david@fromorbit.com>
tools/libxfs-apply

index 50f628a033d4d5a783682049929289c56a52d391..8df1a49dc4cc275b24eca8a345e40f4b3814a038 100755 (executable)
@@ -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
 }