Bug 619 - compat/getaddrinfo.o not added to LTLIBOBJS when needed (on HP-UX)
compat/getaddrinfo.o not added to LTLIBOBJS when needed (on HP-UX)
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Configure
1.8.7
HP HP-UX
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-06 21:38 MST by Daniel Richard G.
Modified: 2013-11-13 08:36 MST (History)
0 users

See Also:


Attachments
Patch against sudo hg tip (1.18 KB, patch)
2013-11-11 12:22 MST, Daniel Richard G.
Details | Diff
Follow-up patch against sudo hg tip (796 bytes, patch)
2013-11-12 01:11 MST, Daniel Richard G.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Richard G. 2013-11-06 21:38:17 MST
Building sudo 1.8.8 on HP-UX B.11.00 fails with

libtool: link: cc -o sudo conversation.o env_hooks.o exec.o exec_common.o exec_pty.o get_pty.o hooks.o net_ifs.o load_plugins.o parse_args.o signal.o sudo.o sudo_edit.o tgetpass.o ttyname.o utmp.o preload.o  ../plugins/sudoers/.libs/sudoers.a -lpam -lpthread ../common/.libs/libcommon.a ../compat/.libs/libreplace.a
/usr/ccs/bin/ld: Unsatisfied symbols:
   freeaddrinfo (first referenced in ../plugins/sudoers/.libs/sudoers.a(sudoers.o)) (code)
   getaddrinfo (first referenced in ../plugins/sudoers/.libs/sudoers.a(sudoers.o)) (code)
*** Error exit code 1


getaddrinfo() and freeaddrinfo() are defined in compat/getaddrinfo.c, but unlike other source files under compat/, this one is not compiled when the system lacks the corresponding functionality---because there is no AC_LIBOBJ(getaddrinfo) call anywhere in the configure script.
Comment 1 Daniel Richard G. 2013-11-11 12:22:44 MST
Created attachment 377 [details]
Patch against sudo hg tip

This patch fixes the problem and allows sudo to compile on systems lacking {get,free}addrinfo().
Comment 2 Todd C. Miller 2013-11-11 12:54:42 MST
Committed, thanks.
Comment 3 Daniel Richard G. 2013-11-11 13:03:48 MST
getaddrinfo.lo has the "$(top_builddir)/config.h" dependency listed twice in compat/Makefile.in ...
Comment 4 Todd C. Miller 2013-11-11 13:54:02 MST
The script that generates dependencies wasn't checking for duplicates.  I've fixed that.
Comment 5 Daniel Richard G. 2013-11-12 01:11:54 MST
Created attachment 380 [details]
Follow-up patch against sudo hg tip

Only a couple further changes, attached, are needed to get Sudo building and testing correctly on the aforementioned HP-UX system.
Comment 6 Todd C. Miller 2013-11-12 08:53:54 MST
Applied, thanks.
Comment 7 Daniel Richard G. 2013-11-12 12:22:38 MST
Oh, there's one more thing I forgot to mention:

        cc -c -I../../include -I.. -I. -I../../src -I../.. -D__STDC_WANT_LIB_EXT1__=1 -g +DAportable -Bhidden_def   -D_REENTRANT -DLOCALEDIR=\"/usr/local/share/locale\"  ../../src/exec.c
cc: "../../src/exec.c", line 211: error 1588: "MSG_WAITALL" undefined.
cc: "../../src/exec.c", line 211: warning 563: Argument #4 is not the correct type.
*** Error exit code 1

On HP-UX, MSG_WAITALL exists, but it is not #defined unless you define the _XOPEN_SOURCE_EXTENDED feature test macro. So effectively, you can't build Sudo unless you #define that macro. (This is true for 11.00, 11.11, 11.31, and is likely true even for the latest kit.)

I'm not sure what's the preferred way of handling this kind of thing, but there isn't even a mention of it in the OS-specific notes section of INSTALL. (I can file a new bug on this if appropriate.)
Comment 8 Todd C. Miller 2013-11-12 15:16:05 MST
I just checked in changes to define _XOPEN_SOURCE_EXTENDED on HP-UX if needed.
Comment 9 Daniel Richard G. 2013-11-12 18:07:43 MST
Excellent. I tested the new configure-time logic, and it does the trick. I see you added something in case MSG_WAITALL is (really) missing, too.

Everything looks good here, except for one final nit, in "make check". I get this error on the 11.00 system:

    check_symbols: test 7: able to resolve local symbol user_in_group
    check_symbols: 7 tests run, 1 errors, 85% success rate

It doesn't happen on 11.11. Known issue?
Comment 10 Todd C. Miller 2013-11-13 06:52:21 MST
That means that the symbol visibility controls are not working.  It's a toolchain issue but it won't actually cause any problems.
Comment 11 Daniel Richard G. 2013-11-13 08:36:38 MST
Well, as long as that's not a fatal flaw security-wise :-)

Todd, thank you for all your help on this bug. Please have a look at the others I've submitted when you have a chance!