Bug 259891 - net-mgmt/smokeping patch fails when upgrading from 2.7.3_2 to 2.8.2
Summary: net-mgmt/smokeping patch fails when upgrading from 2.7.3_2 to 2.8.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Rodrigo Osorio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-17 04:31 UTC by Shaun Cummiskey
Modified: 2021-11-19 15:08 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (rodrigo)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shaun Cummiskey 2021-11-17 04:31:44 UTC
Overview:

When attempting to upgrade from smokeping-2.7.3_2 to smokeping-2.8.2, the "patch-bin_smokeping" patch fails to apply and the build fails. 

Steps to Reproduce:

cd /usr/ports/net-mgmt/smokeping
make

A prompt appears for "File to patch:" and waits for input. I'm not sure what it's asking for, so I hit Enter, then Enter again to confirm skipping the patch.

Actual Results:

[root@host /usr/ports/net-mgmt/smokeping]# make
===>  License GPLv2 accepted by the user
===>   smokeping-2.8.2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by smokeping-2.8.2 for building
===>  Extracting for smokeping-2.8.2
=> SHA256 Checksum OK for oetiker-SmokePing-2.8.2_GH0.tar.gz.
cd /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/lib ; /bin/rm -f BER.pm SNMP_util.pm SNMP_Session.pm
===>  Patching for smokeping-2.8.2
===>  Applying FreeBSD patches for smokeping-2.8.2 from /usr/ports/net-mgmt/smokeping/files
File to patch:
No file found--skip this patch? [y]
1 out of 1 hunks ignored--saving rejects to Oops.rej
===>  FAILED Applying FreeBSD patch-bin_smokeping
===> Cleanly applied FreeBSD patch(es)  patch-Makefile.am
===> FAILED to apply cleanly FreeBSD patch(es)  patch-bin_smokeping
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/net-mgmt/smokeping
*** Error code 1

Stop.
make: stopped in /usr/ports/net-mgmt/smokeping

[root@host /usr/ports/net-mgmt/smokeping]# cat work/SmokePing-2.8.2/Oops.rej
@@ -4,13 +4,12 @@
 use strict;
 use warnings;

-use FindBin;
 use lib (split /:/, q{}); # PERL5LIB
-use lib "$FindBin::RealBin/../lib";use lib "$FindBin::RealBin/../thirdparty/lib/perl5"; # LIBDIR
+use lib "/usr/local/smokeping/lib";

 use Smokeping;

-Smokeping::main("$FindBin::RealBin/../etc/config");
+Smokeping::main("/usr/local/etc/smokeping/config");

 =head1 NAME


Expected Results:

The patch applies and the build completes successfully

Build Date & Hardware:

FreeBSD 12.2-RELEASE-p11 #8 6be068e8574(releng/12.2): Thu Nov  4 15:21:58 CDT 2021

Additional Information:

N/A
Comment 1 Rodrigo Osorio freebsd_committer freebsd_triage 2021-11-17 14:47:21 UTC
Hi Shaun,

That's strange, I didn't find such difficulty
using poudriere[1] for FreebSD 12.2 arm64.

Are you using any specific or custom environment
which requires to build in the target ?

Cheers,
-- rodrigo

[1] https://docs.freebsd.org/en/books/handbook/ports/#ports-poudriere
Comment 2 Shaun Cummiskey 2021-11-18 06:00:34 UTC
Hi Rodrigo,

I don't think I have anything too unusual in my build environment (although it's possible!). After looking around a bit, I noticed that several of the patch files contain hardcoded paths with a /wrkdirs mount point, e.g. from files/patch-bin_smokeping:

--- /wrkdirs/usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/bin/smokeping.orig  2021-11-14 17:05:16.825182000 +0000
+++ /wrkdirs/usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/bin/smokeping       2021-11-14 17:06:25.201316000 +0000

If I strip "/wrkdirs/usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/" out of the patch files, leaving only the local relative paths, the patches all apply successfully, and the build completes successfully:

[root@host /usr/ports/net-mgmt/smokeping]# find files/ -name *patch* | xargs sed -i '' 's_/wrkdirs/usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/__g'

[root@host /usr/ports/net-mgmt/smokeping]# make
===>  License GPLv2 accepted by the user
===>   smokeping-2.8.2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by smokeping-2.8.2 for building
===>  Extracting for smokeping-2.8.2
=> SHA256 Checksum OK for oetiker-SmokePing-2.8.2_GH0.tar.gz.
cd /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/lib ; /bin/rm -f BER.pm SNMP_util.pm SNMP_Session.pm
===>  Patching for smokeping-2.8.2
===>  Applying FreeBSD patches for smokeping-2.8.2 from /usr/ports/net-mgmt/smokeping/files
/usr/bin/sed -i.bak -e s!%%USERS%%!smokeping!g -e s!%%GROUPS%%!smokeping!g -e s!%%PREFIX%%!/usr/local!g -e s!%%LOCALBASE%%!/usr/local!g -e s!%%DATADIR%%!/usr/local/share/smokeping!g -e s!%%DOCSDIR%%!/usr/local/share/doc/smokeping!g -e s!%%EXAMPLESDIR%%!/usr/local/share/examples/smokeping!g -e s!%%WWWDIR%%!/usr/local/www/smokeping!g -e s!%%ETCDIR%%!/usr/local/etc/smokeping!g  /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/doc/Makefile.am  /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/bin/smokeping  /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/bin/smokeping_cgi  /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/bin/tSmoke
/bin/mv /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/etc/config.dist.in /usr/ports/net-mgmt/smokeping/work/SmokePing-2.8.2/etc/config.sample.in
===>   smokeping-2.8.2 depends on package: p5-CGI-Fast>=0 - found
[...snip successful build output...]

Additionally, the patch at files/patch-bin_smokeping__cgi applies this change:

    @@ -17,7 +16,7 @@

     use CGI::Fast;

    -my $cfg = (shift @ARGV) || "$FindBin::Bin/../etc/config";
    +My $cfg = (shift @ARGV) || "/usr/local/etc/smokeping/config";

The installed version of perl5-5.32.1_1 on this system doesn't like "My $cfg" with a capital M, and choked with this error:

[Wed Nov 17 23:39:53 2021] smokeping_cgi: Global symbol "$cfg" requires explicit package name (did you forget to declare "my $cfg"?) at /usr/local/bin/smokeping_cgi line 19.

I changed the 'm' back to lowercase and the FCGI runs properly.

Hope this is useful!

Shaun
Comment 3 Rodrigo Osorio freebsd_committer freebsd_triage 2021-11-19 15:01:38 UTC
You're absolutely right. I will it immediately.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-11-19 15:01:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d97161a97818bef47e66ab362f444cd1201c87fd

commit d97161a97818bef47e66ab362f444cd1201c87fd
Author:     Rodrigo Osorio <rodrigo@FreeBSD.org>
AuthorDate: 2021-11-19 14:34:04 +0000
Commit:     Rodrigo Osorio <rodrigo@FreeBSD.org>
CommitDate: 2021-11-19 14:51:11 +0000

    net-mgmt/smokeping: Fix patches filepath

    PR:             259891
    Reported by:    shaun <freebsd@shaunc.com>

 net-mgmt/smokeping/Makefile                       | 1 +
 net-mgmt/smokeping/files/patch-bin_smokeping      | 4 ++--
 net-mgmt/smokeping/files/patch-bin_smokeping__cgi | 4 ++--
 net-mgmt/smokeping/files/patch-bin_tSmoke         | 4 ++--
 net-mgmt/smokeping/files/patch-lib_Smokeping.pm   | 4 ++--
 security/clamav/Makefile                          | 1 +
 6 files changed, 10 insertions(+), 8 deletions(-)
Comment 5 Rodrigo Osorio freebsd_committer freebsd_triage 2021-11-19 15:08:07 UTC
Committed, thanks