Subject: pkg/22851: Fix archivers/gcpio on !NetBSD
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jonathan@perkin.org.uk>
List: netbsd-bugs
Date: 09/19/2003 11:47:09
>Number:         22851
>Category:       pkg
>Synopsis:       Fix archivers/gcpio on !NetBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 19 11:48:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Perkin
>Release:        N/A
>Organization:
British Broadcasting Corporation
>Environment:
SunOS build1 5.9 Generic_112233-01 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
>Description:
archivers/gcpio currently has a few portability bugs:

 1) It specifies LIBS+=-lgnumalloc, which to my knowledge, only exists
    as default on NetBSD.
 2) The Solaris mkdir() replacement has incorrect prototypes.

Fix below testing on SunOS-5.9/sparc and NetBSD-current/sparc64

Someone with more intimate knowledge of libgnumalloc may want to
revisit whether it is needed at all, as this is the only Makefile
in all of pkgsrc which specifies it.
>How-To-Repeat:
===> Building for gcpio-2.4.2nb1
gcc -c   -I/home/jonp/bulk/pkg/include -DRETSIGTYPE=void -DMAJOR_IN_MKDEV=1 -DHAVE_SYS_MTIO_H=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 -DHAVE_UTIME_H=1 -DC_ALLOCA=1 -DSTACK_DIRECTION=0 -DHAVE_DIRENT_H=1 -I. -O -I/home/jonp/bulk/pkg/include mkdir.c
mkdir.c: In function `mkdir':
mkdir.c:56: error: argument `dpath' doesn't match prototype
/usr/include/sys/stat.h:490: error: prototype declaration
mkdir.c:56: error: argument `dmode' doesn't match prototype
/usr/include/sys/stat.h:490: error: prototype declaration
*** Error code 1

gcc -L/home/jonp/bulk/pkg/lib -Wl,-R/home/jonp/bulk/pkg/lib -o cpio copyin.o copyout.o copypass.o defer.o dstring.o global.o  main.o tar.o util.o error.o getopt.o getopt1.o filemode.o version.o  rtapelib.o dirname.o idcache.o makepath.o xmalloc.o stripslash.o  userspec.o xstrdup.o  bcopy.o mkdir.o strdup.o fnmatch.o alloca.o -lgnumalloc
ld: fatal: library -lgnumalloc: not found
ld: fatal: File processing errors. No output written to cpio
collect2: ld returned 1 exit status
*** Error code 1
>Fix:
http://www.perkin.org.uk/projects/netbsd/gcpio.diff

--- /dev/null   Fri Sep 19 12:27:48 2003
+++ patches/patch-ad    Fri Sep 19 12:20:27 2003
@@ -1,0 +1,15 @@
+$NetBSD$
+
+--- mkdir.c.orig       Fri Sep 19 12:17:42 2003
++++ mkdir.c    Fri Sep 19 12:18:15 2003
+@@ -51,8 +51,8 @@
+ 
+ int
+ mkdir (dpath, dmode)
+-     char *dpath;
+-     int dmode;
++     const char *dpath;
++     mode_t dmode;
+ {
+   int cpid, status;
+   struct stat statbuf;
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/gcpio/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- Makefile    2003/08/09 10:27:40     1.19
+++ Makefile    2003/09/19 11:30:33
@@ -13,11 +13,14 @@
 
 USE_BUILDLINK2=        yes
 GNU_CONFIGURE= yes
-LIBS+=         -lgnumalloc
 
 INFO_FILES=    cpio.info
 
 .include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "NetBSD"
+LIBS+=         -lgnumalloc
+.endif
 
 .if defined(GNU_PROGRAM_PREFIX)
 CONFIGURE_ARGS+=       --program-prefix=${GNU_PROGRAM_PREFIX}
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/gcpio/distinfo,v
retrieving revision 1.4
diff -u -r1.4 distinfo
--- distinfo    2003/03/16 00:17:23     1.4
+++ distinfo    2003/09/19 11:30:33
@@ -5,3 +5,4 @@
 SHA1 (patch-aa) = 36f3287ea0a64ac0eb085335ef0ab6661e1458c7
 SHA1 (patch-ab) = aa50963702198b42345aa906f387b89adad2b9b0
 SHA1 (patch-ac) = 372b5fe8bb22a609c22089c78f67387e66436372
+SHA1 (patch-ad) = 8c681d5d7a50ac813d8463e4d0640e8d4795b913
>Release-Note:
>Audit-Trail:
>Unformatted: