Thread: BUG #13898: ecpg complains on nested comments in /usr/pgsql-9.4/include/informix/esql/datetime.h

BUG #13898: ecpg complains on nested comments in /usr/pgsql-9.4/include/informix/esql/datetime.h

From
vladimir.zvagolskiy@nasdaq.com
Date:
The following bug has been logged on the website:

Bug reference:      13898
Logged by:          vladimir zvagolskiy
Email address:      vladimir.zvagolskiy@nasdaq.com
PostgreSQL version: 9.4.5
Operating system:   Centos 7.1
Description:

Hi guys,

We experience a ecpg build issue for INFORMIX dialect:

[vlzv@inetlinux10 ecpg_9.4_issue]$ cat simple.ec
EXEC SQL include datetime;


[vlzv@inetlinux10 ecpg_9.4_issue]$ /usr/pgsql-9.4/bin/ecpg -C INFORMIX -I
/usr/pgsql-9.4/include/informix/esql simple.ec
/usr/pgsql-9.4/include/informix/esql/datetime.h:9: ERROR: nested /* ... */
comments

[vlzv@inetlinux10 ecpg_9.4_issue]$ rpm -qf
/usr/pgsql-9.4/include/informix/esql/datetime.h
postgresql94-devel-9.4.5-1PGDG.rhel7.x86_64


once I modify datetime.h file as per below diff, the issue disappears.
[vlzv@inetlinux10 ecpg_9.4_issue]$ cat -n
/usr/pgsql-9.4/include/informix/esql/datetime.h
     1  /* src/interfaces/ecpg/include/datetime.h */
     2
     3  #ifndef _ECPG_DATETIME_H
     4  #define _ECPG_DATETIME_H
     5
     6  #include <ecpg_informix.h>
     7
     8  #ifndef _ECPGLIB_H                              /* source created by
ecpg which defines thes
     9                                                                   /*
symbols */
    10  typedef timestamp dtime_t;
    11  typedef interval intrvl_t;
    12  #endif   /* ndef _ECPGLIB_H */
    13
    14  #endif   /* ndef _ECPG_DATETIME_H */

[vlzv@inetlinux10 ecpg_9.4_issue]$ diff
/usr/pgsql-9.4/include/informix/esql/datetime.h
/usr/pgsql-9.4/include/informix/esql/datetime.h.orig
9c9
<                                                                /* symbols
*/
---
>                                                                * symbols
*/


[vlzv@inetlinux10 ecpg_9.4_issue]$ /usr/pgsql-9.4/bin/ecpg -C INFORMIX -I
/usr/pgsql-9.4/include/informix/esql simple.ec
[vlzv@inetlinux10 ecpg_9.4_issue]$ ls -l ./simple.c
-rw-rw-r-- 1 vlzv vlzv 700 Jan 29 11:15 ./simple.c
> once I modify datetime.h file as per below diff, the issue
> disappears.
> 
> [vlzv@inetlinux10 ecpg_9.4_issue]$ diff
> /usr/pgsql-9.4/include/informix/esql/datetime.h
> /usr/pgsql-9.4/include/informix/esql/datetime.h.orig
> 9c9
>
<                                                                /*
> symbols
> */
> ---
> >
                                                               *
> > symbols
> */
>

I'm a bit confused. My 9.4.5 source tree does not show a "/*" in line
9, but only a "*", or in other words the patch you applied seems to
only bring your source back to what originally was in 9.4.5.

What do I miss here?

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL
On Sun, Jan 31, 2016 at 10:23:39PM +0000, Vladimir Zvagolskiy wrote:
> Sorry for being confusing with this.
> You're right, I've modified the file manually by putting "/" in front of "*" on line 9, and then made a diff.
> *.orig is the original file as you have it in your 9.4.5 sources tree.

I.e. you don't see the nested comments problem with 9.4.5 sources either, right?

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
On Mon, Feb 01, 2016 at 08:59:17AM +0000, Vladimir Zvagolskiy wrote:
> No, I do see problems with 9.3.5.

Any reason why you're on 9.3.5 and not a later 9.3 version?

> Until I've done the described modification in datetime.h

Anyway, I cannot see a nested comment in that version either. Could you send a small test case to reproduce? Thanks.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
Michael Meskes <meskes@postgresql.org> writes:
> On Mon, Feb 01, 2016 at 08:59:17AM +0000, Vladimir Zvagolskiy wrote:
>> Until I've done the described modification in datetime.h

> Anyway, I cannot see a nested comment in that version either. Could you send a small test case to reproduce? Thanks.

It seems a bit fishy that the comment in question starts on an #if line
and ends on an ordinary line.  I am not sure what the C standard says
about such cases, but I can certainly imagine that some tools might not
be very happy with that.

It looks like that code was last touched by pgindent in d747140279426607:

-#ifndef _ECPGLIB_H /* source created by ecpg which defines these symbols */
+#ifndef _ECPGLIB_H             /* source created by ecpg which defines these
+                                * symbols */

Perhaps that was a bad change, and you should make it look like

/* helpful comment here */
#ifndef _ECPGLIB_H

            regards, tom lane
On Mon, Feb 01, 2016 at 10:56:44AM +0100, Tom Lane wrote:
> It seems a bit fishy that the comment in question starts on an #if line
> and ends on an ordinary line.  I am not sure what the C standard says
> about such cases, but I can certainly imagine that some tools might not
> be very happy with that.

Very good catch. Vladimir, which compiler are you using?

> It looks like that code was last touched by pgindent in d747140279426607:

Let me guess, pg_indent?

It sure looks like it.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
On Mon, Feb 01, 2016 at 10:56:44AM +0100, Tom Lane wrote:
> It seems a bit fishy that the comment in question starts on an #if line
> and ends on an ordinary line.  I am not sure what the C standard says
> about such cases, but I can certainly imagine that some tools might not
> be very happy with that.

It turns out ecpg is one of these tools. Lines starting with #<whatever> are
considered CPP code and not parsed for C language comments. In the C code it
then finds only the end of the comment and throws the error.

It does surprise me, though, that the error only pops up now. I was pretty sure
at least one of these headers was used in the regression suit.

Will fix.

Thanks.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
> and ends on an ordinary line.  I am not sure what the C standard says
> about such cases, but I can certainly imagine that some tools might not
> be very happy with that.

We/I have to figure out what the standard says, because if it allows these comments, the lexer itself has to be fixed
towork correctly instead of just fixing the header files. 

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
SGkgTWljaGFlbCwNCg0KU29ycnkgZm9yIGJlaW5nIGNvbmZ1c2luZyB3aXRoIHRoaXMuDQpZb3Un
cmUgcmlnaHQsIEkndmUgbW9kaWZpZWQgdGhlIGZpbGUgbWFudWFsbHkgYnkgcHV0dGluZyAiLyIg
aW4gZnJvbnQgb2YgIioiIG9uIGxpbmUgOSwgYW5kIHRoZW4gbWFkZSBhIGRpZmYuDQoqLm9yaWcg
aXMgdGhlIG9yaWdpbmFsIGZpbGUgYXMgeW91IGhhdmUgaXQgaW4geW91ciA5LjQuNSBzb3VyY2Vz
IHRyZWUuDQoNClRoYW5rcyENCg0KQ2hlZXJzLA0KVmxhZA0KDQotLS0tLU9yaWdpbmFsIE1lc3Nh
Z2UtLS0tLQ0KRnJvbTogTWljaGFlbCBNZXNrZXMgW21haWx0bzptZXNrZXNAcG9zdGdyZXNxbC5v
cmddIA0KU2VudDogU2F0dXJkYXksIDMwIEphbnVhcnkgMjAxNiAxMTowMiBQTQ0KVG86IHBnc3Fs
LWJ1Z3NAcG9zdGdyZXNxbC5vcmcNCkNjOiBWbGFkaW1pciBadmFnb2xza2l5IDxWbGFkaW1pci5a
dmFnb2xza2l5QG5hc2RhcS5jb20+DQpTdWJqZWN0OiBSZTogW0JVR1NdIEJVRyAjMTM4OTg6IGVj
cGcgY29tcGxhaW5zIG9uIG5l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VNRTA0K
DQoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKg0KQ09ORklERU5USUFMSVRZIE5PVElDRTogVGhpcyBlLW1haWwgYW5kIGFueSBhdHRhY2ht
ZW50cyBhcmUgZm9yIHRoZSBleGNsdXNpdmUgYW5kIGNvbmZpZGVudGlhbCB1c2Ugb2YgdGhlIGlu
dGVuZGVkIHJlY2lwaWVudCBhbmQgbWF5IGNvbnN0aXR1dGUgbm9uLXB1YmxpYyBpbmZvcm1hdGlv
bi4gSWYgeW91IHJlY2VpdmVkIHRoaXMgZS1tYWlsIGluIGVycm9yLCBkaXNjbG9zaW5nLCBjb3B5
aW5nLCBkaXN0cmlidXRpbmcgb3IgdGFraW5nIGFueSBhY3Rpb24gaW4gcmVsaWFuY2Ugb2YgdGhp
cyBlLW1haWwgaXMgc3RyaWN0bHkgcHJvaGliaXRlZCBhbmQgbWF5IGJlIHVubGF3ZnVsLiBJbnN0
ZWFkLCBwbGVhc2Ugbm90aWZ5IHVzIGltbWVkaWF0ZWx5IGJ5IHJldHVybiBlLW1haWwgYW5kIHBy
b21wdGx5IGRlbGV0ZSB0aGlzIG1lc3NhZ2UgYW5kIGl0cyBhdHRhY2htZW50cyBmcm9tIHlvdXIg
Y29tcHV0ZXIgc3lzdGVtLiBXZSBkbyBub3Qgd2FpdmUgYW55IHdvcmsgcHJvZHVjdCBvciBvdGhl
ciBhcHBsaWNhYmxlIGxlZ2FsIHByaXZpbGVnZShzKSBieSB0aGUgdHJhbnNtaXNzaW9uIG9mIHRo
aXMgbWVzc2FnZS4NCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqCg==
On 2016-02-01 13:16:20 +0100, Michael Meskes wrote:
> > and ends on an ordinary line.  I am not sure what the C standard says
> > about such cases, but I can certainly imagine that some tools might not
> > be very happy with that.
>=20
> We/I have to figure out what the standard says, because if it allows
> these comments, the lexer itself has to be fixed to work correctly
> instead of just fixing the header files.

The relevant translation phases are 3 and 4 according to the C standard
(section 5.1.1.2 in C11):

| 3. The source file is decomposed into preprocessing tokens7) and
|    sequences of white-space characters (including comments). A source
|    file shall not end in a partial preprocessing token or in a partial
|    comment. Each comment is replaced by one space character. New-line
|    characters are retained. Whether each nonempty sequence of
|    white-space characters other than new-line is retained or replaced
|    by one space character is implementation-defined.
|
| 4. Preprocessing directives are executed, macro invocations are
|    expanded, and _Pragma unary operator expressions are executed. If a
|    character sequence that matches the syntax of a universal character
|    name is produced by token concatenation (6.10.3.3), the behavior is
|    undefined. A #include preprocessing directive causes the named
|    header or source file to be processed from phase 1 through phase 4,
|    recursively. All preprocessing directives are then deleted.

Comments are replaced with whitespace in phase 3, preprocessing
directives are are only considered in phase 4. So code like=20

----------------------------------------------------------------------------
#ifndef _ECPGLIB_H             /* source created by ecpg which defines thes=
e=E2=90=A4
                                * symbols */=E2=90=A4
----------------------------------------------------------------------------

is valid C and should be exactly equivalent to

----------------------------------------------------------------------------
#ifndef _ECPGLIB_H              =E2=90=A4
=E2=90=A4
----------------------------------------------------------------------------

(=E2=90=A4 denotes a newline character here)

    hp

--=20
   _  | Peter J. Holzer    | I want to forget all about both belts and
|_|_) |                    | suspenders; instead, I want to buy pants=20
| |   | hjp@hjp.at         | that actually fit.
__/   | http://www.hjp.at/ |   -- http://noncombatant.org/