From owner-freebsd-questions@freebsd.org Tue Oct 22 02:57:58 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCC7516B73F for ; Tue, 22 Oct 2019 02:57:58 +0000 (UTC) (envelope-from clay.daniels.jr@gmail.com) Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xyqT67Kpz4D1Z for ; Tue, 22 Oct 2019 02:57:57 +0000 (UTC) (envelope-from clay.daniels.jr@gmail.com) Received: by mail-ua1-x932.google.com with SMTP id w7so4453668uag.4 for ; Mon, 21 Oct 2019 19:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1kV5ai/4dcxgm4sVRJsjqOtDMEL3n/XepSQt32Ms4QI=; b=GvJ+F/ZJ/0vdfni1+8hzj3bYTQ0ESCdSx/z+pWEkSOTBZNAFjfOphWHEgy7CkqLgny pQfddXibqqCg8zcW4C9l83776NLzWhWGuyg8YDZKU5g5z2WbN2Ux0sVsRti73b0MGKC7 RC0q341K8V9lAdiTGYYSk0S51EBVsHuCGKZUyfIJSHbWslgYe1/G82amhhgCQPkbObnl lub0VLy0/B8xgFFeUOiWsiyOdr2wROg6qrGs7wR44pH7fwH9vLx7Pb45O34QppTN7wVg OTiVl7gOaHyCFW+172Dc9hZZrohQC56eCvXwtvXZyAXD4WkjGLJpsy9+N1huX33Cp5yy SXrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1kV5ai/4dcxgm4sVRJsjqOtDMEL3n/XepSQt32Ms4QI=; b=Q8BDWibu06uR8vdtBmbdPNqhp1ftZKQYAyFMq76BsLR05TUJbJVb6Kd6/cI2UF6/QK pgx5lQrlhshb4a6l3UzozQmkWWrMcOuux/6n7yH1j/FKGCtlSXpeT4pmaahqYyr06VXj ob0/05KfBOUw3z3a4t2zZ8lhRqitbpd6VUF7Pb1NWB1FcJYq5sprcincBYH8NJtuTPQe qukQ56HA6fuCuCfi+fwgm9t3TyKiIBXzEOgv/4wxDnn9IQUOEev2va4gehDekDGw5EIm vxggxn8x7BXFXjTZSsZox1YLziVtLPyZyqoBAz4odxrxkMQ7P2hDSI1LnaPE6h4jwqx2 PL1A== X-Gm-Message-State: APjAAAUGq5TRAiyu7z0XtZ0cfg/hsotNv4zGCXbPq8AQx8q7bM8UhpkI KGMghEUSV24Z7ERatQ5yab2JThwxxdelEojUERvlXVVK5A== X-Google-Smtp-Source: APXvYqzYj6jdE6FnTAzSX8mFMJJqzuUYOuZr3Ukbkh/RkrZTRsb0IYwhQaEtS2GCKQmOoU9QgGaKDVmU6azLcuv+Cm4= X-Received: by 2002:ab0:59a7:: with SMTP id g36mr767264uad.54.1571713075885; Mon, 21 Oct 2019 19:57:55 -0700 (PDT) MIME-Version: 1.0 References: <20191022.053926.1076439053946694541.yasu@utahime.org> <9ac08912-0415-0830-9381-6df157fe6ab1@gmail.com> <20191022.090814.157299176887147047.yasu@utahime.org> In-Reply-To: <20191022.090814.157299176887147047.yasu@utahime.org> From: "Clay Daniels Jr." Date: Mon, 21 Oct 2019 21:57:42 -0500 Message-ID: Subject: Re: How to apply a patch to a port To: Yasuhiro KIMURA Cc: "freebsd-questions@freebsd.org" X-Rspamd-Queue-Id: 46xyqT67Kpz4D1Z X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=GvJ+F/ZJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of claydanielsjr@gmail.com designates 2607:f8b0:4864:20::932 as permitted sender) smtp.mailfrom=claydanielsjr@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; URI_COUNT_ODD(1.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.74), ipnet: 2607:f8b0::/32(-2.43), asn: 15169(-2.07), country: US(-0.05)]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2.3.9.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 02:57:58 -0000 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 b/linuxkpi/gplv2/src/linux_page.c index e2b85c45c..060ae85ed 100644 --- 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) continue; - 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); } 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. 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. By Friday there will be another snapshot, and this patch will not be necessary I hope. For now I will retire to my reading the Porter's Handbook. Thanks so much, Yasuhiro. Clay On Mon, Oct 21, 2019 at 7:09 PM Yasuhiro KIMURA wrote: > From: Clay Daniels > Subject: Re: How to apply a patch to a port > Date: Mon, 21 Oct 2019 18:21:19 -0500 > > >> 1. cd /usr/ports/graphics/drm-current-kmod > > OK, but should my patch file be here, or do I need to make a /files > > subdirectory and put it there? > > Patch file should be put somewhere out of ports tree. And you don't > have to create files subdirectory because it will be created at step 6. > > >> 2. make patch > >> 3. cd work/kms-drm-2d2852e > >> 4. patch -p 0 -s -i > >> /path/to/patch/patch-linuxkpi_gplv2_src_linux__page.c > >> (You may need to change '-p 0' to '-p 1' or '-p 2' or ...) > >> 5. cd ../.. > >> 6. make makepatch > >> 7. make clean > >> > >> Then new patch file is created under files subdirectory. > > > > Then change back to main port directory & run make install (clean) for > > the whole port, right? > > Yes. > > And in fact, if you succeeded to apply patch with '-p 0' in step 4, > then you don't have to follow above procedure. Instead take following > steps. > > 1. cd /usr/ports/graphics/drm-current-kmod > 2'. mkdir files > 3'. cp /path/to/patch/patch-linuxkpi_gplv2_src_linux__page.c files > > Then 'make install' should work. > > The reason that I recommended first procedure is that there are some > different patch formats. If the patch is created by 'diff' or 'svn > diff' then it can be applied with 'patch -p 0'. So you can use second > procedure. But if it is created by 'git diff' or 'git format-patch' > then it need to be applied with 'patch -p 1'. In this case you can't > use second one. I don't know how your patch is created. So I > recommended one that can be used everytime. > > --- > Yasuhiro KIMURA > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >