quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] [PATCH] Work around GNU patch limitation of patch format


From: Martin Quinson
Subject: Re: [Quilt-dev] [PATCH] Work around GNU patch limitation of patch format
Date: Tue, 25 Feb 2014 15:37:32 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

I don't have no way to fix patch on the huge amount of machines where
it's already installed. I agree that the problem should be reported to
patch's maintainers, but having a workaround in the meanwhile sounds
like a good idea to me.

I'm not wearing my debian hat here, since this issue is easier to
solve in Debian that in the general case. My personal opinion is that
quilt as a project should be portable to as much systems as possible.

Mt 

On Tue, Feb 25, 2014 at 03:19:16PM +0100, Andreas Grünbacher wrote:
> Please no, let's fix patch instead.
> Am 25.02.2014 14:24 schrieb "Jean Delvare" <address@hidden>:
> 
> > GNU patch is unable to deal with patch headers without timestamps if
> > a file name includes a space. Quilt currently generates such patches
> > if $QUILT_NO_DIFF_TIMESTAMPS is defined.
> >
> > In order to work around this limitation and always generate patches
> > that GNU patch will be able to apply, add a tab and a dash after the
> > file name in the patch header if $QUILT_NO_DIFF_TIMESTAMPS is set and
> > the file name contains a space.
> >
> > Originally I tried adding just a tab, and GNU patch was fine with
> > that, however the tailing tab was removed by "quilt refresh
> > --strip-trailing-whitespace" which many users have as a default
> > option. So I added a dash after the tab to protect it. I suppose it
> > could have been any other character, but that one worked. If you think
> > something else should be used instead, just let me know.
> > ---
> >  quilt/scripts/patchfns.in    |    8 ++++++++
> >  test/space-in-filenames.test |   41
> > ++++++++++++++++++++++++++++++-----------
> >  2 files changed, 38 insertions(+), 11 deletions(-)
> >
> > --- quilt.orig/test/space-in-filenames.test     2014-02-24
> > 23:13:28.466215202 +0100
> > +++ quilt/test/space-in-filenames.test  2014-02-24 23:34:30.627834687 +0100
> > @@ -44,13 +44,13 @@ $ quilt diff -p ab
> >  > Index: b/a: b [c]
> >  > ===================================================================
> >  > --- /dev/null
> > -> +++ b/a: b [c]
> > +> +++ b/a: b [c]       -
> >  > @@ -0,0 +1 @@
> >  > +new line
> >  > Index: b/foo bar
> >  > ===================================================================
> > -> --- a/foo bar
> > -> +++ b/foo bar
> > +> --- a/foo bar        -
> > +> +++ b/foo bar        -
> >  > @@ -1 +1 @@
> >  > -foo
> >  > +bar
> > @@ -61,13 +61,13 @@ $ cat patches/test.diff
> >  > Index: b/a: b [c]
> >  > ===================================================================
> >  > --- /dev/null
> > -> +++ b/a: b [c]
> > +> +++ b/a: b [c]       -
> >  > @@ -0,0 +1 @@
> >  > +new line
> >  > Index: b/foo bar
> >  > ===================================================================
> > -> --- a/foo bar
> > -> +++ b/foo bar
> > +> --- a/foo bar        -
> > +> +++ b/foo bar        -
> >  > @@ -1 +1 @@
> >  > -foo
> >  > +bar
> > @@ -78,13 +78,13 @@ $ cat patches/test.diff
> >  > Index: b/a: b [c]
> >  > ===================================================================
> >  > --- /dev/null
> > -> +++ b/a: b [c]
> > +> +++ b/a: b [c]       -
> >  > @@ -0,0 +1 @@
> >  > +new line
> >  > Index: b/foo bar
> >  > ===================================================================
> > -> --- a/foo bar
> > -> +++ b/foo bar
> > +> --- a/foo bar        -
> > +> +++ b/foo bar        -
> >  > @@ -1 +1 @@
> >  > -foo
> >  > +bar
> > @@ -96,15 +96,34 @@ $ quilt grep new
> >  $ quilt grep " "
> >  > a: b [c]:new line
> >
> > +$ quilt pop -q
> > +> Removing patch patches/test.diff
> > +> No patches applied
> > +
> > +$ quilt patches foo
> > +$ quilt patches "foo bar"
> > +> patches/test.diff
> > +$ quilt patches bar
> > +$ quilt patches "foo bar baz"
> > +$ quilt patches 'a: b [c]'
> > +> patches/test.diff
> > +$ quilt patches a
> > +$ quilt patches b
> > +$ quilt patches 'a: b c'
> > +$ quilt patches "foo bar" 'a: b [c]'
> > +> patches/test.diff
> > +
> > +$ quilt push -q
> > +> Applying patch patches/test.diff
> > +> Now at patch patches/test.diff
> > +
> >  $ quilt remove "a: b [c]"
> >  > File a: b [c] removed from patch patches/test.diff
> >
> >  $ quilt files
> > -> foo
> >  > foo bar
> >
> >  $ quilt remove "foo bar"
> >  > File foo bar removed from patch patches/test.diff
> >
> >  $ quilt files
> > -> foo
> > --- quilt.orig/quilt/scripts/patchfns.in        2014-02-24
> > 23:11:58.876431248 +0100
> > +++ quilt/quilt/scripts/patchfns.in     2014-02-24 23:38:02.564189493
> > +0100
> > @@ -731,6 +731,14 @@ diff_file()
> >                 || new_date=$'\t'"1970-01-01 00:00:00.000000000 +0000"
> >         fi
> >
> > +       # Workaround for GNU patch which can't cope with no timestamps and
> > +       # spaces in file names at the same time
> > +       if [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ]
> > +       then
> > +               [[ $old_hdr == *\ * ]] && old_date=$'\t'-
> > +               [[ $new_hdr == *\ * ]] && new_date=$'\t'-
> > +       fi
> > +
> >         diff $QUILT_DIFF_OPTS \
> >              --label "$old_hdr$old_date" --label "$new_hdr$new_date" \
> >              "$old_file" "$new_file" \
> >
> >
> > --
> > Jean Delvare
> > Suse L3 Support
> >
> > _______________________________________________
> > Quilt-dev mailing list
> > address@hidden
> > https://lists.nongnu.org/mailman/listinfo/quilt-dev
> >

> _______________________________________________
> Quilt-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/quilt-dev


-- 
If the automobile had followed the same development cycle as the computer, a
Rolls-Royce today would cost $100, get a million miles to the gallon, and
explode once every few weeks, killing everyone inside.

Attachment: signature.asc
Description: Digital signature


reply via email to

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