Subject: bug#72235: closed (Re: [bug-diffutils] bug#72235: build failure on FreeBSD and NetBSD)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 22 Jul 2024 15:29:02 +0000

Your bug report

#72235: build failure on FreeBSD and NetBSD

which was filed against the diffutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72235: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72235
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug-diffutils] bug#72235: build failure on FreeBSD and NetBSD
From: Jim Meyering <[email-masked]>
To: Bruno Haible <[email-masked]>
Cc: [email-masked]
Date: Mon, 22 Jul 2024 08:28:34 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On Sun, Jul 21, 2024 at 11:14 AM Bruno Haible <[email-masked]> wrote:
> On FreeBSD 14.0 and NetBSD 10.0, a build fails after sources have been modified:
>
> $ touch src/cmp.c
> $ ./configure
> $ make V=1
> ...
> base=`expr cmp.1 : '\(.*\).1'`                           && test -x ../src/$base                                         && (echo '[NAME]'                                               && sed 's@/\* *@@; s/-/\\-/;s/^GNU //; q' ../src/$base.c)       | PATH="../src:$PATH"                   ./help2man -i - -i ./$base.x            -S 'diffutils 2024-05-21' $base > cmp.1-t && mv cmp.1-t cmp.1
> /bin/sh: ./help2man: not found
> *** Error code 127
>
> Stop.
> make[1]: stopped in /home/bruno/diffutils-2024-07-21/man
> *** Error code 1
>
>
> The reason is that on FreeBSD, perl is at /usr/local/bin/perl, not /usr/bin/perl.
> Likewise, on NetBSD, perl is at /usr/pkg/bin/perl, not /usr/bin/perl.
> And likewise, on Guix, the only binary in /usr/bin is /usr/bin/env.
>
> The attached patch fixes it. "use warnings" instead of option '-w' is
> recommended per https://stackoverflow.com/questions/12554179/ ; it avoids
> the use of /usr/bin/env's option '-S' which is unportable (not specified
> by POSIX).

Thanks. I have pushed that.

Subject: build failure on FreeBSD and NetBSD
From: Bruno Haible <[email-masked]>
To: [email-masked]
Date: Sun, 21 Jul 2024 20:13:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On FreeBSD 14.0 and NetBSD 10.0, a build fails after sources have been modified:

$ touch src/cmp.c
$ ./configure
$ make V=1
...
base=`expr cmp.1 : '\(.*\).1'`				 && test -x ../src/$base					 && (echo '[NAME]'						 && sed 's@/\* *@@; s/-/\\-/;s/^GNU //; q' ../src/$base.c)	 | PATH="../src:$PATH"			 ./help2man -i - -i ./$base.x		 -S 'diffutils 2024-05-21' $base > cmp.1-t && mv cmp.1-t cmp.1
/bin/sh: ./help2man: not found
*** Error code 127

Stop.
make[1]: stopped in /home/bruno/diffutils-2024-07-21/man
*** Error code 1

The reason is that on FreeBSD, perl is at /usr/local/bin/perl, not /usr/bin/perl.
Likewise, on NetBSD, perl is at /usr/pkg/bin/perl, not /usr/bin/perl.
And likewise, on Guix, the only binary in /usr/bin is /usr/bin/env.

The attached patch fixes it. "use warnings" instead of option '-w' is
recommended per https://stackoverflow.com/questions/12554179/ ; it avoids
the use of /usr/bin/env's option '-S' which is unportable (not specified
by POSIX).

>From 6cbbef99f9e12b57d4e0df82b2c70f0460d98142 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Sun, 21 Jul 2024 20:04:26 +0200
Subject: [PATCH] build: Fix use of perl on Guix, FreeBSD, NetBSD

* man/help2man: Search for perl in $PATH.
---
 man/help2man | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/man/help2man b/man/help2man
index 7ba1aa6..fc1c991 100755
--- a/man/help2man
+++ b/man/help2man
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
 
 # Generate a short man page from --help and --version output.
 # Copyright (C) 1997-2005, 2009-2011, 2013, 2015-2024 Free Software Foundation,
@@ -23,6 +23,7 @@
 
 use 5.008;
 use strict;
+use warnings;
 use Getopt::Long;
 use Text::Tabs qw(expand);
 use POSIX qw(strftime setlocale LC_ALL);
-- 
2.34.1