Issue 6534 - bad ifdef/elif clause in liblutil
Summary: bad ifdef/elif clause in liblutil
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.21
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-26 15:10 UTC by Quanah Gibson-Mount
Modified: 2014-08-01 21:03 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 Quanah Gibson-Mount 2010-04-26 15:10:21 UTC
Full_Name: Quanah Gibson-Mount
Version: 2.4.21
OS: NA
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (75.111.45.108)


The following if/elif clause in liblutil is wrong:

#ifdef HAVE_SETSID
                (void) setsid();
#elif TIOCNOTTY
                if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
                        (void) ioctl( sd, TIOCNOTTY, NULL );
                        (void) close( sd );
                }
#endif


The elif should be

#elif defined(TIOCNOTTY)
Comment 1 Quanah Gibson-Mount 2010-04-29 15:31:19 UTC
--On Monday, April 26, 2010 3:10 PM +0000 quanah@OpenLDAP.org wrote:

> Full_Name: Quanah Gibson-Mount
> Version: 2.4.21
> OS: NA
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (75.111.45.108)
>
>
> The following if/elif clause in liblutil is wrong:

Actually, the issue seems to be name changes in the header files under BSD. 
This causes TIOCNOTTY to end up being undefined.

Here's the header information:

kibi@kbsd:~$ grep TIOCNOTTY /usr/include/ -r
/usr/include/sys/ttycom.h:#define	  TIOCNOTTY	 _IO('t', 113)		/* void tty 
association */

kibi@kbsd:~$ grep ttycom.h -r /usr/include/
/usr/include/sys/tty.h:#include <sys/ttycom.h>
/usr/include/bits/ioctls.h:#include <sys/ttycom.h>


So we either need <bits/ioctls.h> or <sys/ttycom.h> to be included on this 
particular platform.  My guess is the latter would be most appropriate.

--Quanah


--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Comment 2 Hallvard Furuseth 2010-04-30 13:23:08 UTC
quanah@zimbra.com writes:
> Actually, the issue seems to be name changes in the header files under BSD. 
> This causes TIOCNOTTY to end up being undefined.

That would not give the error message shown in
<http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg776021.html>:

build/buildd-openldap_2.4.21-1-kfreebsd-amd64-VWAqZY/openldap-2.4.21/libraries/liblutil/detach.c:131:7:
 error: missing binary operator before token "long"

Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
undefined, it'd just evaluate to #elif 0.  So my guess is that TIOCNOTTY
somewhere is defined to expand to an expression involving a (long) cast.

-- 
Hallvard

Comment 3 Quanah Gibson-Mount 2010-05-25 18:36:05 UTC
--On Friday, April 30, 2010 1:23 PM +0000 h.b.furuseth@usit.uio.no wrote:

> quanah@zimbra.com writes:
>> Actually, the issue seems to be name changes in the header files under
>> BSD.  This causes TIOCNOTTY to end up being undefined.
>
> That would not give the error message shown in
> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg776021.
> html>:
>
> build/buildd-openldap_2.4.21-1-kfreebsd-amd64-VWAqZY/openldap-2.4.21/libr
> aries/liblutil/detach.c:131:7:  error: missing binary operator before
> token "long"
>
> Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
> undefined, it'd just evaluate to #elif 0.  So my guess is that TIOCNOTTY
> somewhere is defined to expand to an expression involving a (long) cast.

Apprently so.

<http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg785259.html>

--Quanah


--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Comment 4 Quanah Gibson-Mount 2010-07-12 13:51:50 UTC
changed notes
changed state Open to Closed
Comment 5 Quanah Gibson-Mount 2010-07-22 17:46:12 UTC
--On Tuesday, May 25, 2010 6:37 PM +0000 quanah@zimbra.com wrote:

> --On Friday, April 30, 2010 1:23 PM +0000 h.b.furuseth@usit.uio.no wrote:
>
>> quanah@zimbra.com writes:
>>> Actually, the issue seems to be name changes in the header files under
>>> BSD.  This causes TIOCNOTTY to end up being undefined.
>>
>> That would not give the error message shown in
>> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg776021.
>> html>:
>>
>> build/buildd-openldap_2.4.21-1-kfreebsd-amd64-VWAqZY/openldap-2.4.21/libr
>> aries/liblutil/detach.c:131:7:  error: missing binary operator before
>> token "long"
>>
>> Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
>> undefined, it'd just evaluate to #elif 0.  So my guess is that TIOCNOTTY
>> somewhere is defined to expand to an expression involving a (long) cast.
>
> Apprently so.
>
> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg785259.
> html>

Fixed by debian.

--Quanah


--

Quanah Gibson-Mount
Principal Software Engineer
Zimbra, Inc
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Comment 6 Hallvard Furuseth 2010-07-26 15:36:39 UTC
quanah@zimbra.com writes:
>>> Line 131 is "#elif TIOCNOTTY".  There's no 'long' there is TIOCNOTTY is
>>> undefined, it'd just evaluate to #elif 0.  So my guess is that TIOCNOTTY
>>> somewhere is defined to expand to an expression involving a (long) cast.
>>
>> Apprently so.
>>
>> <http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg785259.
>> html>
> 
> Fixed by debian.

Which is nice, but doesn't help with older debian versions.
I don't see what's wrong with changing our #elif to #elif defined
like you originally suggested, though I remember there was some
confused #elif discussion earlier.

-- 
Hallvard

Comment 7 Martin Matuska 2011-03-20 21:21:00 UTC
This problem is a generic problem of gcc version 4.4 and later.

The new behaviour documented by GCC:
http://gcc.gnu.org/gcc-4.4/porting_to.html

I recommend importing the patch from
http://www.openldap.org/its/index.cgi/Build?id=6832

More information:
http://www.cyrius.com/journal/gcc/gcc-4.4-preprocessor-errors
http://gcc.gnu.org/viewcvs?view=revision&revision=136209

Comment 8 Howard Chu 2011-03-21 06:32:41 UTC
mm@FreeBSD.org wrote:
> This problem is a generic problem of gcc version 4.4 and later.

You're replying to a closed ITS. Not much point to that.

> The new behaviour documented by GCC:
> http://gcc.gnu.org/gcc-4.4/porting_to.html
>
> I recommend importing the patch from
> http://www.openldap.org/its/index.cgi/Build?id=6832

The patch from ITS#6832 is already in CVS. That's what the "fixed in HEAD" 
status means. There's really nothing left to say or do here.

> More information:
> http://www.cyrius.com/journal/gcc/gcc-4.4-preprocessor-errors
> http://gcc.gnu.org/viewcvs?view=revision&revision=136209

-- 
   -- 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 9 OpenLDAP project 2014-08-01 21:03:44 UTC
Fixed by Debian, closing