Re: ECPG cleanup and fix for clang compile-time problem
Tom Lane <tgl@sss.pgh.pa.us>
Alexander Lakhin <exclusion@gmail.com> writes:
> I've spent a day testing ecpg preprocessor and found another couple of
> bugs:
Thanks for the report! The first couple of these seem simple
enough to fix, so I've done so. As for
> Also, processing of .../ecpg/test/sql/include.pgc, containing only:
> EXEC SQL INCLUDE ../sql;
> emits merely:
> input in flex scanner failed
what we have here is an attempt to read a directory. On Linux
it seems that fopen() is okay with that but then fread() fails
with EISDIR. The fread() occurs in code emitted by flex that
is totally failing to produce a useful error report:
while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, base_yyin)) == 0 && ferror(base_yyin)) \
{ \
if( errno != EINTR) \
{ \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \
} \
It looks like YY_FATAL_ERROR can only accept a literal string,
so I can see why this isn't including strerror(errno), but still
I'd say that this is their poor error reporting not ours. The
only thing we could really do about it is fstat the fopen's FD
and see if it's a directory, but that would only improve matters
for EISDIR not any other error cause. I don't believe we've done
that anywhere else we use flex, so I'm not inclined to do it here.
> I think that's all that can be found here without extra efforts.
Thanks for poking at it! I don't feel a huge need to search out
ecpg bugs in advance of field reports, but we might as well fix
things we do stumble across.
regards, tom lane
Commits
-
ecpg: clean up some other assorted memory leaks.
- 2b41de4a5b42 18.0 landed
-
ecpg: fix some memory leakage of data-type-related structures.
- 0e6060790d65 18.0 landed
-
ecpg: put all string-valued tokens returned by pgc.l in local storage.
- 85312d95e959 18.0 landed
-
ecpg: fix more minor mishandling of bad input in preprocessor.
- 1fed234f9faf 18.0 landed
-
ecpg: fix some minor mishandling of bad input in preprocessor.
- 9b4bf5169064 18.0 landed
-
ecpg: avoid breaking the IDENT precedence level in two.
- 9812138593f3 18.0 landed
-
ecpg: improve preprocessor's memory management.
- 1acd0f55274f 18.0 landed
-
ecpg: move some functions into a new file ecpg/preproc/util.c.
- f18231e81759 18.0 landed
-
ecpg: re-implement preprocessor's string management.
- a542d5614bdb 18.0 landed
-
ecpg: major cleanup, simplification, and documentation of parse.pl.
- 6b0054994475 18.0 landed
-
ecpg: remove check_rules.pl.
- 293fd24425b5 18.0 landed
-
ecpg: clean up documentation of parse.pl, and add more input checking.
- 00b0e7204d53 18.0 landed
-
Clean up indentation and whitespace inconsistencies in ecpg.
- 97add39c038b 18.0 landed
-
Exclude flex-generated code from coverage testing
- 421167362242 11.0 cited