Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 913113 - Patch in /etc/portage/patches partially applied instead of fully applied
Summary: Patch in /etc/portage/patches partially applied instead of fully applied
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-27 14:33 UTC by Cyp
Modified: 2023-11-07 21:07 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
7564.diff (goes in /etc/portage/patches/net-misc/yt-dlp-2023.07.06/) (7564.diff,6.01 KB, patch)
2023-08-27 14:34 UTC, Cyp
Details | Diff
7890.diff (goes in /etc/portage/patches/net-misc/yt-dlp-2023.07.06/) (7890.diff,4.07 KB, patch)
2023-08-27 14:34 UTC, Cyp
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cyp 2023-08-27 14:33:02 UTC
Maybe I'm missing something, but putting patches in /etc/portage/patches/net-misc/yt-dlp-2023.07.06/, one of the hunks from one of the patches does not seem to get applied, even though only an probably-unrelated warning is output.

Reproducible: Always

Steps to Reproduce:
1. mkdir -p /etc/portage/patches/net-misc/yt-dlp-2023.07.06/
2. Put patches in /etc/portage/patches/net-misc/yt-dlp-2023.07.06/
3. ebuild /usr/portage/net-misc/yt-dlp/yt-dlp-2023.07.06.ebuild prepare
Actual Results:  
>>> Preparing source in /var/tmp/portage/net-misc/yt-dlp-2023.07.06/work/yt-dlp ...
 * ===============================================================================================================================================================================================================
 * Applying user patches from /etc/portage/patches ...
 * Applying 7564.diff ...
patching file yt_dlp/extractor/facebook.py
Hunk #1 succeeded at 23 with fuzz 2 (offset -1 lines).                                                                                                                                                     [ ok ]
 * Applying 7890.diff ...                                                                                                                                                                                  [ ok ]
 * User patches applied.
 * ===============================================================================================================================================================================================================

But chunk 8 in 7564.diff hasn't been applied, and grep doesn't find "short_form_video_context" anywhere in the extracted source:
@@ -497,6 +515,13 @@ def extract_relay_prefetched_data(_filter):
                 entries = []
 
                 def parse_graphql_video(video):
+                    v_id = video.get('videoId') or video.get('id') or video_id
+                    reel_info = traverse_obj(
+                        video, ('creation_story', 'short_form_video_context', 'playback_video', {dict}))
+                    if reel_info:
+                        video = video['creation_story']
+                        video['owner'] = traverse_obj(video, ('short_form_video_context', 'video_owner'))
+                        video.update(reel_info)
                     formats = []
                     q = qualities(['sd', 'hd'])
                     for key, format_id in (('playable_url', 'sd'), ('playable_url_quality_hd', 'hd'),


Expected Results:  
All hunks applied or error printed.
Comment 1 Cyp 2023-08-27 14:34:27 UTC
Created attachment 868832 [details, diff]
7564.diff (goes in /etc/portage/patches/net-misc/yt-dlp-2023.07.06/)
Comment 2 Cyp 2023-08-27 14:34:53 UTC
Created attachment 868833 [details, diff]
7890.diff (goes in /etc/portage/patches/net-misc/yt-dlp-2023.07.06/)
Comment 3 Ionen Wolkens gentoo-dev 2023-08-27 15:14:15 UTC
Haven't looked closely but maybe patch is malformed, this is reproducible without portage, e.g.

$ tar -xf /var/cache/distfiles/yt-dlp-2023.07.06.tar.gz
$ cd yt-dlp
$ patch -p1 < ~/7564.diff 
patching file yt_dlp/extractor/facebook.py
Hunk #1 succeeded at 23 with fuzz 2 (offset -1 lines).
$ grep -r short_form_video_context .
(no match)

I'd rebase it and make a clean patch using the current source, then try to apply that.

Alternatively you could use yt-dlp-9999 live ebuild if it's fixes that are already upstreamed.
Comment 4 Ionen Wolkens gentoo-dev 2023-08-27 15:35:30 UTC
(In reply to Ionen Wolkens from comment #3)
> Haven't looked closely but maybe patch is malformed [...]
Which sounds likely, instead I tried to get:

https://github.com/yt-dlp/yt-dlp/pull/7564.patch

and then
$ patch -p1 < ~/7564.patch
patching file yt_dlp/extractor/facebook.py
patching file yt_dlp/extractor/facebook.py
patching file yt_dlp/extractor/facebook.py
patching file yt_dlp/extractor/facebook.py
patching file yt_dlp/extractor/facebook.py
patching file yt_dlp/extractor/facebook.py
patching file yt_dlp/extractor/facebook.py
$ grep -r short_form_video_context .
./yt_dlp/extractor/facebook.py:                        video, ('creation_story', 'short_form_video_context', 'playback_video', {dict}))
./yt_dlp/extractor/facebook.py:                        video['owner'] = traverse_obj(video, ('short_form_video_context', 'video_owner'))
Comment 5 Cyp 2023-08-27 19:24:43 UTC
In that case, a feature request would be to print a warning/error if possible, if a patch is malformed.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-27 19:26:50 UTC
I think you probably want to file a bug upstream for patch itself.
Comment 7 Ionen Wolkens gentoo-dev 2023-08-27 19:34:09 UTC
Yeah, ultimately patch(1) did not report an error. Portage would abort if it did.