Hi Martin,

On Mon, 2020-03-23 at 23:14 +0100, Martin Quinson wrote:
> Description: verbose error message when the series file does not exist
>  patchfns.in(cat_series): Displays an error message when the $SERIES
>  file does not exist, and when run in verbose mode.
> Bug-Debian: https://bugs.debian.org/369908
> Upstream-status: submitted 
> https://lists.nongnu.org/archive/html/quilt-dev/2020-03/msg00000.html
> 
> ---
>  quilt/scripts/patchfns.in |    3 +++
>  1 file changed, 3 insertions(+)
> 
> Index: b/quilt/scripts/patchfns.in
> ===================================================================
> --- a/quilt/scripts/patchfns.in
> +++ b/quilt/scripts/patchfns.in
> @@ -358,6 +358,9 @@ cat_series()
>               sed -e '/^#/d' -e 's/^[ '$'\t'']*//' \
>                   -e 's/[ '$'\t''].*//' -e '/^$/d' "$SERIES"
>       else
> +             if [ "$opt_verbose" ]; then
> +                     printf $"No series file found\n" >&2
> +             fi
>               return 1
>       fi
>  }

This causes a regression:

$ quilt push -v
No series file found
No series file found

The reason is that cat_series() is not only used for "quilt series", it
is also indirectly used internally by other commands. In particular it
is called by find_first_patch() and find_last_patch() which issue their
own "No patches in series" error message when the series file isn't
found. These functions are in turn called by other helper functions, so
there are a lot of code paths leading there.

If the goal is to only issue the message for "quilt series -v" then the
test and message could be moved to series.in, or an explicit verbosity
parameter could be added to cat_series() (and I believe
patches_after()) when we want the error message to be issued (instead
of relying on the global $opt_verbose). This second approach looks
better to me as it avoids duplicating code and is also more flexible if
we later want to issue the error message in other situations.

I just pushed a new test case to cover this situation, so we won't
introduce that kind of regression.

-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to