NetBSD Problem Report #49703

From diro@nixsyspaus.org  Fri Feb 27 18:36:28 2015
Return-Path: <diro@nixsyspaus.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id BD5B4A5674
	for <gnats-bugs@gnats.netbsd.org>; Fri, 27 Feb 2015 18:36:28 +0000 (UTC)
Message-Id: <20150227183624.8E9C52041E4@asche.nixsyspaus.org>
Date: Fri, 27 Feb 2015 18:36:24 +0000 (UTC)
From: diro@nixsyspaus.org
Reply-To: diro@nixsyspaus.org
To: gnats-bugs@gnats.netbsd.org
Subject: nagios-plugins build broken in FreeBSD
X-Send-Pr-Version: 3.95

>Number:         49703
>Category:       pkg
>Synopsis:       nagios-plugins build broken in FreeBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 27 18:40:00 +0000 2015
>Closed-Date:    Mon Apr 13 04:02:06 +0000 2015
>Last-Modified:  Mon Apr 13 04:02:06 +0000 2015
>Originator:     diro@nixsyspaus.org
>Release:        FreeBSD 10.1
>Organization:
>Environment:
System: NetBSD asche 5.0.2 NetBSD 5.0.2 (ASCHE.MP) #0: Sun May  2 07:50:23 UTC 2010  root@asche:/usr/obj/sys/arch/alpha/compile/ASCHE.MP alpha
Architecture: amd64
Machine: amd64
>Description:
This isn't breaking news or anything, since we've all seen the bulk build
reports on FreeBSD. Build is failing, because statvfs doesn't have
f_fstypename on FreeBSD.
>How-To-Repeat:
Build nagios-plugins on FreeBSD.
>Fix:
Here's a crappy patch to patch-ak to make the build continue:


$NetBSD: patch-ak,v 1.4 2011/04/08 22:56:12 morr Exp $

--- gl/mountlist.c.orig	2010-07-27 20:47:15.000000000 +0000
+++ gl/mountlist.c
@@ -52,7 +52,11 @@
 # if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
 #  define FS_TYPE(Ent) ((Ent).f_fstypename)
 # else
-#  define FS_TYPE(Ent) mnt_names[(Ent).f_type]
+#  ifdef STAT_STATVFS
+#   define FS_TYPE(Ent) mnt_names[(Ent).f_fsid]
+#  else
+#   define FS_TYPE(Ent) mnt_names[(Ent).f_type]
+#  endif
 # endif
 #endif /* MOUNTED_GETFSSTAT */

@@ -99,6 +103,10 @@
 # include <sys/statfs.h>
 #endif

+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
 #ifdef MOUNTED_LISTMNTENT
 # include <mntent.h>
 #endif
@@ -169,7 +177,7 @@

 #if MOUNTED_GETMNTINFO

-# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
+# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME && ! STAT_STATVFS
 static char *
 fstype_to_string (short int t)
 {
@@ -266,9 +274,13 @@ fstype_to_string (short int t)
 # endif

 static char *
+#if defined(STAT_STATVFS) && !defined(__FreeBSD__)
+fsp_to_string (const struct statvfs *fsp)
+#else
 fsp_to_string (const struct statfs *fsp)
+#endif
 {
-# if HAVE_STRUCT_STATFS_F_FSTYPENAME
+# if defined HAVE_STRUCT_STATFS_F_FSTYPENAME || defined STAT_STATVFS
   return (char *) (fsp->f_fstypename);
 # else
   return fstype_to_string (fsp->f_type);
@@ -592,9 +604,17 @@ read_file_system_list (bool need_fs_type
   {
     int numsys, counter;
     size_t bufsize;
+#if defined(STAT_STATVFS) && !defined(__FreeBSD__)
+    struct statvfs *stats;
+#else
     struct statfs *stats;
+#endif

+#ifdef STAT_STATVFS
+    numsys = getfsstat ((struct statvfs *)0, 0L, MNT_NOWAIT);
+#else
     numsys = getfsstat ((struct statfs *)0, 0L, MNT_NOWAIT);
+#endif
     if (numsys < 0)
       return (NULL);
     if (SIZE_MAX / sizeof *stats <= numsys)

>Release-Note:

>Audit-Trail:
From: Tobias Nygren <tnn@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/49703: nagios-plugins build broken in FreeBSD
Date: Fri, 27 Feb 2015 20:59:06 +0100

 Had a quick glance at FreeBSD ports and they don't have an equivalent
 patch so maybe the problem is fixed by upstream already. The
 nagios-plugins package in pkgsrc seems to be outdated. Any chance
 you'd be interested in submitting an updated package instead?
 (I added it to the pkgsrc TODO list.)

 Kind regards,
 -Tobias

From: Tobias Nygren <tnn@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/49703: nagios-plugins build broken in FreeBSD
Date: Fri, 27 Feb 2015 21:09:30 +0100

 Looking closer I guess the error on FreeBSD was actually caused by our
 patch. I will commit it for now, thank you.

From: "Tobias Nygren" <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49703 CVS commit: pkgsrc/net/nagios-plugins
Date: Fri, 27 Feb 2015 20:14:07 +0000

 Module Name:	pkgsrc
 Committed By:	tnn
 Date:		Fri Feb 27 20:14:07 UTC 2015

 Modified Files:
 	pkgsrc/net/nagios-plugins: distinfo
 	pkgsrc/net/nagios-plugins/patches: patch-ak

 Log Message:
 PR pkg/49703: FreeBSD build fix (struct statvfs does not have f_fstypename)


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 pkgsrc/net/nagios-plugins/distinfo
 cvs rdiff -u -r1.4 -r1.5 pkgsrc/net/nagios-plugins/patches/patch-ak

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

From: rodent@NetBSD.org
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/49703: nagios-plugins build broken in FreeBSD
Date: Fri, 27 Feb 2015 22:33:07 -0500

 >  Had a quick glance at FreeBSD ports and they don't have an equivalent
 >  patch so maybe the problem is fixed by upstream already. The
 >  nagios-plugins package in pkgsrc seems to be outdated. Any chance
 >  you'd be interested in submitting an updated package instead?
 >  (I added it to the pkgsrc TODO list.)

 Yes, i started packaging the 4.x series some months ago. I have about half of
 the packages done. I haven't had time to finish the rest and test them on
 various platforms. If someone else wants to finish these, i can send what i
 have so far.

From: "Blue Rats" <rodent@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49703 CVS commit: pkgsrc/net/nagios-plugins
Date: Mon, 13 Apr 2015 03:59:41 +0000

 Module Name:	pkgsrc
 Committed By:	rodent
 Date:		Mon Apr 13 03:59:41 UTC 2015

 Modified Files:
 	pkgsrc/net/nagios-plugins: distinfo
 	pkgsrc/net/nagios-plugins/patches: patch-ak

 Log Message:
 Unclobber my previous patch some revisions ago which fixed the build on
 FreeBSD. Resolves PR #49703.


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 pkgsrc/net/nagios-plugins/distinfo
 cvs rdiff -u -r1.6 -r1.7 pkgsrc/net/nagios-plugins/patches/patch-ak

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

State-Changed-From-To: open->closed
State-Changed-By: rodent@NetBSD.org
State-Changed-When: Mon, 13 Apr 2015 04:02:06 +0000
State-Changed-Why:
Resolved by latest commit.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.