Add an option to build translation tables#220
Add an option to build translation tables#220ddeclerck wants to merge 8 commits intoOCamlPro:gcos4gnucobol-3.xfrom
Conversation
a2b5ed2 to
5bd9321
Compare
GitMensch
left a comment
There was a problem hiding this comment.
overall that is already a good implementation, I think the missing pieces would be done quickly; note that --gentable should likely be referenced in gnucobol.texi where the translation tables are documented
.github/workflows/windows-msys2.yml
Outdated
| #../configure --without-db --without-curses --without-xml2 --without-json \ | ||
| # --without-iconv --disable-dependency-tracking | ||
| ../configure --without-db --without-curses --without-xml2 --without-json \ | ||
| --without-iconv --disable-dependency-tracking | ||
| --disable-dependency-tracking |
There was a problem hiding this comment.
we shouldn't adjust the CI config - as noted above this is only for generating the intermediate tarball and that must work without iconv as well
There was a problem hiding this comment.
Yeah, but as far as I remember, something was failing (don't remember what). I'll revert this change so we can check that.
There was a problem hiding this comment.
See, for MSYS2, we have undefined references to libiconv in gentable.c - although all these calls are guarded by a HAVE_ICONV ifdef. And this only fails on MSYS2...
EDIT: apparently under MSYS2 configure insists on setting HAVE_ICONV 1 in config.h...
There was a problem hiding this comment.
I guess this means that it does have iconv in glibc - which symbols are undefined during link of cobc?
There was a problem hiding this comment.
The undefined symbols are 'libiconv', 'libiconv_open' and 'libiconv_close'.
See this CI run.
There was a problem hiding this comment.
Would you have any clue about this one ?
There was a problem hiding this comment.
It seems that there's something broken in configure.ac, I'll try to have a look at this later.
There was a problem hiding this comment.
Found it, the iconv stuff is included by gettext and because of the AC_REQUIRE those parts are all done even before the conditions are run. But I've found a solution by setting the iconv cache variable to "no", in case of explicit disabled iconv (which then can break gettext, but that should be explained by configure).
fixed upstream, should work fine now on MSYS2, both --with-iconv and --without-iconv
There was a problem hiding this comment.
ebcdic500_latin1.ttbl should still be adjusted to not include code but the reference to --gentable, also it should be able to recreate that exact table using --gentable, correct? If the output is somehow better formatted/commented, then it should be adjusted in that file as if it would be generated.
There was a problem hiding this comment.
also it should be able to recreate that exact table using --gentable, correct?
Yes it is. Except that in the "manual" file we named the encodings EBCDIC 500 and Latin-1, which are not recognized by iconv - we'd need to pass IBM500,ISO-8859-1 to generate this table.
If the output is somehow better formatted/commented, then it should be adjusted in that file as if it would be generated.
Appart from the issue above, and a license text added to the "manual" file, the tables are formatted identically.
|
Note the unrelated MacOS failure - this has started to fail when they deployed a new MacOS image... EDIT: apparently |
There was a problem hiding this comment.
nearly done: the new option should be added to NEWS as new cobc option with a very short note what to use it for - you are free to directly do that in the upstream commit (note my minor changes to gentable.c); also build_windows and cobc and gnucobol.texi should get an update (possibly the Changelogs and the files touched need an update of the copyright year to 2025 as well)
... and a testcase be added (maybe just create the ebcdic500_ascii8bit.ttbl reversible/non-reversible, of course only if iconv is available)
GitMensch
left a comment
There was a problem hiding this comment.
minor change requests; note: the reversible option is definitely a good one
* allow early exit if iconv opening does not work * don't check an unsigned short for < 0
|
The test 31 should really be adjusted so it takes both the "expected" amount of line breaks and the unexpected ones, if we don't see a way to fix presumably flush not happening... Interesting msvc debug failures! |
GitMensch
left a comment
There was a problem hiding this comment.
I think everything here is fine now... as soon as the new tests pass the MSVC debug builds.
If only... |
ec18c58 to
a416afb
Compare
|
So currently we always get ret==-1 in all cases we expect and get errno set; but with MSVC debug builds we have -1 and errno not set. That does neither match the Linux manpage nor the posix definition. I'm tempted to say: revert the errno output, replacing it with a comment to the strange behaviour, and adjust the config script to not enable iconv in case of debug builds, then consider this finished and merge upstream. Possibly retry later, depending on the state of vcpkg bug microsoft/vcpkg#44698. Thoughts? |
I found a comment online (see last comment here) that this could be caused by a mix of debug and release DLLs. But I don't know, really. I guess disabling iconv for MSVC debug builds is okay for now. |
517244d to
0645017
Compare
8be6f0b to
6b973c9
Compare
|
LGTM |
|
Merged @ SVN 5470. |
|
Well done. So up to the dependency fixup next? |
Yes. |
|
Just to let you know (as the CI builds work again thanks to your test 31 adjustment): old MinGW fails with the iconv conversion and therefore the one testcase is broken:
it would be possible to check the TESTMODE and if it is set don't exit with EXIT_FAILURE but 77 (skip tests) |
That would be possible. Alternatively, we could skip the test if the command P.S: which MinGW workflow are you using ? The one we have here does not even have iconv, hence the test is just skipped. |
|
The binary and library are independent, especially as the iconv functions may be part of another library, including libc. Can you please implement the test within cobc to adjust the return code in this case? This |
|
Actually one part of the test is for checking the return code & error message when requesting an unsupported translation: Just returning 77 in testmode would skip the whole test. |
|
You're right, that's a good idea in general. I've also thought about the option that this code may just be different named, but after checking with the binary artifact - neither ibm500 nor cp500 is supported (ASCII is). |
Yeah, I was wondering about that too ; it just seems these encodings are not supported by old versions of libiconv. |
|
I'm checking that one-liner in, no need to rebase this. |
This PR adds a
-gentableoption to GnuCOBOL that allows to build EBCDIC/ASCII translation tables using iconv.It outputs the table to stdout - it is expected that users will redirect that to an acutal file.