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.
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.