After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 603432 - EBCDIC tests fail without iconv or ICU support
EBCDIC tests fail without iconv or ICU support
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: tests
2.7.3
Other Mac OS
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
: 680542 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-12-01 02:12 UTC by Daniel Macks
Modified: 2017-11-04 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Macks 2009-12-01 02:12:16 UTC
OS X 10.4/powerpc, trying to build libxml2-2.7.6 (note, "Version" field of bugzilla only goes up to 2.7.3). libiconv is supplied by fink. I patched libxml2 to use a custom catalog dir instead of /etc (to avoid collision of my personal build with the system official one). My existing xmllint and xsltproc are having problems, so I avoid detecting them.

XMLLINT=/usr/bin/true XSLTPROC=/usr/bin/true ./configure --prefix=/sw --mandir=/sw/share/man --with-iconv=/sw --without-python --disable-dependency-tracking --with-html-dir=/sw/share/doc --with-html-subdir=libxml2 --with-history
[no problems]

make
[some warnings but build completes]

make check
./runtest &&  ./testrecurse && ./testapi &&  ./testchar&&  ./testdict &&  ./runxmlconf
File ./test/ebcdic_566012.xml generated an error
File ./test/ebcdic_566012.xml generated an error
File ./test/ebcdic_566012.xml generated an error
Result for ./test/ebcdic_566012.xml failed
File ./test/ebcdic_566012.xml generated an error
Result for ./test/ebcdic_566012.xml failed
File ./test/ebcdic_566012.xml generated an error
Result for ./test/ebcdic_566012.xml failed
File ./test/ebcdic_566012.xml generated an error
Failed to parse ./test/ebcdic_566012.xml
File ./test/ebcdic_566012.xml generated an error
Failed to parse ./test/ebcdic_566012.xml
File ./test/ebcdic_566012.xml generated an error
Failed to parse ./test/ebcdic_566012.xml
File ./test/ebcdic_566012.xml generated an error
Failed to parse ./test/ebcdic_566012.xml
File ./test/ebcdic_566012.xml generated an error
## XML regression tests
[lots more ## tests, but no other failures]
Total 2819 tests, 10 errors, 0 leaks
make: *** [runtests] Error 1
Comment 1 Daniel Macks 2009-12-01 03:48:33 UTC
All tests passed using the same build process for 2.7.3 then broke as of 2.7.4
Comment 2 Daniel Veillard 2009-12-02 21:22:47 UTC
Of course it passes on Linux x86_64 (and i686 as far as I can tell).
Can you valgrind runtest to see if it shows something ? or try to
valgrind xmllint ./test/ebcdic_566012.xml

  This is OS specific, as far as I can tell it's not available
freely for my platform and I have no way to test it, so I rely
on you to pursue the issue.
  The test was added in 2.7.4 IIRC so it's not a regression.
 
Daniel
Comment 3 Daniel Macks 2009-12-03 04:32:02 UTC
% ./xmllint test/ebcdic_566012.xml
test/ebcdic_566012.xml:1: parser error : encoding not supported EBCDIC

Well that's a pretty good reason for the test of ebcdic parsing to fail. Where in the code is a place this encoding could get disabled? Or is it delegated to some external component?
Comment 4 Daniel Veillard 2009-12-03 11:04:52 UTC
It's delegated to iconv, weird ... though there is a lot of different
flavours of EBCDIC encoding, which is one of the problem the patches and
tests tried to check.

Daniel
Comment 5 Daniel Macks 2009-12-06 21:23:50 UTC
Same results when building with either OS X 10.4's libiconv (1.9) or with fink's (1.12) and also with xmllint from OS X 10.4 itself. I dove into encoding.c a bit, and see that xmlGetCharEncodingHandler is calling xmlFindCharEncodingHandler with each of three variants of the ebcdic encoding name ("EBCDIC", "ebcdic", "EBCDIC-US"). Side note, given that xmlFindCharEncodingHandler does case-insensitive testing, does xmlGetCharEncodingHandler really need to try separately with lc and uc forms?

In xmlFindCharEncodingHandler, no suitable handlers are found, and then iconv_open is failing (icv_in==-1 and icv_out==-1 even after trying name and upper. iconv and charset encoding is apparently "nonstandard" on darwin. My system /usr/lib/charset.alias has no entries and fink doesn't even install one because someone said darwin doesn't use it properly anyway.
Comment 6 Daniel Macks 2009-12-07 03:36:52 UTC
libiconv-1.13.1 is latest release, and the only mention of ebcdic is in its NOTES file:

Q: Support EBCDIC ?
A: No!


d'oh:(
Comment 7 Daniel Macks 2009-12-08 08:01:21 UTC
Seems like libiconv EBCDIC support is only implemented in glibc's onboard iconv

http://sourceware.org/ml/libc-ports/2007-09/msg00006.html

whereas the standalone GNU libiconv does not support it, does not intend to support it, and does not have an open plugin mechanism by which third-party could supply an implementation. Maybe libxml2 might need a --disable-ebcdic configure flag? Or if there an autoconf test that can distinguish GNU libiconv from glibc iconv, that could at least disable the self-test that is apparently a hopeless case on that type of platform?
Comment 8 David Kilzer 2016-04-05 14:44:30 UTC
This appears to be a 32-bit vs. 64-bit issue, and apparently only affects test/ebcdic_566012.xml.

I can still reproduce these errors with "make check" if I force libxml2.dylib (and xmlllint) to run in 32-bit on Intel hardware (i386 architecture).
Comment 9 David Kilzer 2016-04-17 04:03:28 UTC
(In reply to David Kilzer from comment #8)
> This appears to be a 32-bit vs. 64-bit issue, and apparently only affects
> test/ebcdic_566012.xml.
> 
> I can still reproduce these errors with "make check" if I force
> libxml2.dylib (and xmlllint) to run in 32-bit on Intel hardware (i386
> architecture).

I am wrong.  This is the difference between using iconv vs. ICU for encoding support with libxml2.  The version of libxml2 that ships with OS X is compiled to use ICU, not iconv, and ICU supports the EBCDIC encodings (while iconv does not).

I made the mistake of compiling my 32-bit binaries without specifying --with-icu, thereby causing this bug to appear while I was testing.
Comment 10 David Kilzer 2016-04-17 04:04:54 UTC
I think this can be closed as "RESOLVED INVALID" (or whatever the moral equivalent of "Behaves Correctly" is).

If you want EBCDIC support, configure libxml2 --with-icu instead of --with-iconv on Mac OS X.
Comment 11 Nick Wellnhofer 2017-06-08 11:43:37 UTC
Ideally, the tests should be skipped if there's no EBCDIC support. This has bugged me for quite some time when developing on OS X.
Comment 12 Nick Wellnhofer 2017-06-08 12:33:31 UTC
*** Bug 680542 has been marked as a duplicate of this bug. ***