Issue 8056 - [PATCH] libdb version is not detected correctly when using gcc5
Summary: [PATCH] libdb version is not detected correctly when using gcc5
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: build (show other issues)
Version: 2.4.40
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-11 09:48 UTC by jsynacek@redhat.com
Modified: 2015-08-18 17:41 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 jsynacek@redhat.com 2015-02-11 09:48:16 UTC
Full_Name: Jan Synacek
Version: 2.4.40
OS: GNU/Linux
URL: https://jsynacek.fedorapeople.org/openldap/jsynacek-20150211-fix-libdb-detection-with-gcc-5.patch
Submission from: (NULL) (94.112.188.81)


The old cpp version generated:
__db_version 5

Configure then correctly picked up the version, since it greps for
"__db_version".

The new output:
__db_version
            5

Grepping no longer works and configure fails.

Running cpp with -P (inhibit linemarkers generation) fixes this when using gcc
5.
Behavior with older versions of gcc is not changed.
Comment 1 Howard Chu 2015-02-11 13:25:50 UTC
jsynacek@redhat.com wrote:
> Full_Name: Jan Synacek
> Version: 2.4.40
> OS: GNU/Linux
> URL: https://jsynacek.fedorapeople.org/openldap/jsynacek-20150211-fix-libdb-detection-with-gcc-5.patch
> Submission from: (NULL) (94.112.188.81)
>
>
> The old cpp version generated:
> __db_version 5
>
> Configure then correctly picked up the version, since it greps for
> "__db_version".
>
> The new output:
> __db_version
>              5
>
> Grepping no longer works and configure fails.
>
> Running cpp with -P (inhibit linemarkers generation) fixes this when using gcc
> 5.
> Behavior with older versions of gcc is not changed.

Your patch is simple enough but frankly this sounds like a bug in gcc 
5's cpp. It shouldn't be inserting gratuitous whitespace in the middle 
of lines, or inserting line breaks arbitrarily.

-- 
   -- 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 jsynacek@redhat.com 2015-02-11 14:24:31 UTC
Howard Chu <hyc@symas.com> writes:
> jsynacek@redhat.com wrote:
>> Full_Name: Jan Synacek
>> Version: 2.4.40
>> OS: GNU/Linux
>> URL: https://jsynacek.fedorapeople.org/openldap/jsynacek-20150211-fix-libdb-detection-with-gcc-5.patch
>> Submission from: (NULL) (94.112.188.81)
>>
>>
>> The old cpp version generated:
>> __db_version 5
>>
>> Configure then correctly picked up the version, since it greps for
>> "__db_version".
>>
>> The new output:
>> __db_version
>>              5
>>
>> Grepping no longer works and configure fails.
>>
>> Running cpp with -P (inhibit linemarkers generation) fixes this when using gcc
>> 5.
>> Behavior with older versions of gcc is not changed.
>
> Your patch is simple enough but frankly this sounds like a bug in gcc 
> 5's cpp. It shouldn't be inserting gratuitous whitespace in the middle 
> of lines, or inserting line breaks arbitrarily.

Yes, probably. But in the meantime, I needed the package to build, so I
wrote this patch.

Cheers,
-- 
Jan Synacek
Software Engineer, Red Hat
Comment 3 Howard Chu 2015-02-11 19:48:53 UTC
Jan Synacek wrote:
> Howard Chu <hyc@symas.com> writes:
>> jsynacek@redhat.com wrote:
>>> Full_Name: Jan Synacek
>>> Version: 2.4.40
>>> OS: GNU/Linux
>>> URL: https://jsynacek.fedorapeople.org/openldap/jsynacek-20150211-fix-libdb-detection-with-gcc-5.patch
>>> Submission from: (NULL) (94.112.188.81)
>>>
>>>
>>> The old cpp version generated:
>>> __db_version 5
>>>
>>> Configure then correctly picked up the version, since it greps for
>>> "__db_version".
>>>
>>> The new output:
>>> __db_version
>>>               5
>>>
>>> Grepping no longer works and configure fails.
>>>
>>> Running cpp with -P (inhibit linemarkers generation) fixes this when using gcc
>>> 5.
>>> Behavior with older versions of gcc is not changed.
>>
>> Your patch is simple enough but frankly this sounds like a bug in gcc
>> 5's cpp. It shouldn't be inserting gratuitous whitespace in the middle
>> of lines, or inserting line breaks arbitrarily.
>
> Yes, probably. But in the meantime, I needed the package to build, so I
> wrote this patch.

Please file a bug with the gcc project and followup here with a link to 
that bug, for future reference. Thanks.

Adding this patch to git master.

-- 
   -- 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 4 Howard Chu 2015-02-11 19:50:15 UTC
changed notes
changed state Open to Test
moved from Incoming to Build
Comment 5 Quanah Gibson-Mount 2015-02-11 20:21:48 UTC
changed notes
changed state Test to Release
Comment 6 Hallvard Furuseth 2015-02-11 21:53:56 UTC
On 11/02/15 14:25, hyc@symas.com wrote:
> Your patch is simple enough but frankly this sounds like a bug in gcc
> 5's cpp. It shouldn't be inserting gratuitous whitespace in the middle
> of lines, or inserting line breaks arbitrarily.

Not a gcc bug, the ITS report proved incomplete. gcc-5 inserts
"# <file information>" lines (indicating where the macro
expansion comes from, I think), so it needs the line breaks.

This slightly different test program:

#include <db.h>
__db_version DB_VERSION_MAJOR+0000;

...produces this:

# 2 "test.c"
__db_version
# 2 "test.c" 3 4
             4
# 2 "test.c"
                             +0000;

-- 
Hallvard



Comment 7 jsynacek@redhat.com 2015-02-12 08:34:31 UTC
Howard Chu <hyc@symas.com> writes:
> Jan Synacek wrote:
>> Howard Chu <hyc@symas.com> writes:
>>> jsynacek@redhat.com wrote:
>>>> Full_Name: Jan Synacek
>>>> Version: 2.4.40
>>>> OS: GNU/Linux
>>>> URL: https://jsynacek.fedorapeople.org/openldap/jsynacek-20150211-fix-libdb-detection-with-gcc-5.patch
>>>> Submission from: (NULL) (94.112.188.81)
>>>>
>>>>
>>>> The old cpp version generated:
>>>> __db_version 5
>>>>
>>>> Configure then correctly picked up the version, since it greps for
>>>> "__db_version".
>>>>
>>>> The new output:
>>>> __db_version
>>>>               5
>>>>
>>>> Grepping no longer works and configure fails.
>>>>
>>>> Running cpp with -P (inhibit linemarkers generation) fixes this when using gcc
>>>> 5.
>>>> Behavior with older versions of gcc is not changed.
>>>
>>> Your patch is simple enough but frankly this sounds like a bug in gcc
>>> 5's cpp. It shouldn't be inserting gratuitous whitespace in the middle
>>> of lines, or inserting line breaks arbitrarily.
>>
>> Yes, probably. But in the meantime, I needed the package to build, so I
>> wrote this patch.
>
> Please file a bug with the gcc project and followup here with a link to 
> that bug, for future reference. Thanks.

Filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65037.

> Adding this patch to git master.

Thank you,
-- 
Jan Synacek
Software Engineer, Red Hat
Comment 8 Quanah Gibson-Mount 2015-07-02 17:42:51 UTC
changed notes
changed state Release to Closed
Comment 9 Quanah Gibson-Mount 2015-07-06 16:30:15 UTC
changed notes
changed state Closed to Release
Comment 10 OpenLDAP project 2015-08-18 17:41:09 UTC
fixed in master
fixed in RE25
fixed in RE24 (2.4.42)
Comment 11 Quanah Gibson-Mount 2015-08-18 17:41:09 UTC
changed notes
changed state Release to Closed