From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Bugs in ecpg's macro mechanism |
Date: | 2024-04-15 21:48:32 |
Message-ID: | 998011.1713217712@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I started looking into the ideas discussed at [1] about reimplementing
ecpg's string handling. Before I could make any progress I needed
to understand the existing input code, part of which is the macro
expansion mechanism ... and the more I looked at that the more bugs
I found, not to mention that it uses misleading field names and is
next door to uncommented. I found two ways to crash ecpg outright
and several more cases in which it'd produce surprising behavior.
As an example,
$ cd .../src/interfaces/ecpg/test/preproc/
$ ../../preproc/ecpg --regression -I./../../include -I. -DNAMELEN=99 -o define.c define.pgc
munmap_chunk(): invalid pointer
Aborted
Attached is a patch that cleans all that up and attempts to add a
little documentation about how things work. One thing it's missing
is any test of the behavior when command-line macro definitions are
carried from one file to the next one. To test that, we'd need to
compile more than one ecpg input file at a time. I can see how
to kluge the Makefiles to make that happen, basically this'd do:
define.c: define.pgc $(ECPG_TEST_DEPENDENCIES)
- $(ECPG) -DCMDLINESYM=123 -o $@ $<
+ $(ECPG) -DCMDLINESYM=123 -o $@ $< $<
But I have no idea about making it work in meson. Any suggestions?
regards, tom lane
[1] https://www.postgresql.org/message-id/3897526.1712710536%40sss.pgh.pa.us
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-assorted-bugs-in-ecpg-s-macro-mechanism.patch | text/x-diff | 19.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2024-04-15 22:06:26 | Re: Things I don't like about \du's "Attributes" column |
Previous Message | Joel Jacobson | 2024-04-15 21:33:01 | Optimize numeric.c mul_var() using the Karatsuba algorithm |