Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iamed2 opened this issue Oct 9, 2024 · 2 comments · Fixed by #56092
Closed

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

iamed2 opened this issue Oct 9, 2024 · 2 comments · Fixed by #56092
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior io Involving the I/O subsystem: libuv, read, write, etc. regression 1.11 Regression in the 1.11 release regression 1.12 Regression in the 1.12 release

Comments

@iamed2
Copy link
Contributor

iamed2 commented Oct 9, 2024

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
@ararslan ararslan added bug Indicates an unexpected problem or unintended behavior regression 1.11 Regression in the 1.11 release regression 1.12 Regression in the 1.12 release labels Oct 9, 2024
@ararslan
Copy link
Member

ararslan commented Oct 9, 2024

Same on current master

@ararslan ararslan added the io Involving the I/O subsystem: libuv, read, write, etc. label Oct 9, 2024
@nhz2
Copy link
Contributor

nhz2 commented Oct 10, 2024

Bisected to d7b9ac8 #53192

vtjnash added a commit that referenced this issue Oct 10, 2024
Adds a new abstraction `take!(::Array{T,N}, ::Array{T,N})` for doing an
efficient `copyto!` equivalent. Previously it was assumed that `compact`
did this automatically, which wasn't a great assumption.

Fixes #56078
vtjnash added a commit that referenced this issue Oct 15, 2024
Adds a new abstraction `take!(::Array{T,N}, ::Array{T,N})` for doing an
efficient `copyto!` equivalent. Previously it was assumed that `compact`
did this automatically, which wasn't a great assumption.

Fixes #56078
vtjnash added a commit that referenced this issue Oct 17, 2024
Adds a new abstraction `take!(::Array{T,N}, ::Array{T,N})` for doing an
efficient `copyto!` equivalent. Previously it was assumed that `compact`
did this automatically, which wasn't a great assumption.

Fixes #56078
vtjnash added a commit that referenced this issue Oct 18, 2024
Adds a new abstraction `take!(::Array{T,N}, ::Array{T,N})` for doing an
efficient `copyto!` equivalent. Previously it was assumed that `compact`
did this automatically, which wasn't a great assumption.

Fixes #56078
vtjnash added a commit that referenced this issue Oct 18, 2024
Adds a new abstraction `take!(::Array{T,N}, ::Array{T,N})` for doing an
efficient `copyto!` equivalent. Previously it was assumed that `compact`
did this automatically, which wasn't a great assumption.

Fixes #56078
giordano pushed a commit that referenced this issue Oct 19, 2024
Adds a new internal function `_take!(dst::Array{T,N}, src::Array{T,N})` for
doing an efficient `copyto!` equivalent. Previously it was assumed that
`compact` did this automatically, which wasn't a great assumption.

Fixes #56078

(cherry picked from commit fc40e62)
KristofferC pushed a commit that referenced this issue Oct 21, 2024
Adds a new internal function `_take!(dst::Array{T,N}, src::Array{T,N})` for
doing an efficient `copyto!` equivalent. Previously it was assumed that
`compact` did this automatically, which wasn't a great assumption.

Fixes #56078
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior io Involving the I/O subsystem: libuv, read, write, etc. regression 1.11 Regression in the 1.11 release regression 1.12 Regression in the 1.12 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants