discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Peter Bray <pdb_ml@yahoo.com.au>
Cc: discuss@mdocml.bsd.lv
Subject: Re: mdocml [CVS_2015_11_07] Linking of soelim(1) fails on Solaris 10
Date: Sat, 7 Nov 2015 22:56:55 +0100	[thread overview]
Message-ID: <20151107215655.GG10393@athene.usta.de> (raw)
In-Reply-To: <563D7C2C.1080903@yahoo.com.au>

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

      reply	other threads:[~2015-11-07 21:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07  4:21 Peter Bray
2015-11-07 21:56 ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151107215655.GG10393@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mdocml.bsd.lv \
    --cc=pdb_ml@yahoo.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).