[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7615) NetBSD sem_open limited to 14 characters



hyc@symas.com wrote:
> Greg@Akua.com wrote:
>> Full_Name: Greg Kerr
>> Version: 2.4.35
>> OS: NetBSD & FreeBSD
>> URL: ftp://ftp.openldap.org/incoming/
>> Submission from: (NULL) (50.88.130.68)
>>
>>
>> MDB is not usable on NetBSD because mdb.c has
>>
>> sprintf(env->me_txns->mti_wmname, "/MDBw%s", hexbuf);
>>
>> To create the semaphore name.
>>
>> This results in a 21 character name which is beyond the 14 allowed per "man
>> sem_open"
>
> That's unfortunate. In Linux this limit is 251 characters. Seems you'd need to
> use the btoa algorithm to safely fit a hash into this size limit.
>
> Pretty sure we've tested successfully on FreeBSD and MacOSX already, so
> apparently they don't suffer from this same limit.

mdb.master has been patched to use the btoa algorithm, which reduces our 
semaphore name length down to 15 chars. On NetBSD we additionally truncate the 
last to bring it down to 14.

>> "less than 14 characters in length not including the terminating null
>>        character."
>>
>> I will make a local patch ... and maybe it's a NetBSD bug - or at least the
>> package maintainers ... I will report to him.

It's a NetBSD kernel limitation, which I verified here:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/uipc_sem.c?rev=1.40&content-type=text/x-cvsweb-markup&only_with_tag=MAIN

Seems like a stupid limit, but whatever. Also the doc wording is inaccurate, 
the name can actually be *up to* 14 chars. "Less than 14" to most English 
speakers means the length must be *less than* 14. I.e., 13 or shorter. But in 
fact 14 characters are allowed. If you're contacting the NetBSD maintainers 
already, please tell them their manpage is incorrect.

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