NetBSD Problem Report #20798

Received: (qmail 17162 invoked by uid 605); 19 Mar 2003 06:25:13 -0000
Message-Id: <9256-1048055111@rainier.reedmedia.net>
Date: Tue, 18 Mar 2003 22:25:11 -0800
From: reed@reedmedia.net
Sender: gnats-bugs-owner@netbsd.org
Reply-To: reed@reedmedia.net
To: gnats-bugs@gnats.netbsd.org
Subject: portability fixes for pkgsrc/sysutils/findutils
X-Send-Pr-Version: 3.95

>Number:         20798
>Category:       pkg
>Synopsis:       portability fixes for pkgsrc/sysutils/findutils
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bouyer
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 06:26:00 +0000 2003
>Closed-Date:    Tue Jul 06 21:21:46 +0000 2004
>Last-Modified:  Tue Jul 06 21:22:00 +0000 2004
>Originator:     
>Release:        NetBSD 1.6
>Organization:
http://bsd.reedmedia.net/
>Environment:


System: NetBSD rainier.reedmedia.net 1.6 NetBSD 1.6 (JCR-20020927) #3: Sat Sep 28 13:40:20 PDT 2002 reed@rainier.reedmedia.net:/usr/src/sys/arch/i386/compile/JCR-20020927 i386
Architecture: i386
Machine: i386
>Description:
findutils has problems building under Linux.
>How-To-Repeat:
>Fix:
Please consider these patches (which appear to be fine under NetBSD
also).

diff -urN findutils.orig/Makefile findutils/Makefile
--- findutils.orig/Makefile	Wed Dec 25 09:56:46 2002
+++ findutils/Makefile	Tue Mar 18 22:13:35 2003
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.7 2002/12/25 17:56:46 wiz Exp $

 DISTNAME=	findutils-4.1
-PKGREVISION=	2
+PKGREVISION=	3
 CATEGORIES=	sysutils
 MASTER_SITES=	${MASTER_SITE_GNU:=findutils/}

diff -urN findutils.orig/distinfo findutils/distinfo
--- findutils.orig/distinfo	Tue Oct 22 04:35:40 2002
+++ findutils/distinfo	Thu Oct 31 16:47:21 2002
@@ -6,3 +6,10 @@
 SHA1 (patch-ab) = 13664baa3e9348413416c920776be659d5dc59c3
 SHA1 (patch-ac) = 2443dab53a9bc738cdb16e46b5aa7893ee7c13aa
 SHA1 (patch-ad) = 4f28e677b099e60b0097b0f7358dc4c51f07e1aa
+SHA1 (patch-ae) = 2f0606dfd6911910b31292f40f9b4c21488baa6a
+SHA1 (patch-af) = 5570d353dab8793cc9e6a283b325f93e40164b8b
+SHA1 (patch-ag) = d66c7c5ab9d84b4a30bd27e6d609f683d0f3de3e
+SHA1 (patch-ah) = 25fa8766b1bb4bca6709ec9c11f5dcadf489b70b
+SHA1 (patch-ai) = b87142967fe9f0a66f4c8203513447c70cff2401
+SHA1 (patch-aj) = be9793a1c825178c70653ce746825872ea2965e9
+SHA1 (patch-ak) = 32c00dc2d6bc01794e3d3476366ea450511fa312
diff -urN findutils.orig/patches/patch-ae findutils/patches/patch-ae
--- findutils.orig/patches/patch-ae	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-ae	Thu Oct 31 16:41:43 2002
@@ -0,0 +1,11 @@
+--- find/defs.h	Wed Nov  2 15:59:15 1994
++++ find/defs.h	Tue May  2 15:30:31 2000
+@@ -301,7 +301,7 @@
+ boolean mark_stat P_((struct predicate *tree));
+ 
+ /* util.c */
+-char *basename P_((char *fname));
++char *basename2 P_((char *fname));
+ struct predicate *get_new_pred P_((void));
+ struct predicate *get_new_pred_chk_op P_((void));
+ struct predicate *insert_primary P_((boolean (*pred_func )()));
diff -urN findutils.orig/patches/patch-af findutils/patches/patch-af
--- findutils.orig/patches/patch-af	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-af	Thu Oct 31 16:42:00 2002
@@ -0,0 +1,10 @@
+--- find/parser.c	Wed Nov  2 15:59:19 1994
++++ find/parser.c	Tue May  2 15:33:12 2000
+@@ -52,7 +52,6 @@
+ #define lstat stat
+ #endif
+ 
+-char *strstr ();
+ int lstat ();
+ int stat ();
+ #ifndef atol /* for Linux */
diff -urN findutils.orig/patches/patch-ag findutils/patches/patch-ag
--- findutils.orig/patches/patch-ag	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-ag	Thu Oct 31 16:42:20 2002
@@ -0,0 +1,11 @@
+--- find/pred.c	Wed Nov  2 15:59:23 1994
++++ find/pred.c	Tue May  2 15:38:51 2000
+@@ -15,6 +15,8 @@
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
++#define _GNU_SOURCE
++
+ #include <config.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
diff -urN findutils.orig/patches/patch-ah findutils/patches/patch-ah
--- findutils.orig/patches/patch-ah	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-ah	Thu Oct 31 16:42:40 2002
@@ -0,0 +1,11 @@
+--- find/util.c	Thu Oct 20 00:49:47 1994
++++ find/util.c	Tue May  2 15:41:59 2000
+@@ -25,7 +25,7 @@
+    compressed into one slash. */
+ 
+ char *
+-basename (fname)
++basename2 (fname)
+      char *fname;
+ {
+   char *p;
diff -urN findutils.orig/patches/patch-ai findutils/patches/patch-ai
--- findutils.orig/patches/patch-ai	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-ai	Thu Oct 31 16:42:59 2002
@@ -0,0 +1,10 @@
+--- lib/nextelem.c	Tue Sep 27 09:02:45 1994
++++ lib/nextelem.c	Tue May  2 15:35:12 2000
+@@ -32,7 +32,6 @@
+ #endif
+ #endif
+ 
+-char *strdup ();
+ void free ();
+ 
+ /* Return the next element of a colon-separated path.
diff -urN findutils.orig/patches/patch-aj findutils/patches/patch-aj
--- findutils.orig/patches/patch-aj	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-aj	Thu Oct 31 16:43:12 2002
@@ -0,0 +1,12 @@
+--- xargs/xargs.c	Fri Oct  7 13:21:39 1994
++++ xargs/xargs.c	Tue May  2 15:39:46 2000
+@@ -60,9 +60,6 @@
+ #define memcpy(dest, source, count) (bcopy((source), (dest), (count)))
+ #endif
+ 
+-char *strstr ();
+-char *strdup ();
+-
+ #ifndef _POSIX_SOURCE
+ #include <sys/param.h>
+ #endif
diff -urN findutils.orig/patches/patch-ak findutils/patches/patch-ak
--- findutils.orig/patches/patch-ak	Wed Dec 31 16:00:00 1969
+++ findutils/patches/patch-ak	Thu Oct 31 16:46:55 2002
@@ -0,0 +1,12 @@
+--- find/fstype.c	Thu Nov  3 11:33:48 1994
++++ find/fstype.c	Tue May  2 15:31:42 2000
+@@ -30,9 +30,6 @@
+ extern int errno;
+ #endif
+ 
+-char *strdup ();
+-char *strstr ();
+-
+ static char *filesystem_type_uncached P_((char *path, char *relpath, struct stat *statp));
+ static int xatoi P_((char *cp));
+ 
>Release-Note:
>Audit-Trail:

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pkg/20798
Date: Thu, 8 Apr 2004 22:49:50 -0700 (PDT)

 Some examples of error messages:

 making install in find
 gcc -c -DHAVE_CONFIG_H -I.. -I../lib -I/usr/include -g -s -I/usr/include
 pred.c
 pred.c: In function `pred_iname':
 pred.c:766: error: `FNM_CASEFOLD' undeclared (first use in this function)

 making install in xargs
 gcc -c -DHAVE_CONFIG_H -I.. -I../lib -I/usr/include -g -s -I/usr/include
 ../find
 /version.c
 gcc -o xargs xargs.o ../find/version.o ../lib/libfind.a
 -L/usr/gcc3/lib/gcc-lib/
 i386-pc-linux/3.3.3 -Wl,-R/usr/gcc3/lib/gcc-lib/i386-pc-linux/3.3.3
 -L/usr/gcc3/
 lib -Wl,-R/usr/gcc3/lib -L/usr/lib -Wl,-R/usr/lib -lintl
 gcc: ../find/version.o: No such file or directory
 *** Error code 1

 making install in locate
 gcc -c -DHAVE_CONFIG_H -I.. -I../lib
 -DLOCATE_DB=\"/var/db/locate.database\" -I/
 usr/include -g -s -I/usr/include ../find/version.c
 gcc -o locate locate.o ../find/version.o ../lib/libfind.a
 -L/usr/gcc3/lib/gcc-li
 b/i386-pc-linux/3.3.3 -Wl,-R/usr/gcc3/lib/gcc-lib/i386-pc-linux/3.3.3
 -L/usr/gcc
 3/lib -Wl,-R/usr/gcc3/lib -L/usr/lib -Wl,-R/usr/lib -lintl
 gcc: ../find/version.o: No such file or directory

 Others have had similar problems and patches are widely available, for
 example:
 http://mail.gnu.org/archive/html/bug-gnu-utils/2001-08/msg00209.html
 http://mail.gnu.org/archive/html/bug-gnu-utils/2001-08/txt00007.txt

    Jeremy C. Reed
    http://www.reedmedia.net/


From: Thomas Klausner <wiz@NetBSD.org>
To: reed@reedmedia.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/20798: portability fixes for pkgsrc/sysutils/findutils
Date: Fri, 9 Apr 2004 10:36:07 +0200

 On Tue, Mar 18, 2003 at 10:25:11PM -0800, reed@reedmedia.net wrote:
 > Please consider these patches (which appear to be fine under NetBSD
 > also).

 These look fine; one question though:

 > +--- find/pred.c	Wed Nov  2 15:59:23 1994
 > ++++ find/pred.c	Tue May  2 15:38:51 2000
 > +@@ -15,6 +15,8 @@
 > +    along with this program; if not, write to the Free Software
 > +    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 > + 
 > ++#define _GNU_SOURCE
 > ++
 > + #include <config.h>
 > + #include <sys/types.h>
 > + #include <sys/stat.h>

 What's this one good for?
  Thomas

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: Thomas Klausner <wiz@NetBSD.org>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/20798: portability fixes for pkgsrc/sysutils/findutils
Date: Fri, 7 May 2004 10:41:54 -0700 (PDT)

 On Fri, 9 Apr 2004, Thomas Klausner wrote:

 > > ++#define _GNU_SOURCE
 > > ++
 > > + #include <config.h>
 > > + #include <sys/types.h>
 > > + #include <sys/stat.h>
 >
 > What's this one good for?

 Without it under Linux (but not under NetBSD 1.6.x) I get:

 pred.c:768: error: `FNM_CASEFOLD' undeclared (first use in this function)
 pred.c:768: error: (Each undeclared identifier is reported only once
 pred.c:768: error: for each function it appears in.)
 pred.c: In function `pred_ipath':
 pred.c:803: error: `FNM_CASEFOLD' undeclared (first use in this function)
 pred.c: In function `insert_lname':
 pred.c:856: error: `FNM_CASEFOLD' undeclared (first use in this function)
 pred.c: In function `pred_name':
 ...

 gcc -o xargs xargs.o ../find/version.o ../lib/libfind.a
 -L/usr/gcc3/lib/gcc-lib/
 i386-pc-linux/3.3.3 -Wl,-R/usr/gcc3/lib/gcc-lib/i386-pc-linux/3.3.3
 -L/usr/gcc3/
 lib -Wl,-R/usr/gcc3/lib -L/usr/lib -Wl,-R/usr/lib -lint
 gcc: ../find/version.o: No such file or directory



 The source findutils-4.1/lib/fnmatch.h has:

 #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
 #define FNM_FILE_NAME   FNM_PATHNAME /* Preferred GNU name.  */
 #define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match.  */
 #define FNM_CASEFOLD    (1 << 4) /* Compare without regard to case.  */
 #endif

 NetBSD's /usr/include/fnmatch.h has

 #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
 #define FNM_CASEFOLD    0x08    /* Pattern is matched case-insensitive */
 #endif

 My glibc's /usr/include/fnmatch.h has:

 #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
 # define FNM_FILE_NAME   FNM_PATHNAME   /* Preferred GNU name.  */
 # define FNM_LEADING_DIR (1 << 3)       /* Ignore `/...' after a match.  */
 # define FNM_CASEFOLD    (1 << 4)       /* Compare without regard to case. */
 # define FNM_EXTMATCH    (1 << 5)       /* Use ksh-like extended matching. */
 #endif


 Should I define _POSIX_C_SOURCE instead?

 Any suggestions?


  Jeremy C. Reed

  	  	 	 BSD News, BSD tutorials, BSD links
 	  	 	 http://www.bsdnewsletter.com/

Responsible-Changed-From-To: pkg-manager->bouyer 
Responsible-Changed-By: wiz 
Responsible-Changed-When: Tue Jul 6 10:40:14 UTC 2004 
Responsible-Changed-Why:  
Over to maintainer. 
State-Changed-From-To: open->closed 
State-Changed-By: bouyer 
State-Changed-When: Tue Jul 6 21:21:24 UTC 2004 
State-Changed-Why:  
patches commited. Thanks ! 

From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/20798 CVS commit: pkgsrc/sysutils/findutils
Date: Tue,  6 Jul 2004 21:21:17 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	bouyer
 Date:		Tue Jul  6 21:21:17 UTC 2004

 Modified Files:
 	pkgsrc/sysutils/findutils: distinfo
 Added Files:
 	pkgsrc/sysutils/findutils/patches: patch-ae patch-af patch-ag patch-ah
 	    patch-ai patch-aj patch-ak

 Log Message:
 Make compile on linux, from Jeremy C. Reed in PR 20798.


 To generate a diff of this commit:
 cvs rdiff -r1.5 -r1.6 pkgsrc/sysutils/findutils/distinfo
 cvs rdiff -r0 -r1.1 pkgsrc/sysutils/findutils/patches/patch-ae \
     pkgsrc/sysutils/findutils/patches/patch-af \
     pkgsrc/sysutils/findutils/patches/patch-ag \
     pkgsrc/sysutils/findutils/patches/patch-ah \
     pkgsrc/sysutils/findutils/patches/patch-ai \
     pkgsrc/sysutils/findutils/patches/patch-aj \
     pkgsrc/sysutils/findutils/patches/patch-ak

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.