Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 835964

Summary: sys-apps/portage: support git binary diffs as patches
Product: Gentoo Linux Reporter: Kobboi <gentoo>
Component: Current packagesAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: asturm, flow, gentoo, main.haarp, matoro_bugzilla_gentoo, pms
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 837176    

Description Kobboi 2022-03-24 22:27:10 UTC
(I am running current 9999, latest non-live is 3.0.30-r1)

I was trying to patch gtk+:3 with https://gitlab.gnome.org/GNOME/gtk/-/commit/5a0ffbbb4568e39bdf26006e1bf18c1c1d0d597a which deals with binary files.

The patch invocation complains that

"File gtk/icons/16x16/actions/application-exit.png: git binary diffs are not supported." (etc...)

Request is to have portage use "git apply" in such cases (when installed, and suggest installation otherwises).

Reproducible: Always
Comment 1 dwfreed 2022-03-25 00:26:23 UTC
PMS specifies the use of patch, so this is a PMS bug, not a portage one.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-25 00:38:29 UTC
(In reply to dwfreed from comment #1)
> PMS specifies the use of patch, so this is a PMS bug, not a portage one.

It's not realistic for us to do that in PMS imo but completely reasonable to consider it for userpatches. Possibly confusing but still.
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-03-25 01:11:40 UTC
12.1.1 of PMS says, "gnu-patch patch must be available, and must support all inputs valid for GNU patch, version as listed in table 12.1."

So, doesn't GNU patch support binary diffs?

https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-12700012.3.7 specifies some invocations, but that would seem to disallow `--binary`.
Comment 4 Arfrever Frehtes Taifersar Arahesis 2022-03-25 07:02:11 UTC
https://savannah.gnu.org/bugs/?57434


PMS for eapply_user() says:
"Takes no arguments. Package managers supporting it apply user-provided patches to the source tree in the current working directory. Exact behaviour is implementation defined and beyond the scope of this specification. Package managers not supporting it must implement the command as a no-op. ..."

So it would allow for Portage implementation of eapply_user() to use `git apply` instead of GNU patch...
Comment 5 Ulrich Müller gentoo-dev 2022-03-25 07:13:32 UTC
(In reply to John Helmert III from comment #3)
> 12.1.1 of PMS says, "gnu-patch patch must be available, and must support all
> inputs valid for GNU patch, version as listed in table 12.1."
> 
> So, doesn't GNU patch support binary diffs?
> 
> https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-12700012.3.7 specifies some
> invocations, but that would seem to disallow `--binary`.

PMS wouldn't forbid it, but GNU patch doesn't support binary patches. It has a --binary option, but the only thing it does is to disable the CRLF/LF line ending heuristic. In other words, GNU patch cannot apply a diff generated by "git diff --binary", so eapply (and eapply_user) cannot do that either.


(In reply to dwfreed from comment #1)
> PMS specifies the use of patch, so this is a PMS bug, not a portage one.

So what should it specify instead? Support any binary diff format that is out there? bsdiff, rdiff, xdelta3, git diff (which are all incompatible with each other)?

Also, how would you do "git apply" in an unpacked ${S} which is normally not a git repository?
Comment 6 Arfrever Frehtes Taifersar Arahesis 2022-03-25 07:22:05 UTC
`git apply` works in directory located outside any git repository.
Comment 7 Ulrich Müller gentoo-dev 2022-03-25 08:27:37 UTC
Instead of adding our own distro specific code, how about adding support to GNU patch, which would help everyone? Looks like upstream wouldn't refuse it ("feel free to send code"):
https://lists.gnu.org/archive/html/bug-patch/2009-11/msg00001.html

Detection for git binary patches is already there:
https://git.savannah.gnu.org/cgit/patch.git/tree/src/pch.c#n696
Comment 8 Andreas K. Hüttel archtester gentoo-dev 2022-04-09 17:37:36 UTC
(In reply to Ulrich Müller from comment #7)
> Instead of adding our own distro specific code, how about adding support to
> GNU patch, which would help everyone? Looks like upstream wouldn't refuse it
> ("feel free to send code"):
> https://lists.gnu.org/archive/html/bug-patch/2009-11/msg00001.html
> 
> Detection for git binary patches is already there:
> https://git.savannah.gnu.org/cgit/patch.git/tree/src/pch.c#n696

This would not only be very useful for user patches, but also for git-generated
patchsets from upstream repositories...
Comment 9 Larry the Git Cow gentoo-dev 2023-11-07 20:35:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f2add121b415ce959224ae7dc0ff71d59291656

commit 0f2add121b415ce959224ae7dc0ff71d59291656
Author:     Matoro Mahri <matoro_gentoo@matoro.tk>
AuthorDate: 2023-11-05 06:34:48 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-07 20:33:56 +0000

    dev-python/jupyter-core: add dev-python/pip test dep
    
    Bug: https://bugs.gentoo.org/835964
    Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-python/jupyter-core/jupyter-core-5.5.0.ebuild | 1 +
 1 file changed, 1 insertion(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1354d97ec3c07760e4902325b90a4ea3aca8cfa6

commit 1354d97ec3c07760e4902325b90a4ea3aca8cfa6
Author:     Matoro Mahri <matoro_gentoo@matoro.tk>
AuthorDate: 2023-11-05 05:21:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-07 20:33:56 +0000

    dev-python/meson-python: add dev-vcs/git test dep
    
    Bug: https://bugs.gentoo.org/835964
    Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-python/meson-python/meson-python-0.15.0.ebuild | 1 +
 1 file changed, 1 insertion(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc008392c7fe6e3fb641652ba4ba97e113a9db66

commit dc008392c7fe6e3fb641652ba4ba97e113a9db66
Author:     Matoro Mahri <matoro_gentoo@matoro.tk>
AuthorDate: 2023-11-05 02:43:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-07 20:33:55 +0000

    dev-util/patchelf: add patch for alpha support
    
    See: https://github.com/NixOS/patchelf/pull/529
    Bug: https://bugs.gentoo.org/835964
    Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../patchelf/files/patchelf-0.18.0-alpha.patch     | 29 ++++++++++++++++++++++
 dev-util/patchelf/patchelf-0.18.0.ebuild           |  1 +
 2 files changed, 30 insertions(+)