From 04f86ad0b5d2fe4711ff300d855228a6aed55f33 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 26 May 2022 12:22:42 -0700 Subject: Do not chomp trailing line separator IO#each with nil separator and chomp nil separator means no sepator, so chomp should not remove a line separator. Partially Fixes [Bug #18770] --- io.c | 1 - 1 file changed, 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 650ea5e377..13cde15360 100644 --- a/io.c +++ b/io.c @@ -3875,7 +3875,6 @@ rb_io_getline_0(VALUE rs, long limit, int chomp, rb_io_t *fptr) if (NIL_P(rs) && limit < 0) { str = read_all(fptr, 0, Qnil); if (RSTRING_LEN(str) == 0) return Qnil; - if (chomp) rb_str_chomp_string(str, rb_default_rs); } else if (limit == 0) { return rb_enc_str_new(0, 0, io_read_encoding(fptr)); -- cgit v1.2.1