Bug 847

Summary: Building sudo 1.8.24 on AIX 7.1 fails
Product: Sudo Reporter: altmark
Component: ConfigureAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.8.24   
Hardware: IBM   
OS: AIX   

Description altmark 2018-08-22 03:46:04 MDT
When trying to build sudo 1.8.24 on AIX 7.1 I run into the following error during the "make" stage:


libtool: compile:  gcc -c -I../../include -I../.. -I. -I../.. -D_PATH_SUDO_CONF=\"/etc/sudo.conf\" -DZLIB_CONST -D_FORTIFY_SOURCE=2 -g -O2 ./gethostname.c  -fPIC -DPIC -o .libs/gethostname.o
In file included from ./gethostname.c:24:0:
../../include/sudo_compat.h:460:45: error: unknown type name 'rsize_t'
 __dso_public errno_t sudo_memset_s(void *v, rsize_t smax, int c, rsize_t n);
                                             ^~~~~~~
../../include/sudo_compat.h:460:66: error: unknown type name 'rsize_t'
 __dso_public errno_t sudo_memset_s(void *v, rsize_t smax, int c, rsize_t n);
                                                                  ^~~~~~~
make: 1254-004 The error code from the last command is 1.


Stop.
make: 1254-004 The error code from the last command is 2.


Stop.


This happens with both gcc and IBM's xlc compilier. No specific options for "configure" have been used.

My guess is that it's related to this change from 2018/05/15:

	* configure, configure.ac:
	Depending on the bos level, AIX 6.1 may or may not include
	getline/getdelim and AIX 7.1 may or may not include memset_s. Since
	we need to build packages that will work on all AIX 6.1 and 7.1
	machines, use our getline() and memset_s emulation.
	[f5c427076b2c]

When I remove this section

		# memset_s() may or may ont be present on AIX <= 7.1.
		# bos710 is missing memset_s but bos71L has it.
		if test $OSMAJOR -le 7; then
		    ac_cv_func_memset_s=no
		fi

from both "configure" and "configure.ac", the compilation works.

The system runs AIX 7.1 Technology Level 4 Service Pack 5, i.e. "oslevel -s" returns "7100-04-05-1720" (which is bos71X).
Comment 1 Todd C. Miller 2018-08-22 06:57:59 MDT
That's odd, I build sudo packages on AIX 7.1, bos71L.

Did configure detect rsize_t (config.log should include a test for it)?  If present, it should be in stddef.h.  On my AIX 7.1 system rsize_t is not present so sudo uses its own definition.
Comment 2 Todd C. Miller 2018-08-22 07:49:20 MDT
This should be fixed by the following commit:
https://www.sudo.ws/repos/sudo/rev/3724b47eadd8
Comment 3 Todd C. Miller 2018-08-22 09:29:01 MDT
I've decided to add a configure option for package building so that sudo will use the system version of memset_s() on AIX 7.1 unless it is a package build.
Comment 4 altmark 2018-08-22 10:03:59 MDT
Here's what a "grep rsize_t config.log" gives:

configure:18409: checking for rsize_t
 if (sizeof ((rsize_t)))
| if (sizeof ((rsize_t)))
ac_cv_type_rsize_t=yes

In fact rsize_t is defined in string.h on my system, so applying changeset 3724b47eadd8 makes a difference and sudo builds just fine.

Thank you for the quick fix!
Comment 5 Todd C. Miller 2018-09-05 06:28:04 MDT
Fixed in sudo 1.8.25