From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01-web.scc.kit.edu (scc-mailout-kit-01-web.scc.kit.edu [129.13.231.93]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id c03e70f3 for ; Sat, 7 Nov 2015 16:56:59 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1ZvBTj-0000AU-Jy; Sat, 07 Nov 2015 22:56:57 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1ZvBTj-0002LK-HU; Sat, 07 Nov 2015 22:56:55 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84) (envelope-from ) id 1ZvBTj-0006LD-BK; Sat, 07 Nov 2015 22:56:55 +0100 Received: from localhost (1031@localhost [local]); by localhost (OpenSMTPD) with ESMTPA id 0124275d; Sat, 7 Nov 2015 22:56:55 +0100 (CET) Date: Sat, 7 Nov 2015 22:56:55 +0100 From: Ingo Schwarze To: Peter Bray Cc: discuss@mdocml.bsd.lv Subject: Re: mdocml [CVS_2015_11_07] Linking of soelim(1) fails on Solaris 10 Message-ID: <20151107215655.GG10393@athene.usta.de> References: <563D7C2C.1080903@yahoo.com.au> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <563D7C2C.1080903@yahoo.com.au> User-Agent: Mutt/1.5.23 (2014-03-12) Hi Peter, Peter Bray wrote on Sat, Nov 07, 2015 at 03:21:00PM +1100: > soelim(1) fails to link on Solaris 10 systems as the appropriate > compatibility code has not been included in the linking of the > executable. > > Changing the Makefile linking command to include additional > compatibility object code, as follows: (helps but...) > > --- Makefile.orig 2015-11-07 00:47:44.000000000 +0000 > +++ Makefile 2015-11-07 03:39:21.786602977 +0000 > @@ -414,5 +414,5 @@ > > soelim: $(SOELIM_OBJS) compat_reallocarray.o compat_err.o compat_progname.o > - $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS) compat_reallocarray.o > + $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS) compat_reallocarray.o > compat_err.o compat_progname.o Adding the required files to SOELIM_OBJS was simpler. > But, the Solaris 10 build then fails to find getline(3C). > > Looking at the code base, getline(3C) is only used once: > > soelim.c:100: while ((linelen = getline(&line, &linecap, f)) > 0) { > > While a compatibility function fgetln() from compat_fgetln.c is used > in many places: > > manpage.c:127: if (NULL != (cp = fgetln(stdin, &len))) > cgi.c:720: while (NULL != (p = fgetln(f, &len))) { > cgi.c:1145: while (NULL != (dp = fgetln(fp, &dpsz))) { > main.c:791: while ((line = fgetln(stream, &len)) != NULL) { > main.c:821: syscall = "fgetln"; > mandocdb.c:1309: while (NULL != (line = fgetln(stream, &len))) > mandocdb.c:1318: while (NULL != (line = fgetln(stream, &len))) > mandocdb.c:1332: while (NULL != (line = fgetln(stream, &len))) { > manpath.c:221: while ((cp = fgetln(stream, &len)) != NULL) { > > Both functions on the surface (and no, I didn't do any investigation), > seem to be doing a simalar task (reading a line from a file handle). > > Question: Should soelim.c also be using fgetln()? I solved this the other way, using the safer and more standard getline(3) everywhere and providing a compatibility implementation. > Back to the Makefile, I noticed that the unedited file contains: > > Makefile:267:SOELIM_OBJS = soelim.o compat_stringlist.o > > Makefile:415:soelim: $(SOELIM_OBJS) compat_reallocarray.o > Makefile:416: $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS) compat_reallocarray.o > > Question: Should compat_reallocarray.o and the compatibility object > code change I proposed be moved to the definition of SOELIM_OBJS? Yes. Should all work now... I tested on the OpenCSW cluster on Solaris 9, 10, and 11. Yours, Ingo -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv