On Fri, Jan 18, 2013 at 09:47:09AM +0100, Jean Delvare wrote:
> Le mercredi 19 décembre 2012 à 15:35 +0100, martin.quin...@loria.fr a
> >  [ -z "$opt_verbose" ] && silent_unless_verbose=-s
> >  [ -n "$opt_force" ] && opt_leave_rejects=1
> > --- a/quilt/scripts/patchfns.in
> > +++ b/quilt/scripts/patchfns.in
> > @@ -477,7 +477,7 @@ find_last_patch()
> >             else
> >                     printf $"No series file found\n" >&2
> >             fi
> > -           return 1
> > +           return 2
> >     fi
> >  
> >     echo "$patch"
> 
> This change doesn't have any effect in practice. The only caller of
> find_last_patch() is "quilt mail" and it overwrites the returned value.

This is currently the only caller of find_last_patch. I personally
find dangerous to leave personnal mines in the source code just
because nobody currently runs on it. 

> Plus this would make find_first_patch and find_last_patch diverge for no
> good reason.

Should we possibly fix find_first_patch, then?
 
> I would love if this patch would also add test cases for all conditions
> which are supposed to return 2. This would not only guarantee that such
> a regression isn't reintroduced later, but this would also ensure that
> the fix itself is complete. Unfortunately the testing script doesn't
> support for this yet, but I'm working on it.

Do you mind integrating this even before the test code is working?

> It would also be great to update the manual page to document these
> cases, as it currently lacks an EXIT STATUS section.

Actually, was part of another patch in Debian, as we have a proper
EXIT STATUS section. I just merged both patches, and the result is in
attachment. I know that the patch to the manpage contains an unrelated
change, but this is only a cosmetic improvement so I don't feel like
providing a proper patch. If it really hurts your feeling, I'll commit
this unrelated change myself once you pushed your changes to the tree.

Bye, Mt.

-- 
Le problème, ce n'est pas l'internet. Le problème, c'est l'insécurité
désastreuse de tous ces ordinateurs reliés à l'internet. Il vaudrait
mieux réécrire Windows que TCP/IP. -- Bruce Schneier
Description: Return 2 (instead of 1) when there is nothing to do
 This is mandatory to differentiate "error" and "everything's done".
 .
 This really ease the scripting around quilt, eg in patchsys-quilt.mk 
 .
 It used to works this way, and was changed upstream in commit 
 188c7dac15a72c437c47664d3162b9f13844fe88 for quilt version 0.43. This
 regression was the result of a code factorization.
 .
 This patch also contains the documentation update, by adding a EXIT
 STATUS to the man page.
Bug-Debian: http://bugs.debian.org/358792 (return 2 on NO-OP)
Bug-Debian: http://bugs.debian.org/587001 (document exit status)
Forwarded: Submitted 2013-01-18
Changelog:
 - 2012-12-19: Submitted upstream
 - 2013-01-18: Upstream asked for changes and documentation
 - 2013-01-18: new version subitted upstream
Last-Update: 2013-01-18


Index: quilt.git/quilt/push.in
===================================================================
--- quilt.git.orig/quilt/push.in        2013-01-18 15:35:17.571852522 +0100
+++ quilt.git/quilt/push.in     2013-01-18 15:35:17.511851570 +0100
@@ -362,7 +362,7 @@
        [ -z "$opt_all" ] && number=1
 fi
 
-stop_at_patch=$(find_unapplied_patch "$stop_at_patch") || exit 1
+stop_at_patch=$(find_unapplied_patch "$stop_at_patch") || exit
 
 [ -z "$opt_verbose" ] && silent_unless_verbose=-s
 [ -n "$opt_force" ] && opt_leave_rejects=1
Index: quilt.git/quilt/scripts/patchfns.in
===================================================================
--- quilt.git.orig/quilt/scripts/patchfns.in    2013-01-18 15:35:17.571852522 
+0100
+++ quilt.git/quilt/scripts/patchfns.in 2013-01-18 15:35:17.535851949 +0100
@@ -477,7 +477,7 @@
                else
                        printf $"No series file found\n" >&2
                fi
-               return 1
+               return 2
        fi
 
        echo "$patch"
@@ -582,7 +582,7 @@
                then
                        printf $"Patch %s is currently applied\n" \
                                "$(print_patch $patch)" >&2
-                               return 1
+                               return 2
                fi
                echo "$patch"
        else
@@ -592,13 +592,13 @@
                then
                        patch_after "$start"
                else
-                       find_first_patch || return 1
+                       find_first_patch || return 2
                fi
                if [ $? -ne 0 ]
                then
                        printf $"File series fully applied, ends at patch %s\n" 
\
                                "$(print_patch $start)" >&2
-                       return 1
+                       return 2
                fi
        fi
 }
Index: quilt.git/doc/quilt.1.in
===================================================================
--- quilt.git.orig/doc/quilt.1.in       2013-01-18 15:35:17.571852522 +0100
+++ quilt.git/doc/quilt.1.in    2013-01-18 15:35:17.567852457 +0100
@@ -118,6 +118,13 @@
 
 Print the version number and exit immediately.
 
+.SH EXIT STATUS
+
+The exit status is 0 if the subcommand was successfully executed, and
+1 in case of error. An exit status of 2 denotes that quilt did not do
+anything to complete the command; This happens for example when asking
+to push when the whole stack is already pushed. This behavior is
+intended to ease the scripting around quilt.
 
 .SH EXAMPLE OF WORKING TREE
 
@@ -137,9 +144,7 @@
 .RE
 .fam T
 
-.SH EXAMPLE
-
-Please refer to the pdf documentation for an example.
+Please refer to the pdf documentation for a full example of use.
 
 .SH CONFIGURATION FILE
 
_______________________________________________
Quilt-dev mailing list
Quilt-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to