Hi all,

I noticed that quilt import will not behave correctly if run on a
non-existent patch. It will print something along these lines:

Importing patch something.diff (stored as something.diff)
cp: cannot stat `something.diff': No such file or directory
Failed to import patch something.diff

So far so good, except that a patch named something.diff has been added
to the series file, regardless of the error. So we are in the
inconsistent state where a patch referenced in the series file doesn't
actually exist in the patches subdirectory.

I traced the problem down to revision 1.22 of quilt/import.in, in July
2004. The main goal of this revision was to replace all calls to echo by
calls to printf. However, it also introduced the "status" variable,
setting it to 1 when the error I just decribed occurs, rather than
bailing out immediately as was the case originally. This is why the
script will now still add the patch to the series file when the error
occurs.

It looks to me like the correct fix is to simply revert the introduction
of the status variable (see attached patch) but I'd like to know the
motivations that led to the introduction of the "status" variable in the
first place. Maybe I am missing something?

Andreas?

If the fix looks correct, I'll commit it to CVS.

Thanks,
-- 
Jean Delvare
Index: quilt/import.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/import.in,v
retrieving revision 1.22
diff -u -r1.22 import.in
--- quilt/import.in     9 Jul 2004 07:26:33 -0000       1.22
+++ quilt/import.in     9 Aug 2005 18:00:02 -0000
@@ -77,7 +77,6 @@
 
 [ -n "$opt_strip" ] && patch_args="-p$opt_strip"
 
-status=
 for patch_file in "$@"
 do
        if [ -n "$opt_patch" ]
@@ -113,7 +112,7 @@
        if ! cp "$patch_file" "$dest"
        then
                printf $"Failed to import patch %s\n" "$(print_patch $patch)" 
>&2
-               status=1
+               exit 1
        fi
 
        if ! patch_in_series $patch &&
@@ -127,7 +126,6 @@
        rm -rf $QUILT_PC/$patch
 done
 
-exit $status
 ### Local Variables:
 ### mode: shell-script
 ### End:
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to