You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JRuby builds on Windows have been disabled in CI since #521. The extension appears to build fine now on Windows, but fails a few tests that check for Windows newlines. The failures are in tests test_generate_custom, test_generate_pretty, and test_generate_pretty and look generally like this:
Ok, it looks like this is happening if you clone on windows with the option for git to replace \n with \r\n, the heredoc gets \r\n newlines and thus fails.
CRuby appears to convert \r\n to \n when reading a file, hence why it passes.
@danini-the-panini Good sleuthing! So where are these \r coming from exactly? The reproduction I provided should only be dumping code... how are \r characters getting into that?
the issue is that the test file has \r\n in it. the generate method is correctly outputting only \n but the HEREDOC has \r\n on JRuby on Window, hence the failure. (You can see that the expected output is the one with the CRLF)
So basically my repro does show the problem... we're not emitting Windows line terminators in some case used by the json dumping logic.
I'm assuming that the CRuby CI is checking out the code exactly the same way (with Windows line terminators) so that's not really the bug. The bug is that we don't end up matching those line terminators.
I tried looking into this but I was unable to get ragel to work properly on Windows to generate the JRuby parsers. Confusingly, the CI jobs don't appear to run ragel at all.
I managed to force ragel to run sufficiently to get the build to work, and I've narrowed down the problem.
I believe it's an issue in JRuby's parser, whereby we do not convert \r\n to \n. The outputting of \n for newlines in json is correct in the JRuby extension.
This was after all a JRuby issue (jruby/jruby#9018) and was fixed there (jruby/jruby#9019). I've already updated the json CI matrix to include windows-latest with jruby-head (#868).
Activity
headius commentedon Sep 20, 2025
Short repro script based on
test_generate_custom:I'm looking into it a little bit but it's hard to figure out at the moment without a Windows box for testing.
danini-the-panini commentedon Sep 20, 2025
Ok, it looks like this is happening if you clone on windows with the option for git to replace
\nwith\r\n, the heredoc gets\r\nnewlines and thus fails.CRuby appears to convert
\r\nto\nwhen reading a file, hence why it passes.headius commentedon Sep 20, 2025
@danini-the-panini Good sleuthing! So where are these
\rcoming from exactly? The reproduction I provided should only be dumping code... how are\rcharacters getting into that?danini-the-panini commentedon Sep 22, 2025
Your repro doesn't output any
\r"{\n<i>\"1\" : {\n<i><i>\"2\" : 3,\n<i><i>\"4\" : [<a_nl><i><i><i>5,<a_nl><i><i><i>6<a_nl><i><i>]\n<i>}\n}"the issue is that the test file has
\r\nin it. thegeneratemethod is correctly outputting only\nbut the HEREDOC has\r\non JRuby on Window, hence the failure. (You can see that the expected output is the one with the CRLF)danini-the-panini commentedon Sep 22, 2025
There seems to be an issue logged for this already: jruby/jruby#3742
headius commentedon Sep 24, 2025
Yeah that's very likely about the same problem. Perhaps it's time to fix it.
headius commentedon Sep 24, 2025
So basically my repro does show the problem... we're not emitting Windows line terminators in some case used by the json dumping logic.
I'm assuming that the CRuby CI is checking out the code exactly the same way (with Windows line terminators) so that's not really the bug. The bug is that we don't end up matching those line terminators.
headius commentedon Oct 2, 2025
I tried looking into this but I was unable to get ragel to work properly on Windows to generate the JRuby parsers. Confusingly, the CI jobs don't appear to run ragel at all.
headius commentedon Oct 2, 2025
I managed to force ragel to run sufficiently to get the build to work, and I've narrowed down the problem.
I believe it's an issue in JRuby's parser, whereby we do not convert
\r\nto\n. The outputting of\nfor newlines in json is correct in the JRuby extension.Source, and this file has
\r\nline terminators:Contents of the file as an inspected Ruby string (read as binary to avoid newline conversion):
Output with Ruby 3.4.7 on Windows:
Output with JRuby 10-head on Windows:
I will re-file this as a JRuby issue.
headius commentedon Oct 3, 2025
This was after all a JRuby issue (jruby/jruby#9018) and was fixed there (jruby/jruby#9019). I've already updated the json CI matrix to include
windows-latestwithjruby-head(#868).