From owner-freebsd-questions@freebsd.org Fri Aug 20 09:45:46 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 A803265D683 for ; Fri, 20 Aug 2021 09:45:46 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4GrcFj45NGz3CkW for ; Fri, 20 Aug 2021 09:45:45 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: by mail-yb1-xb2b.google.com with SMTP id r4so17761726ybp.4 for ; Fri, 20 Aug 2021 02:45:45 -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=1SGX62O88fDZDBWT5cKIH+Vx0NfR6gBPydd8J0Bhcr8=; b=Z2t73uJLoaPxZqbkVfT4uyloekjzOF3ed/lVxQQHwpwFcHv3Omm4ZHcGgaVx5huKJ3 fD5WVIy+Arl19BJ4Rta0AMSCDKURH4Oejm63uuIPFDu8+tW7yQGbs5WUaq5zxiRftCKS 6jmWjsAqYnTKwPtswjfr5avSG25Ik6Oof9cn6gEIKUTrXSCwN4VQU+EkLTicP3ahQB3u C9Ep02H5XrctI0jIPN/PJ3h8U85UrqVQLJXUo9+cxENFHFo9x3WELSzeJKEX5+ctukeE 5NHN56n4z0EECzjPN+SHOre/SYJIe02Di8PG9MX4t4HT+uHeov5mAPYDWFstBng8Yu+W Bt6w== 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=1SGX62O88fDZDBWT5cKIH+Vx0NfR6gBPydd8J0Bhcr8=; b=eAbyi2MRVfYkpVh7t+OZKk9Gx2MvazM75nuM/hv6t9+bGm81GYR3ca+xY2EStSs5hg 6zyoaK/Vk5fuWvWZFenrCI3cS3KK3iMbEpaI7y+E1c2GirG0U79619QJQsHvCsc04s3/ wgWOIoyjRGpWW471BZdZf8Ip9Fc1m6Zja1t1pbiOPOwBJA/tn9VTkF4iKqNJ3eLfYfRZ UXvlgSdMBu4VAtLPPB0vPfzciv7EjDpgiDf0y84ED/NdAtDQ85i4pfWo8xEmBCoRBIeI YMoG01M5X84Tbk9ziuIqYZrvwlkyLPNP/tc042bTA+607bKxfsb2vxOth0fZwM78iNa6 TnLg== X-Gm-Message-State: AOAM5301MmLTZUvh1J7Hm5DbvXpoUErDV2ly88ty3HKEiOUWnLEkH/3O NCBy9BFKwC1iLnkpa827dAmv6xyaPcCcTlXsw5w= X-Google-Smtp-Source: ABdhPJyCUg0GX7LqVMa8LxNiAfjHxwOjuAXpb2HkTerSaT9apfkf4WuGO+e0dS96DJdIh3OLXEpj/dsqdszK9IHsmSo= X-Received: by 2002:a25:d2c6:: with SMTP id j189mr25270829ybg.187.1629452745172; Fri, 20 Aug 2021 02:45:45 -0700 (PDT) MIME-Version: 1.0 References: <20210820111654.48c52853.ole@free.de> In-Reply-To: <20210820111654.48c52853.ole@free.de> From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= Date: Fri, 20 Aug 2021 11:41:11 +0200 Message-ID: Subject: Re: Patching a port (monit) with EXTRA_PATCHES and poudriere - fails To: Ole Cc: FreeBSD Mailing List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4GrcFj45NGz3CkW X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Z2t73uJL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of fernandoapesteguia@gmail.com designates 2607:f8b0:4864:20::b2b as permitted sender) smtp.mailfrom=fernandoapesteguia@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; 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:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b2b:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] 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:45:46 -0000 On Fri, Aug 20, 2021 at 11:17 AM Ole wrote: > > Hello, > > there is a Bug in the current version of the monit port. > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257941 > > It was already fixed in the repo. > https://bitbucket.org/tildeslash/monit/commits/47e042610940624e492119a895098dfbd459b8df > > 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-patches/monit.patch > > 2. Edit make.conf: > .if ${.CURDIR:M*/sysutils/monit} > EXTRA_PATCHES+= /distfiles/local-patches/monit.patch > .endif > > 3. remove old package > find /poudriere/base/data/packages/freebsd:12:x86:64-HEAD/ -name monit\* -delete > > 4. run poudriere again. > > ===> Patching for monit-5.28.1 > ===> 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 ^^^^^^^ It seems the whole patch was rejected. You can confirm this by looking at src/validate.c.rej Is it possible that the changes are being applied twice? > ===> 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 = 0; > /* Check the services */ > for (Service_T s = servicelist; s && ! interrupt(); s = s->next) { > - // FIXME: The Service_Program must collect the exit value from last run, even if the program start should be skipped in this cycle => let check program always run the test (to be refactored with new scheduler) > - if (! _doScheduledAction(s) && s->monitor && (s->type == Service_Program || ! _checkSkip(s))) { > - _checkTimeout(s); // Can disable monitoring => need to check s->monitor again > - if (s->monitor) { > - State_Type state = s->check(s); > - if (state != State_Init && s->monitor != 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 = Monitor_Yes; > - if (state == State_Failed) > - errors++; > - if (s->type != Service_Program) > - gettimeofday(&s->collected, NULL); > + if (! _doScheduledAction(s) && s->monitor) { > + bool skip = _checkSkip(s); > + // FIXME: The Service_Program must collect the exit value from last run, even if the program start should be skipped in this cycle => let check program always run the test (to be refactored with new scheduler) > + if (! skip || s->type == Service_Program) { > + _checkTimeout(s); // Can disable monitoring => need to check s->monitor again > + if (s->monitor) { > + State_Type state = s->check(s); > + if (state != State_Init && s->monitor != 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 = Monitor_Yes; > + if (state == State_Failed) > + errors++; > + //FIXME: the Service_Program is executed 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->action_EXEC, "program started"); > s->program->started = now; > } > - // We canot set the data collection timestmap in validate(), as the program check calls the _checkSkip() here > - gettimeofday(&s->collected, NULL); > } > return rv; > }