From owner-freebsd-questions@freebsd.org Fri Aug 20 09:17:08 2021 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 DD69D65C9AE for ; Fri, 20 Aug 2021 09:17:08 +0000 (UTC) (envelope-from ole@free.de) Received: from smtp.free.de (smtp.free.de [91.204.6.103]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grbcg3JQXz55m2 for ; Fri, 20 Aug 2021 09:17:07 +0000 (UTC) (envelope-from ole@free.de) Received: from lenp43s (dynamic-002-244-078-023.2.244.pool.telefonica.de [2.244.78.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.free.de (Postfix) with ESMTPSA id BE1FC139D1 for ; Fri, 20 Aug 2021 11:16:58 +0200 (CEST) Date: Fri, 20 Aug 2021 11:16:54 +0200 From: Ole To: FreeBSD Mailing List Subject: Patching a port (monit) with EXTRA_PATCHES and poudriere - fails Message-ID: <20210820111654.48c52853.ole@free.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/_+ul9Acb+gdk7npwVrCib=D"; protocol="application/pgp-signature" X-Rspamd-Queue-Id: 4Grbcg3JQXz55m2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ole@free.de designates 91.204.6.103 as permitted sender) smtp.mailfrom=ole@free.de X-Spamd-Result: default: False [-4.28 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:91.204.4.0/22]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[free.de]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.88)[-0.881]; MID_CONTAINS_FROM(1.00)[]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:31371, ipnet:91.204.4.0/22, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-questions]; RECEIVED_SPAMHAUS_PBL(0.00)[2.244.78.23:received] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 09:17:08 -0000 --Sig_/_+ul9Acb+gdk7npwVrCib=D Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello, there is a Bug in the current version of the monit port. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257941 It was already fixed in the repo. https://bitbucket.org/tildeslash/monit/commits/47e042610940624e492119a89509= 8dfbd459b8df I am building my packages with poudriere. And since I need the package strongly, i thought it would be good to learn how to patch a port with poudriere. I took my information from this sites: https://dan.langille.org/2014/06/10/freebsd-custom-port-patches-when-using-= poudriere/ https://docs.freebsd.org/en/books/porters-handbook/slow-porting/ 1. Create the patch: diff -u src/validate.c.orig src/validate.c /usr/ports/distfiles/local-patch= es/monit.patch 2. Edit make.conf: .if ${.CURDIR:M*/sysutils/monit} EXTRA_PATCHES+=3D /distfiles/local-patches/monit.patch .endif 3. remove old package find /poudriere/base/data/packages/freebsd:12:x86:64-HEAD/ -name monit\* -d= elete 4. run poudriere again. =3D=3D=3D> Patching for monit-5.28.1 =3D=3D=3D> Applying extra patch /distfiles/local-patches/monit.patch Ignoring previously applied (or reversed) patch. 2 out of 2 hunks ignored--saving rejects to src/validate.c.rej =3D=3D=3D> FAILED Applying extra patch /distfiles/local-patches/monit.patch *** Error code 1 Stop. make: stopped in /usr/ports/sysutils/monit sadly it fails applying the patch. Any idea why? The patch is below. Ole --- src/validate.c.orig 2021-08-20 10:58:45.165650000 +0200 +++ src/validate.c 2021-08-20 10:58:48.797744000 +0200 @@ -1518,17 +1518,21 @@ int errors =3D 0; /* Check the services */ for (Service_T s =3D servicelist; s && ! interrupt(); s =3D s->nex= t) { - // FIXME: The Service_Program must collect the exit value = from last run, even if the program start should be skipped in this cycle = =3D> let check program always run the test (to be refactored with new sched= uler) - if (! _doScheduledAction(s) && s->monitor && (s->type =3D= =3D Service_Program || ! _checkSkip(s))) { - _checkTimeout(s); // Can disable monitoring =3D> n= eed to check s->monitor again - if (s->monitor) { - State_Type state =3D s->check(s); - if (state !=3D State_Init && s->monitor != =3D Monitor_Not) // The monitoring can be disabled by some matching rule in= s->check so we have to check again before setting to Monitor_Yes - s->monitor =3D Monitor_Yes; - if (state =3D=3D State_Failed) - errors++; - if (s->type !=3D Service_Program) - gettimeofday(&s->collected, NULL); + if (! _doScheduledAction(s) && s->monitor) { + bool skip =3D _checkSkip(s); + // FIXME: The Service_Program must collect the exi= t value from last run, even if the program start should be skipped in this = cycle =3D> let check program always run the test (to be refactored with new= scheduler) + if (! skip || s->type =3D=3D Service_Program) { + _checkTimeout(s); // Can disable monitorin= g =3D> need to check s->monitor again + if (s->monitor) { + State_Type state =3D s->check(s); + if (state !=3D State_Init && s->mo= nitor !=3D Monitor_Not) // The monitoring can be disabled by some matching = rule in s->check so we have to check again before setting to Monitor_Yes + s->monitor =3D Monitor_Yes; + if (state =3D=3D State_Failed) + errors++; + //FIXME: the Service_Program is ex= ecuted each cycle to collect exit value ... record the last data collection= timestamp only on the real non-skip cycle + if (! skip) + gettimeofday(&s->collected= , NULL); + } } } } @@ -1920,8 +1924,6 @@ Event_post(s, Event_Status, State_Succeeded, s->ac= tion_EXEC, "program started"); s->program->started =3D now; } - // We canot set the data collection timestmap in validate(= ), as the program check calls the _checkSkip() here - gettimeofday(&s->collected, NULL); } return rv; } --Sig_/_+ul9Acb+gdk7npwVrCib=D Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE60BGd7KVfL83NXCUJZaRRqjklFAFAmEfcwYACgkQJZaRRqjk lFBdFg//fmtbK3JTqTxTB0ucI/bc50HMWbx5NjOxIJ8Z2QkCbj4Jri0+T63kf1xW IXiamBOaYbx2qD1xj6UO4PvboqGH9qci577P4zzghmVn0Cp0Tw5puZ6Y1rxhDopS Job9a0YNVwMQgdSswh1XdxNkFkVToyB6W3P/P/XJW4c88+8JjIO/B9+0mVtW+k/b xVYoeTXqPhQ0oyibRTTWWknS9KPaCjcxofX62H9qxve+totV8rtdHDv3e/DbXHOY cFucRa5qbfUj7Soj4Qb2mmP0tFfwgu3GkVco3PZaaVTJoiSmycGhqH6bB2Qk8Luk 3SWGvWSLnA6tLkDBulRjZTNe4wa84/9XMucccReq4bX704pEoBBfWOQHuMKFHhLn MvlEgQBQouUTD6c8IvQt7/5KSP4+QCs2SWXB57sF6F1YWogiWqFycAS1loFGtez0 YWvbL+HJnwiiXPISuv9jknLfL28mXEARb7/1JMx15ymqQ5aZNyE1zB1iayVDI5hK 30tHIY/puS51fDOAQwvd1IEYQInKvgc0aYSz+wF8juw5rGwlCahOZiTwk8SFN7Ek swWpwP+9VpVAjABXENN0rtfBRhoHTiDi/cn2hXrTUiKvRvlvtP6OE0zh/ihPzuId Fu1EMMd3vYKJzGwZThtiRSr80mxooVykC45BjOKt6O0iVgdePsA= =IXdY -----END PGP SIGNATURE----- --Sig_/_+ul9Acb+gdk7npwVrCib=D--