quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] issue with quilt push -f


From: Jean Delvare
Subject: Re: [Quilt-dev] issue with quilt push -f
Date: Tue, 14 Oct 2014 15:21:23 +0200

Hi Aristeu, Martin,

Preliminary note: I'm pretty sure I discussed the -f option of patch in
"quilt push" with Andreas Gruenbacher on this list long ago, but
unfortunately I am unable to find the discussion thread again :-(

Le Wednesday 17 September 2014 à 22:38 +0000, Martin Panter a écrit :
> On 17/09/2014, Aristeu Rozanski <address@hidden> wrote:
> > The next step, my usual "quilt push -f" didn't quite did the expected,
> > it just ran patch without -f and patch just thought it was a full revert
> > based on the first hunk. Now I understand that "quilt push -f -q" will
> > make quilt use "-f" for patch, but here's the problem: using quilt push
> > without -q is supposed to be "interactive" except it isn't after the
> > color output support:
> > . . .
> 
> I found this behaviour annoying when I used to use Quilt a long time
> ago (possibly even before colour output support?).

Color support for "quilt push" was added in January 2005:
http://git.savannah.gnu.org/cgit/quilt.git/commit/?id=ddc509bc766fbde0eb8a5dfe9acb25fbce7b1aaf
so that's quite ancient. Your patch being dated 23 Sep 2009, I guess you
wrote it long after color support was added.

I think I may have been bitten by that bug a few times as well, even
though I couldn't identify the reason back then. So thanks for
reporting :-)

> > 1) could simply use -f for patch always, and have -q still
> >   useful to supress further messages
> 
> Here’s a patch written a few years ago which should do option 1. See
> <https://github.com/vadmium/quilt/commit/b675543b1c16cb00c8132cfee9c8d40cdae87dbf.patch>
> in case G Mail screws it up.
> 
> From b675543b1c16cb00c8132cfee9c8d40cdae87dbf Mon Sep 17 00:00:00 2001
> From: Martin Panter <vadmium à gmail·com>
> Date: Wed, 23 Sep 2009 18:20:30 +1000
> Subject: [PATCH] =?UTF-8?q?Do=20not=20use=20interactive=20mode=20with=20?=
>  =?UTF-8?q?=E2=80=9Cquilt=20push=20-f=E2=80=9D?=
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Now the “patch -f” option is always used.
> ---
>  quilt/push.in | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/quilt/push.in b/quilt/push.in
> index 36e4664..ab8a7dd 100644
> --- a/quilt/push.in
> +++ b/quilt/push.in
> @@ -36,8 +36,7 @@ be used.
> 
>  -q Quiet operation.
> 
> --f Force apply, even if the patch has rejects. Unless in quiet mode,
> - apply the patch interactively: the patch utility may ask questions.
> +-f Force apply, even if the patch has rejects.
> 
>  -v Verbose operation.
> 
> @@ -115,19 +114,19 @@ apply_patch()
>   | patch $QUILT_PATCH_OPTS $(push_patch_args $patch) \
>   --backup --prefix="$QUILT_PC/$patch/" \
>   $no_reject_files \
> - -E $silent $force_apply 2>&1
> + -E $silent -f 2>&1
>   elif [ "${patch_file:(-4)}" = ".bz2" ]
>   then
>   bzip2 -cd $patch_file \
>   | patch $QUILT_PATCH_OPTS $(push_patch_args $patch) \
>   --backup --prefix="$QUILT_PC/$patch/" \
>   $no_reject_files \
> - -E $silent $force_apply 2>&1
> + -E $silent -f 2>&1
>   else
>   patch $QUILT_PATCH_OPTS $(push_patch_args $patch) \
>        --backup --prefix="$QUILT_PC/$patch/" \
>        $no_reject_files \
> -      -E $silent $force_apply -i $patch_file 2>&1
> +      -E $silent -f -i $patch_file 2>&1
>   fi
>  }
> 
> @@ -337,7 +336,6 @@ stop_at_patch=$(find_unapplied_patch
> "$stop_at_patch") || exit 1
> 
>  [ -n "$opt_quiet" ] && silent=-s
>  [ -z "$opt_verbose" ] && silent_unless_verbose=-s
> -[ -z "$opt_force" -o -n "$opt_quiet" ] && force_apply=-f
>  [ -n "$opt_force" ] && opt_leave_rejects=1
> 
>  top=$(top_patch)

Unfortunately, this patch no longer applies. The code you're touching
was heavily modified 5 years ago:
http://git.savannah.gnu.org/cgit/quilt.git/commit/?id=031ed72041ce45e2e63b870644b2dfa9e084a15b

Maybe you should consider rebasing your version of quilt on v0.63 or
even the master branch ;-)

Applying something like your patch would mean that there no longer is a
way to apply patches interactively. But well, as you demonstrated, there
hasn't been a way to actually do that since January 2005 and I can't
remember hearing any complaint about that, so I suppose this is
acceptable.

If not, we could always try to resurrect option --interactive which was
removed long ago as well:
http://git.savannah.gnu.org/cgit/quilt.git/commit/?id=31ebe844e578b8b2bec1c9f1ef94bc0e807c6335
but that doesn't look trivial at all.

>>    2) could not use colors and supress patch messages unless -q
>>       is specified (which would be a little weird since I believe
>>       the coloring would be more useful when you're not using -q)

That solution sounds too complex and confusing for the small benefit.

>>    3) just not have coloring in quilt push at all

That doesn't completely solve the problem, does it? The output of the
patch command will still be piped to cleanup_patch_output(), causing it
to switch to non-interactive mode.

Unless there is some bash magic beyond my knowledge, I think that the
only way to get both coloring and interactive mode is to add an option
to GNU patch itself, to have it stay interactive even when stdout is
piped (pretty much like quilt's --color=always.)

For now I would go with option #1, for the reason that it's the most
simple one and it sticks to (and finally documents) the way quilt has
worked for the past 9 years. Anyone who needs more will have to come up
with the code required to make it fly.

Martin, Aristeu, can any of you please submit a patch implementing
option #1 that properly applies on top of the most recent version of
quilt? Thanks.

-- 
Jean Delvare
SUSE L3 Support




reply via email to

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