Bug#1081179: Example patch hunk from a commit message applied to package source
Simon McVittie
smcv at debian.org
Wed Sep 11 16:29:20 BST 2024
On Sun, 08 Sep 2024 at 22:23:17 +0100, Simon Tatham wrote:
> But if you look at that patch, it's in 'git format-patch' format,
> containing a few headers, a commit message, and then the actual patch.
> And the patch hunk that introduced "Some informative title" is part of
> the _commit message_: it's clear from the surrounding text that the
> commit message author intended it as an example of the kind of change
> you _could_ apply if you wanted to test the behaviour modified by the
> patch. The author even indented the entire patch hunk by 4 spaces to
> indicate extra clearly that it wasn't intended to be applied.
>
> So it surely should _not_ have been applied to the Debian source!
This seems to be because the patch series was generated with
`git format-patch` and `git apply`, but dpkg-source uses patch(1), which
has a much more "do what I mean" approach to reading patches.
In particular, it treats indented diffs as real diffs.
Ideally, `gbp pq` would somehow escape the indented diff when it
serializes the patch series into debian/patches to prevent this
misinterpretation.
Using dgit to upload would have detected this, because it validates that
what's in git matches what's in the .dsc:
gtk+3.0$ dgit --quilt=gbp push-source --dry-run
...
dgit: quilt differences: src: == orig ## gitignores: == orig ==
dgit: quilt differences: HEAD ## o+d/p HEAD == o+d/p
dgit view: creating patches-applied version using gbp pq
dgit view: created (commit id 97d5c77cbc50c059ecebc9a699f83b5475916431)
...
dpkg-source: info: local changes detected, the modified files are:
work/demos/gtk-demo/dialog.c
> I suppose this could very well be viewed as a bug in whatever thing
> underlying 'apt source' is applying the patches
dpkg-source, I think.
smcv
More information about the pkg-gnome-maintainers
mailing list