How to apply a patch to a port
freebsd at edvax.de
Tue Oct 22 05:41:26 UTC 2019
Following this thread, I think the file's content might be damaged?
Or maybe it's just the MUA which mangled the lines...
Allow me a few notes:
On Mon, 21 Oct 2019 21:57:42 -0500, Clay Daniels Jr. wrote:
> Thanks Yasuhiro. My patch file is a text file named
> patch-linuxkpi_gplv2_src_linux__page.c with this content:
> diff --git a/linuxkpi/gplv2/src/linux_page.c
That should be _one_ line:
diff --git a/linuxkpi/gplv2/src/linux_page.c b/linuxkpi/gplv2/src/linux_page.c
The common notation is:
diff --git <original-file> <revised-file>
> index e2b85c45c..060ae85ed 100644
That's, if I remember correctly, a git-specific line, but
probably it won't do any harm. For testing, you could remove
> --- a/linuxkpi/gplv2/src/linux_page.c
> +++ b/linuxkpi/gplv2/src/linux_page.c
> @@ -239,7 +239,7 @@ retry:
> page = vm_page_lookup(devobj, i);
> if (page == NULL)
> - if (vm_page_sleep_if_busy(page, "linuxkpi"))
> + if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL))
> goto retry;
> cdev_pager_free_page(devobj, page);
This looks reasonable so far. :-)
> I copied it, as root, from my thumbdrive to a /root/files directory I
> created. Then i went to the main port directory for drm-current-kmod, ran
> make patch, which did a lot of activity and created a /work/kms-drm-2d2852e
> directory, where I tried to run:
> patch -p 1 -s -i /root/files/patch-linuxkpi_gplv2_src_linux__page.c
> It said 1 of 1 hunks failed - saving rejects...
> Then I changed it to say -p 1, ran that and it asks: "File to patch:"
> I answered linux_page.c because I could not think of anything else, but the
> file was not found. There are a lot of files created by the "make patch"
> command and I'm looking through them now, though I'm not really sure what
> I'm looking for.
Then maybe I did guess right: the input patch file could
be damaged. The procedure to apply external patches is
For reference purposes:
Note that the file _name_ has to be in a specific format
(see 4.4.2. example 2), but I think the file name you
mentioned above conforms to that rule.
Oh, and there's "man 7 ports" worth having a loot at:
> Between our emails, I discovered the FreeBSD Porter's Handbook and it has a
> lot of info I need to read. Of course I want to get this one patch
> installed, but most importantly I want to know how to do it again, and
> understand what I'm doing.
For that _one_ line (!) change, you could manually edit
the one file it corresponds to, as a temporary workaround,
but of course that's not nearly what you want to achieve
in the lon run. ;-)
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions