adjustment and workaround for macOS iconv #805
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Intended to address #797.
History note: the iconv library in macOS 14.0 was especially broken. By 14.2.1, it has been mostly fixed, but I think the Chez Scheme test suite uncovers a remaining problem. That problem persists in 14.3.1.
The two different failing cases have different reasons:
The test at line 1004 fails because iconv encodes a BOM to UTF-8 as 0 bytes. That's arguably correct behavior (a BOM encoding isn't supposed to appear in UTF-8), and the test suite can accommodate it by just avoiding a BOM.
The test at line 710 fails due to behavior that seems to be a lingering bug in iconv, where the library incorrectly reports too little decoding success (by not advancing the output pointer) than it should when failing to convert a lambda character to a Chinese encoding. The commit here works around that by not trusting the pointer advances when an a specific error is reported. Unless I have it wrong, the change is ok for a working iconv, too, in part due to the way the workaround is specific to an
E2BIG
result.I'm not sure the bug-workaround change is a good idea. Workarounds for OS bugs are sometimes necessary, but it's usually easier to get a sense of the bug's extent so that a workaround feels worthwhile. This workaround is fairly specific to a random corner of a library, and I can't help thinking there are likely other random corners with bugs. Still, I lean toward having the workaround, for now. An alternative is to disable the failing test on macOS.