Issue 8202 - openldap assumes printf has %z
Summary: openldap assumes printf has %z
Status: VERIFIED WONTFIX
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.41
Hardware: All All
: --- normal
Target Milestone: 2.5.0
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-19 11:44 UTC by iand@ekit-inc.com
Modified: 2020-04-18 00:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description iand@ekit-inc.com 2015-07-19 11:44:42 UTC
Full_Name: Ian Donaldson
Version: 2.4.41
OS: Solaris 9
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (60.241.85.68)


Built 2.4.41 on Solaris 9; ran 'make check' which failed to start slapd with
the following errors:

55ab70f0 config_build_entry: "olcDatabase={-1}frontend"
55ab70f0 config_build_entry: "olcDatabase={0}config"
55ab70f0 config_build_entry: "olcDatabase={1}bdb"
55ab70f0 config_build_attrs: error 21 on olcDbCacheSize value #0
55ab70f0 config_build_entry: build "zu" failed: ""

Eventually found this to be due to the assumption that %z format
works in printf; this is not the case on Solaris 9.   (Solaris 10 has %z)

Found the following code that makes this assumption (there may be others):

./libraries/liblmdb/mdb_load.c
./libraries/liblmdb/mdb_dump.c
./libraries/liblmdb/mdb_stat.c
./libraries/liblmdb/mdb.c
./servers/slapd/overlays/constraint.c
./servers/slapd/config.c

My workaround was to use %l instead of %z which works for me; may not
be 100% fix though.

See http://stackoverflow.com/questions/2524611/how-to-print-size-t-variable-portably


I previously built 2.4.33 which has some %z'isms too but not in places
that cause 'make check' to fail.
Comment 1 Howard Chu 2015-07-19 12:14:50 UTC
iand@ekit-inc.com wrote:
> Full_Name: Ian Donaldson
> Version: 2.4.41
> OS: Solaris 9
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (60.241.85.68)
>
>
> Built 2.4.41 on Solaris 9; ran 'make check' which failed to start slapd with
> the following errors:

Thanks for the report. Not sure that it's worth our taking any action though. 
The last release of Solaris 9 was 10 years ago, and it has been end-of-life'd 
by Oracle.

> 55ab70f0 config_build_entry: "olcDatabase={-1}frontend"
> 55ab70f0 config_build_entry: "olcDatabase={0}config"
> 55ab70f0 config_build_entry: "olcDatabase={1}bdb"
> 55ab70f0 config_build_attrs: error 21 on olcDbCacheSize value #0
> 55ab70f0 config_build_entry: build "zu" failed: ""
>
> Eventually found this to be due to the assumption that %z format
> works in printf; this is not the case on Solaris 9.   (Solaris 10 has %z)
>
> Found the following code that makes this assumption (there may be others):
>
> ./libraries/liblmdb/mdb_load.c
> ./libraries/liblmdb/mdb_dump.c
> ./libraries/liblmdb/mdb_stat.c
> ./libraries/liblmdb/mdb.c
> ./servers/slapd/overlays/constraint.c
> ./servers/slapd/config.c
>
> My workaround was to use %l instead of %z which works for me; may not
> be 100% fix though.
>
> See http://stackoverflow.com/questions/2524611/how-to-print-size-t-variable-portably
>
>
> I previously built 2.4.33 which has some %z'isms too but not in places
> that cause 'make check' to fail.
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 2 Howard Chu 2015-07-21 18:01:03 UTC
Howard Chu wrote:
> iand@ekit-inc.com wrote:
>> Full_Name: Ian Donaldson
>> Version: 2.4.41
>> OS: Solaris 9
>> URL: ftp://ftp.openldap.org/incoming/
>> Submission from: (NULL) (60.241.85.68)
>>
>>
>> Built 2.4.41 on Solaris 9; ran 'make check' which failed to start slapd with
>> the following errors:
>
> Thanks for the report. Not sure that it's worth our taking any action though.
> The last release of Solaris 9 was 10 years ago, and it has been end-of-life'd
> by Oracle.

For reference: Solaris 9 EOL
http://www.oracle.com/technetwork/server-storage/solaris10/overview/index-138972.html

In short it means Solaris 9 is no longer eligible for any Oracle updates 
including security updates, fixes, patches or any other changes.  Solaris 9 
went into sustaining support in October 2014.

Since Oracle is no longer providing any patches for this OS, I don't see much 
reason for us to either. Fortunately you are free to patch and build OpenLDAP 
for yourself for as long as you wish.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 3 Hallvard Furuseth 2015-07-21 19:55:59 UTC
If we require C99 library features like this, then I
think we should add a configure test for them.  Strange
breakage at runtime is rather worse than a failed build.

(That's not the same as testing for a C99 compiler, since
one can have a C99 compiler like gcc with a C90 library.)


Comment 4 iand@ekit-inc.com 2015-07-22 01:39:50 UTC
Hi Howard,
Yes I'm well aware of the state of Solaris 9 support and we support key components
of the OS ourselves.  However that doesn't mean
that people don't still run it, like we do on some systems yet to be upgraded.
(yes we have Sun systems purchased over 15 years ago that are still happily running;
the hardware is very reliable; many are well overdue for upgrade though; its a resource/priority thing
just look at how many people are running WinXP still)


However this issue is a portability of openldap issue, not a OS support/patch thing (the C library in this case is not
broken; its doing as the man page says, which doesn't mention %z), and the %z support is only
a recent thing in the lifetime of unix (well last ~15 years it started to appear... C99 I think)

There will be other legacy OS's that don't support %z too; no idea what ones though.

Anyway I've got an (ugly) patch for me to use now and it passes 'make check' on Solaris 9;
it was hard to find the cause of the problem though.

Ian D


On 07/22/15 04:01, Howard Chu wrote:
> Howard Chu wrote:
>> iand@ekit-inc.com wrote:
>>> Full_Name: Ian Donaldson
>>> Version: 2.4.41
>>> OS: Solaris 9
>>> URL: ftp://ftp.openldap.org/incoming/
>>> Submission from: (NULL) (60.241.85.68)
>>>
>>>
>>> Built 2.4.41 on Solaris 9; ran 'make check' which failed to start slapd with
>>> the following errors:
>>
>> Thanks for the report. Not sure that it's worth our taking any action though.
>> The last release of Solaris 9 was 10 years ago, and it has been end-of-life'd
>> by Oracle.
>
> For reference: Solaris 9 EOL
> http://www.oracle.com/technetwork/server-storage/solaris10/overview/index-138972.html
>
> In short it means Solaris 9 is no longer eligible for any Oracle updates including security updates, fixes, patches or any other changes.  Solaris 9 went into sustaining support in October 2014.
>
> Since Oracle is no longer providing any patches for this OS, I don't see much reason for us to either. Fortunately you are free to patch and build OpenLDAP for yourself for as long as you wish.
>


Comment 5 Howard Chu 2015-07-22 15:54:59 UTC
h.b.furuseth@usit.uio.no wrote:
> If we require C99 library features like this, then I
> think we should add a configure test for them.  Strange
> breakage at runtime is rather worse than a failed build.
>
> (That's not the same as testing for a C99 compiler, since
> one can have a C99 compiler like gcc with a C90 library.)

The fewer configure tests we need, the better. Happy to replace %zu with %llu 
and forget about it. It's not worth a fuss.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 6 Hallvard Furuseth 2015-07-22 16:01:19 UTC
On 22. juli 2015 17:54, Howard Chu wrote:
> h.b.furuseth@usit.uio.no wrote:
>> If we require C99 library features like this, then I
>> think we should add a configure test for them.  Strange
>> breakage at runtime is rather worse than a failed build.
>>
>> (That's not the same as testing for a C99 compiler, since
>> one can have a C99 compiler like gcc with a C90 library.)
>
> The fewer configure tests we need, the better. Happy to replace %zu with %llu
> and forget about it. It's not worth a fuss.

Right.  Looks like it should be %ld and (long) though,
we don't use long long either except inside HAVE_LONG_LONG etc
and mdb.c


-- 
Hallvard

Comment 7 OpenLDAP project 2017-09-11 16:51:24 UTC
portability
Comment 8 Quanah Gibson-Mount 2017-09-11 16:51:24 UTC
changed notes
Comment 9 Quanah Gibson-Mount 2020-04-17 18:55:55 UTC
Looks like it's only a problem now with the constraint overlay and back-mdb/tools.c,
Comment 10 Quanah Gibson-Mount 2020-04-17 19:02:48 UTC
(In reply to Quanah Gibson-Mount from comment #9)
> Looks like it's only a problem now with the constraint overlay and
> back-mdb/tools.c,

The code in back-mdb/tools.c is ifdef'd out.

So constraint.c is the only remaining problem.
Comment 11 Quanah Gibson-Mount 2020-04-17 19:48:21 UTC
Actually looks like liblmdb still has this issue, just harder to see because of MDB_FMT_Z

Perhaps we just say C99 required?
Comment 12 Quanah Gibson-Mount 2020-04-18 00:57:34 UTC
C99 is required.