discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml [CVS_2015_11_07] Linking of soelim(1) fails on Solaris 10
@ 2015-11-07  4:21 Peter Bray
  2015-11-07 21:56 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Bray @ 2015-11-07  4:21 UTC (permalink / raw)
  To: discuss

Greetings,

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

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()?

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?

Regards,

Peter Bray
Sydney, Australia

--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mdocml [CVS_2015_11_07] Linking of soelim(1) fails on Solaris 10
  2015-11-07  4:21 mdocml [CVS_2015_11_07] Linking of soelim(1) fails on Solaris 10 Peter Bray
@ 2015-11-07 21:56 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2015-11-07 21:56 UTC (permalink / raw)
  To: Peter Bray; +Cc: discuss

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-07 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07  4:21 mdocml [CVS_2015_11_07] Linking of soelim(1) fails on Solaris 10 Peter Bray
2015-11-07 21:56 ` Ingo Schwarze

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).