ruby/ext/-test-
KJ Tsanaktsidis 31371b2e24 Fix CRLF -> LF conversion on read for rb_io_fdopen & rb_file_open
When opening a file with `File.open`, and then setting the encoding with
`IO#set_encoding`, it still correctly performs CRLF -> LF conversion on
Windows when reading files with a CRLF line ending in them (in text
mode).

However, the file is opened instead with either the `rb_io_fdopen` or
`rb_file_open` APIs from C, the CRLF conversion is _NOT_ set up
correctly; it works if the encoding is not specified, but if
`IO#set_encoding` is called, the conversion stops happening. This seems
to be because the encflags never get ECONV_DEFAULT_NEWLINE_DECORATOR
set in these codepaths.

Concretely, this means that the conversion doesn't happen in the
following circumstances:
  * When loading ruby files with require (that calls rb_io_fdopen)
  * When parsing ruuby files with RubyVM::AbstractSyntaxTree (that calls
    rb_file_open).
This then causes the ErrorHighlight tests to fail on windows if git has
checked them out with CRLF line endings - the error messages it's
testing wind up with literal \r\n sequences in them because the iseq
text from the parser contains un-newline-converted strings.

This commit fixes the problem by copy-pasting the relevant snippet which
sets this up in `rb_io_extract_modeenc` (for the File.open path) into
the relevant codepaths for `rb_io_fdopen` and `rb_file_open`.

[Bug #20101]
2024-01-10 21:02:23 +11:00
..
abi
arith_seq Update the depend files 2023-02-28 09:09:00 -08:00
array Update the depend files 2023-02-28 09:09:00 -08:00
bignum Update the depend files 2023-02-28 09:09:00 -08:00
bug-3571 Update the depend files 2023-02-28 09:09:00 -08:00
bug-5832 Update the depend files 2023-02-28 09:09:00 -08:00
bug-14834 Update the depend files 2023-02-28 09:09:00 -08:00
bug_reporter Update the depend files 2023-02-28 09:09:00 -08:00
class Update the depend files 2023-02-28 09:09:00 -08:00
cxxanyargs
debug [Feature #10602] Add new API rb_profile_thread_frames() 2023-10-31 11:16:18 +09:00
dln/empty Update the depend files 2023-02-28 09:09:00 -08:00
econv
enumerator_kw Update the depend files 2023-02-28 09:09:00 -08:00
eval
exception Update the depend files 2023-02-28 09:09:00 -08:00
fatal Update the depend files 2023-02-28 09:09:00 -08:00
file Fix CRLF -> LF conversion on read for rb_io_fdopen & rb_file_open 2024-01-10 21:02:23 +11:00
float Update the depend files 2023-02-28 09:09:00 -08:00
funcall Update the depend files 2023-02-28 09:09:00 -08:00
gvl/call_without_gvl Update the depend files 2023-02-28 09:09:00 -08:00
hash Update the depend files 2023-02-28 09:09:00 -08:00
integer Update the depend files 2023-02-28 09:09:00 -08:00
iseq_load Update the depend files 2023-02-28 09:09:00 -08:00
iter Update the depend files 2023-02-28 09:09:00 -08:00
load stop warnings from running the test case requiring .so twice 2023-12-15 11:09:31 +09:00
marshal Update the depend files 2023-02-28 09:09:00 -08:00
memory_status Update the depend files 2023-02-28 09:09:00 -08:00
memory_view Update the depend files 2023-02-28 09:09:00 -08:00
method Update the depend files 2023-02-28 09:09:00 -08:00
notimplement Update the depend files 2023-02-28 09:09:00 -08:00
num2int Update the depend files 2023-02-28 09:09:00 -08:00
path_to_class Update the depend files 2023-02-28 09:09:00 -08:00
popen_deadlock Update the depend files 2023-02-28 09:09:00 -08:00
postponed_job Add a test case for preregistering with different data 2023-12-13 13:35:05 +11:00
printf Update the depend files 2023-02-28 09:09:00 -08:00
proc Update the depend files 2023-02-28 09:09:00 -08:00
random Update the depend files 2023-02-28 09:09:00 -08:00
rational Update the depend files 2023-02-28 09:09:00 -08:00
rb_call_super_kw Update the depend files 2023-02-28 09:09:00 -08:00
recursion Update the depend files 2023-02-28 09:09:00 -08:00
regexp Update the depend files 2023-02-28 09:09:00 -08:00
RUBY_ALIGNOF Update the depend files 2023-02-28 09:09:00 -08:00
scan_args Update the depend files 2023-02-28 09:09:00 -08:00
st rb_bug prints a newline after the message 2023-05-20 21:43:30 +09:00
string String for string literal is not resizable 2023-11-08 00:59:45 +09:00
struct [Feature #19757] Add new API rb_data_define 2023-07-13 17:55:55 +09:00
symbol Update the depend files 2023-02-28 09:09:00 -08:00
thread/instrumentation Further fix the GVL instrumentation API 2023-11-28 20:06:55 +01:00
thread_fd Update the depend files 2023-02-28 09:09:00 -08:00
time Update the depend files 2023-02-28 09:09:00 -08:00
tracepoint Simplify implementation of tracepoint tests 2023-12-13 13:35:05 +11:00
typeddata Update the depend files 2023-02-28 09:09:00 -08:00
vm Update the depend files 2023-02-28 09:09:00 -08:00
wait Update the depend files 2023-02-28 09:09:00 -08:00
win32
auto_ext.rb