Skip to content

readbytes!(::Process, ::Vector{UInt8}, ::Int) does not read bytes on 1.11 #56078

@iamed2

Description

@iamed2

On 1.11:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0 (2024-10-07)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> function mwe(filepath, nb, max_nb)
           write(filepath, ones(UInt8, nb))
           p = open(`cat $filepath`; read=true)
           b = Vector{UInt8}(undef, 1024)
           nr = readbytes!(p, b, max_nb)
           return nr, b
       end
mwe (generic function with 1 method)

julia> (nr, v) = mwe("/Users/edavies/Downloads/tmp.bin", 53209, typemax(Int))
(53209, UInt8[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  …  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])

julia> length(v)
1024

On 1.10:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.5 (2024-08-27)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> function mwe(filepath, nb, max_nb)
           write(filepath, ones(UInt8, nb))
           p = open(`cat $filepath`; read=true)
           b = Vector{UInt8}(undef, 1024)
           nr = readbytes!(p, b, max_nb)
           return nr, b
       end
mwe (generic function with 1 method)

julia> (nr, v) = mwe("/Users/edavies/Downloads/tmp.bin", 53209, typemax(Int))
(53209, UInt8[0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01  …  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])

julia> length(v)
118745

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorioInvolving the I/O subsystem: libuv, read, write, etc.regression 1.11Regression in the 1.11 releaseregression 1.12Regression in the 1.12 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions