NetBSD Problem Report #53920

From www@NetBSD.org  Tue Jan 29 00:11:33 2019
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D646B7A177
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 29 Jan 2019 00:11:33 +0000 (UTC)
Message-Id: <20190129001132.BDDCC7A1CB@mollari.NetBSD.org>
Date: Tue, 29 Jan 2019 00:11:32 +0000 (UTC)
From: bapabooiee@gmail.com
Reply-To: bapabooiee@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/patch: pkgsrc patches fail to apply on macOS due to ${PATCH} not being defined
X-Send-Pr-Version: www-1.0

>Number:         53920
>Category:       pkg
>Synopsis:       devel/patch: pkgsrc patches fail to apply on macOS due to ${PATCH} not being defined
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 29 00:15:00 +0000 2019
>Closed-Date:    Tue Jan 29 22:45:39 +0000 2019
>Last-Modified:  Tue Jan 29 22:50:00 +0000 2019
>Originator:     Dean Matzkov
>Release:        pkgsrc-2018Q4
>Organization:
>Environment:
>Description:
When using pkgsrc-2018Q4 on the latest version of macOS, the package ``devel/patch`` fails to build due to ${PATCH} being undefined, and thus causing $pkgsrc/mk/patch/patch.nk to fail.

No other package I've tried to build has failed to have its pkgsrc patches apply, so I can only guess is that, for whatever reason, the package name being called ``patch`` might have have something to do with it.

Here's the output from running ``bmake patch`` in ``devel/patch``:

---SNIP---
$ bmake patch

=> Bootstrap dependency digest>=20010302: found digest-20180917
===> Patching for patch-2.7.6nb1
=> Applying pkgsrc patches for patch-2.7.6nb1
/bin/sh: -d: command not found
Patch /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-src_pch.c failed
/bin/sh: -d: command not found
Patch /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_Makefile.in failed
/bin/sh: -d: command not found
Patch /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_ed-style failed
ERROR: Patching failed due to modified or broken patch file(s):
ERROR:  /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-src_pch.c
ERROR:  /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_Makefile.in
ERROR:  /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_ed-style
*** Error code 1

Stop.
bmake[1]: stopped in /Volumes/Stuff/pkgsrc-2018Q4/devel/patch
*** Error code 1

Stop.
bmake: stopped in /Volumes/Stuff/pkgsrc-2018Q4/devel/patch
---/SNIP---


I managed to get it to patch and build after making a quick and dirty edit of this line in ``do-pkgsrc-patch`` in ``$pkgsrc/mk/patch/patch.mk``, which'd help confirm it might indeed be caused by ${PATCH} being undefined:

        if ${PATCH} $$fuzz_flags ${PATCH_ARGS} < $$i; then  \

to -->

        if patch $$fuzz_flags ${PATCH_ARGS} < $$i; then  \



My mk.conf is bog-standard, with nothing to report aside from having my prefix being setup with ``--unprivileged``.
>How-To-Repeat:
1. Make sure you have the latest version of macOS.
2. cd ${pkgsrc_2018_Q4}/devel/patch
3. bmake
>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: leot@NetBSD.org
State-Changed-When: Tue, 29 Jan 2019 09:44:48 +0000
State-Changed-Why:
Candidate patch shared, feedback requested.


From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53920: devel/patch: pkgsrc patches fail to apply on macOS due to ${PATCH} not being defined
Date: Tue, 29 Jan 2019 10:44:08 +0100

 Hello Dean,

 bapabooiee@gmail.com writes:
 > >Number:         53920
 > >Category:       pkg
 > >Synopsis:       devel/patch: pkgsrc patches fail to apply on macOS due to ${PATCH} not being defined
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       medium
 > >Responsible:    pkg-manager
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Tue Jan 29 00:15:00 +0000 2019
 > >Originator:     Dean Matzkov
 > >Release:        pkgsrc-2018Q4
 > >Organization:
 > >Environment:
 > >Description:
 > When using pkgsrc-2018Q4 on the latest version of macOS, the package ``devel/patch`` fails to build due to ${PATCH} being undefined, and thus causing $pkgsrc/mk/patch/patch.nk to fail.
 >
 > No other package I've tried to build has failed to have its pkgsrc patches apply, so I can only guess is that, for whatever reason, the package name being called ``patch`` might have have something to do with it.
 >
 > Here's the output from running ``bmake patch`` in ``devel/patch``:
 >
 > ---SNIP---
 > $ bmake patch
 >
 > => Bootstrap dependency digest>=20010302: found digest-20180917
 > ===> Patching for patch-2.7.6nb1
 > => Applying pkgsrc patches for patch-2.7.6nb1
 > /bin/sh: -d: command not found
 > Patch /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-src_pch.c failed
 > /bin/sh: -d: command not found
 > Patch /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_Makefile.in failed
 > /bin/sh: -d: command not found
 > Patch /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_ed-style failed
 > ERROR: Patching failed due to modified or broken patch file(s):
 > ERROR:  /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-src_pch.c
 > ERROR:  /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_Makefile.in
 > ERROR:  /Volumes/Stuff/pkgsrc-2018Q4/devel/patch/patches/patch-tests_ed-style
 > *** Error code 1
 >
 > Stop.
 > bmake[1]: stopped in /Volumes/Stuff/pkgsrc-2018Q4/devel/patch
 > *** Error code 1
 >
 > Stop.
 > bmake: stopped in /Volumes/Stuff/pkgsrc-2018Q4/devel/patch
 > ---/SNIP---
 >
 >
 > I managed to get it to patch and build after making a quick and dirty edit of this line in ``do-pkgsrc-patch`` in ``$pkgsrc/mk/patch/patch.mk``, which'd help confirm it might indeed be caused by ${PATCH} being undefined:
 >
 >         if ${PATCH} $$fuzz_flags ${PATCH_ARGS} < $$i; then  \
 >
 > to -->
 >
 >         if patch $$fuzz_flags ${PATCH_ARGS} < $$i; then  \
 >
 >
 >
 > My mk.conf is bog-standard, with nothing to report aside from having my prefix being setup with ``--unprivileged``.
 > [...]

 I think that this is due mk/tools/replace.mk:642 check that define
 TOOLS_IGNORE.patch when the PKGPATH is devel/patch (instead of
 devel/nbpatch).

 Can you please try the attached patch and let us know if it fixes
 the problem?


 Thank you!


 -------------------------8<-----------------8<-------------------------
 mk/tools/replace.mk: Update the check to devel/nbpatch

 The check to avoid possible dependency loop was not updated to
 check devel/nbpatch (instead of devel/patch).

 Should fix PR pkg/53920.

 Index: tools/replace.mk
 ===================================================================
 RCS file: /cvsroot/pkgsrc/mk/tools/replace.mk,v
 retrieving revision 1.285
 diff -u -p -r1.285 replace.mk
 --- tools/replace.mk	17 Oct 2018 08:22:19 -0000	1.285
 +++ tools/replace.mk	29 Jan 2019 09:38:43 -0000
 @@ -639,7 +639,7 @@ TOOLS_PATH.openssl=		${LOCALBASE}/bin/op
  .endif

  .if !defined(TOOLS_IGNORE.patch) && !empty(_USE_TOOLS:Mpatch)
 -.  if !empty(PKGPATH:Mdevel/patch)
 +.  if !empty(PKGPATH:Mdevel/nbpatch)
  MAKEFLAGS+=			TOOLS_IGNORE.patch=
  .  elif !empty(_TOOLS_USE_PKGSRC.patch:M[yY][eE][sS])
  TOOLS_DEPENDS.patch?=		nbpatch-[0-9]*:../../devel/nbpatch

From: "Dean M." <bapabooiee@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/53920: devel/patch: pkgsrc patches fail to apply on macOS due
 to ${PATCH} not being defined
Date: Tue, 29 Jan 2019 15:05:56 -0700

 Hi. I've tried the patch, and it has indeed fixed the problem, and
 devel/patch now patches successfully on macOS.

 Thanks!

State-Changed-From-To: feedback->closed
State-Changed-By: leot@NetBSD.org
State-Changed-When: Tue, 29 Jan 2019 22:45:39 +0000
State-Changed-Why:
Patch committed, thank you for the PR and for the feedback!


From: "Leonardo Taccari" <leot@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53920 CVS commit: pkgsrc/mk/tools
Date: Tue, 29 Jan 2019 22:41:00 +0000

 Module Name:	pkgsrc
 Committed By:	leot
 Date:		Tue Jan 29 22:41:00 UTC 2019

 Modified Files:
 	pkgsrc/mk/tools: replace.mk

 Log Message:
 mk/tools/replace.mk: Update the check to devel/nbpatch

 The check to avoid possible dependency loop was not updated to
 check devel/nbpatch (instead of devel/patch).

 Fix PR pkg/53920 reported by Dean Matzkov.


 To generate a diff of this commit:
 cvs rdiff -u -r1.285 -r1.286 pkgsrc/mk/tools/replace.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.