Project

General

Profile

Actions

Bug #18074

closed

ARGF.read(length) exhibits short rea

Added by csabahenk2 (Csaba Henk) almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-08-04T09:29:42Z master 6e55facdb3) [x86_64-linux]
[ruby-core:104855]

Description

If ruby is invoked with three file name arguments (which refer to extant non-empty regular files), and ARFG.read is called with a length argument that exceeds the combined size of the first two files[1], then only the content of the first two files will be collected in the resultant string.

$ for f in a b c; do echo -n $f > $f; done
$ ruby -e 'p ARGF.read(3)' a b c
"ab"

[1]: This is actually just a necessary condition, the exact criteria will be provided in followup analysis.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0