-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
locale::conv::from_utf freezing on macOS14 and iOS17 because iconv library #206
Comments
This looks similar to #196 as it happens with IConv on macOS 14. As I don't have access to a Mac I can't test it there to see what the issue might be. It looks like Apple has changed the iconv library on macOS 14 to be incompatible with the GNU version, see e.g. https://developer.apple.com/forums/thread/739533 I'm unable to find a documentation for libiconv on macOS 14 where the behavior is specified such that it can be compare with the other iconv implementations such as for GNU So I'd need your help here:
On GNU libiconv for your input we have A workaround would be to not use iconv but ICU by disabling iconv which requires a change to the B2 build file: #207 |
In my systems: |
Thanks for testing! I've noticed that I send you the code position for the develop branch, not 1.82. I assume you tested 1.82? I'll use that below but should be trivial to adapt if not. Let me think loud:
That looks wrong. If
First: How could a third pass happen if However the So what exactly did you mean by "causes a freeze" in the initial report or that last part?:
|
My mistake, you're right. First pass is in_left=3 before, in_left=3 after, res=-1, output_count=0. |
Ah that explains the infinite loop: It continues the loop without consuming or producing anything so it will do the exact same thing over and over again. I can add a check for that (so it returns an empty string instead) but the system iconv implementation still looks broken: E2BIG should be raised if "There is not sufficient room at But we pass a valid pointer as Maybe also compare the iconv manpage on your system ( If not I can only document that "IConv on macOS 14+ is broken and should be disabled" which isn't a great solution especially as we cannot detect this easily at buildtime as the interfaces are all there. CC @artyom-beilis if he has any ideas left. |
Adding check for E2BIG is not solution because we can have more symbols after Chinese one. |
I suggest lets make trivial C example that reporduces the problem.
What I don't understand why after On first call it consumes 3 bytes and outputs one char. Next returns res = 0 - which basically means we need to exit since we are in unshifting state. I really don't understand how we get there |
I meant to add a check here if any progress was made, i.e.
@artyom-beilis See #206 (comment) The first 2 were something different. But yes a simple C code demonstrating the issue in Iconv and throwing at Apple support might be an idea. I wrote a simplified code: https://godbolt.org/z/oY6Th5Gh5 @daniboybye Can you try to compile and run that code on your system and see if that fails? If it does (which it should) please submit it to Apple support if you can. |
I confirm that this example demonstrates the problem and will add it to my report to Apple. |
Thank you. Please let us know if you get any new information.
Can you post the output or how you are sure it is exactly this problem? I.e. no input consumed ( It occured to me that on MacOS it might be using the FreeBSD version. Could you run https://godbolt.org/z/98aah1n51 (and optionally https://godbolt.org/z/14eaPefsW for the related issue) on your system and post the output please? It also contains more printed |
My output for https://godbolt.org/z/98aah1n51 E2BIG=7 Original: \E5\AE\9E line:33 Test FAILED: res == 0u line:45 Test FAILED: errno == 0 https://godbolt.org/z/14eaPefsW E2BIG=7 Original: \E2\80\A6\E2\80\A6 U+0085: \C2\85\C2\85 line:33 Test FAILED: res == 0u res: 0 line:45 Test FAILED: errno == 0 U+2026: \E2\80\A6\E2\80\A6 |
They hang indefinitely, potentially due to boostorg#206
E2BIG shall be returned if the output buffer is too small. We pass a 64 byte buffer which should be enough to do *something* However it is observed on MacOS Sonoma that iconv returns E2BIG without doing any progress leading to an infinite loop as the same inputs will be passed over and over. See boostorg#206. Instead raise an exception when this case is detected.
E2BIG shall be returned if the output buffer is too small. We pass a 64 byte buffer which should be enough to do *something* However it is observed on MacOS Sonoma that iconv returns E2BIG without doing any progress leading to an infinite loop as the same inputs will be passed over and over. See boostorg#206. Instead raise an exception when this case is detected.
It looks like this is indeed an issue with macOS 14/iOS 17 and fixed in 14.2/17.2 respectively as per d99kris/nmail#150 (comment) #218 will close this issue by throwing and exception instead of freezing when the issue is detected |
E2BIG shall be returned if the output buffer is too small. We pass a 64 byte buffer which should be enough to do *something* However it is observed on MacOS Sonoma that iconv returns E2BIG without doing any progress leading to an infinite loop as the same inputs will be passed over and over. See boostorg#206. Instead raise an exception when this case is detected.
E2BIG shall be returned if the output buffer is too small. We pass a 64 byte buffer which should be enough to do *something* However it is observed on MacOS Sonoma that iconv returns E2BIG without doing any progress leading to an infinite loop as the same inputs will be passed over and over. See boostorg#206. Instead raise an exception when this case is detected.
The text was updated successfully, but these errors were encountered: