quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] Fix import -f on compressed patches


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] Fix import -f on compressed patches
Date: Sun, 26 Feb 2006 14:52:00 +0100

Hi all,

I have noticed that the import command, when used in replacement mode,
does no more work properly with compressed patches. Unless "-d n" is
used, we go through function merge_patches which assumes that both the
old and the new patch are not compressed, causing data corruption if
they actually are.

I have come up with the following fix, which seems to work for me:

Index: quilt/import.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/import.in,v
retrieving revision 1.38
diff -u -r1.38 import.in
--- quilt/import.in     29 Jan 2006 09:55:44 -0000      1.38
+++ quilt/import.in     26 Feb 2006 13:43:15 -0000
@@ -51,8 +51,8 @@
        local old="$1" new="$2"
        local old_desc=$(gen_tempfile) new_desc=$(gen_tempfile)
 
-       cat "$old" | patch_header | strip_diffstat > $old_desc
-       cat "$new" | patch_header | strip_diffstat > $new_desc
+       cat_file "$old" | patch_header | strip_diffstat > $old_desc
+       cat_file "$new" | patch_header | strip_diffstat > $new_desc
 
        if [ -z "$opt_desc" ]
        then
@@ -79,9 +79,9 @@
        [ "$opt_desc" = a ] && echo '---'
        if [ "$opt_desc" = o ]
        then
-               cat "$new" | patch_body
+               cat_file "$new" | patch_body
        else
-               cat "$new"
+               cat_file "$new"
        fi
        rm -f $old_desc $new_desc
 }
@@ -190,7 +190,10 @@
        fi
 
        if [ "$merged_patch_file" != "$dest" ] && \
-          ! cp "$merged_patch_file" "$dest"
+          (( [ "$merged_patch_file" != "$patch_file" ] && \
+             ! cat_to_new_file "$dest" < "$merged_patch_file" ) || \
+           ( [ "$merged_patch_file" = "$patch_file" ] && \
+             ! cp "$merged_patch_file" "$dest" ))
        then
                printf $"Failed to import patch %s\n" "$(print_patch $patch)" 
>&2
                die 1

Comments welcome. If there are no objections, I'll apply this patch to
CVS.

Thanks,
-- 
Jean Delvare




reply via email to

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