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

Fix variable length strings as attributes #1130

Merged
merged 1 commit into from
Dec 23, 2023
Merged

Fix variable length strings as attributes #1130

merged 1 commit into from
Dec 23, 2023

Conversation

simonbyrne
Copy link
Collaborator

Fixes #1129

Copy link
Member

@mkitti mkitti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the original test for the non-variable length side? I'm looking at this from my phone, so it is difficult to look around.

ptr = Base.unsafe_convert(Cstring, strbuf)
write_attribute(attr, memtype, Ref(ptr))
else
ptr = Base.unsafe_convert(Ptr{UInt8}, strbuf)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we test this side of the conditional? I suppose this is for a fixed length string?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, maybe we should remove this. Don't think we have user-facing API that uses fixed strings

@mkitti
Copy link
Member

mkitti commented Dec 4, 2023

Does anyone know what's going up with nightly here?

@mkitti
Copy link
Member

mkitti commented Dec 4, 2023

plain: Error During Test at /home/runner/work/HDF5.jl/HDF5.jl/test/plain.jl:24
  Got exception outside of a @test
  conversion to pointer not defined for Vector{HDF5.API.hvl_t}
  Stacktrace:
    [1] error(s::String)
      @ Base ./error.jl:35
    [2] unsafe_convert(::Type{Ptr{HDF5.API.hvl_t}}, a::Vector{HDF5.API.hvl_t})
      @ Base ./pointer.jl:67
    [3] unsafe_convert(::Type{Ptr{Nothing}}, a::Vector{HDF5.API.hvl_t})
      @ Base ./pointer.jl:66
    [4] h5d_write(dataset_id::HDF5.Dataset, mem_type_id::HDF5.Datatype, mem_space_id::Int64, file_space_id::Int64, xfer_plist_id::HDF5.DatasetTransferProperties, buf::HDF5.VLen{HDF5.ASCIIChar})
      @ HDF5.API ~/work/HDF5.jl/HDF5.jl/src/api/functions.jl:908
    [5] write_dataset(dset::HDF5.Dataset, memtype::HDF5.Datatype, x::HDF5.VLen{HDF5.ASCIIChar}, xfer::HDF5.DatasetTransferProperties)
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:488
    [6] write_dataset(parent::HDF5.File, name::String, data::HDF5.VLen{HDF5.ASCIIChar}; pv::@Kwargs{})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:320
    [7] write_dataset(parent::HDF5.File, name::String, data::HDF5.VLen{HDF5.ASCIIChar})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:315
    [8] macro expansion
      @ ~/work/HDF5.jl/HDF5.jl/test/plain.jl:88 [inlined]
    [9] macro expansion
      @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1598 [inlined]
   [10] top-level scope
      @ ~/work/HDF5.jl/HDF5.jl/test/plain.jl:27
   [11] include(fname::String)
      @ Base.MainInclude ./client.jl:497
   [12] macro expansion
      @ ~/work/HDF5.jl/HDF5.jl/test/runtests.jl:36 [inlined]
   [13] macro expansion
      @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1598 [inlined]
   [14] top-level scope
      @ ~/work/HDF5.jl/HDF5.jl/test/runtests.jl:35
   [15] include(fname::String)
      @ Base.MainInclude ./client.jl:497
   [16] top-level scope
      @ none:6
   [17] eval
      @ Core ./boot.jl:418 [inlined]
   [18] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:291
   [19] _start()
      @ Base ./client.jl:568
abstract arrays: Error During Test at /home/runner/work/HDF5.jl/HDF5.jl/test/plain.jl:674
  Got exception outside of a @test
  conversion to pointer not defined for Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false}
  Stacktrace:
    [1] error(s::String)
      @ Base ./error.jl:35
    [2] unsafe_convert(::Type{Ptr{UInt8}}, a::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false})
      @ Base ./pointer.jl:67
    [3] unsafe_convert(::Type{Ptr{Nothing}}, a::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false})
      @ Base ./pointer.jl:66
    [4] h5d_write(dataset_id::HDF5.Dataset, mem_type_id::HDF5.Datatype, mem_space_id::Int64, file_space_id::Int64, xfer_plist_id::HDF5.DatasetTransferProperties, buf::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false})
      @ HDF5.API ~/work/HDF5.jl/HDF5.jl/src/api/functions.jl:908
    [5] write_dataset(dataset::HDF5.Dataset, memtype::HDF5.Datatype, buf::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false}, xfer::HDF5.DatasetTransferProperties)
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:523
    [6] write_dataset(dataset::HDF5.Dataset, memtype::HDF5.Datatype, buf::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:521
    [7] write_dataset(parent::HDF5.File, name::String, data::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false}; pv::@Kwargs{})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:320
    [8] write_dataset(parent::HDF5.File, name::String, data::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:315
    [9] write(parent::HDF5.File, name::String, data::Base.ReinterpretArray{UInt8, 1, Bool, Vector{Bool}, false}; pv::@Kwargs{})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/datasets.jl:342
   [10] (::var"#37#40")(f::HDF5.File)
      @ Main ~/work/HDF5.jl/HDF5.jl/test/plain.jl:681
   [11] (::HDF5.var"#17#18"{HDF5.HDF5Context, @Kwargs{}, var"#37#40", HDF5.File})()
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/file.jl:101
   [12] task_local_storage(body::HDF5.var"#17#18"{HDF5.HDF5Context, @Kwargs{}, var"#37#40", HDF5.File}, key::Symbol, val::HDF5.HDF5Context)
      @ Base ./task.jl:299
   [13] h5open(::var"#37#40", ::String, ::Vararg{String}; context::HDF5.HDF5Context, pv::@Kwargs{})
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/file.jl:96
   [14] h5open(::Function, ::String, ::String)
      @ HDF5 ~/work/HDF5.jl/HDF5.jl/src/file.jl:94
   [15] macro expansion
      @ ~/work/HDF5.jl/HDF5.jl/test/plain.jl:679 [inlined]
   [16] macro expansion
      @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1598 [inlined]
   [17] top-level scope
      @ ~/work/HDF5.jl/HDF5.jl/test/plain.jl:677
   [18] include(fname::String)
      @ Base.MainInclude ./client.jl:497
   [19] macro expansion
      @ ~/work/HDF5.jl/HDF5.jl/test/runtests.jl:36 [inlined]
   [20] macro expansion
      @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1598 [inlined]
   [21] top-level scope
      @ ~/work/HDF5.jl/HDF5.jl/test/runtests.jl:35
   [22] include(fname::String)
      @ Base.MainInclude ./client.jl:497
   [23] top-level scope
      @ none:6
   [24] eval
      @ Core ./boot.jl:418 [inlined]
   [25] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:[291](https://github.com/JuliaIO/HDF5.jl/actions/runs/6724886980/job/18278119057?pr=1130#step:5:294)
   [26] _start()
      @ Base ./client.jl:568

@mkitti mkitti closed this Dec 4, 2023
@mkitti mkitti reopened this Dec 4, 2023
@mkitti mkitti merged commit 91ef284 into master Dec 23, 2023
26 of 32 checks passed
@mkitti mkitti deleted the sb/varstring branch December 23, 2023 23:07
@ericphanson
Copy link

can a new release be tagged with this fix? 🙏

@ericphanson
Copy link

bump :)

@mkitti
Copy link
Member

mkitti commented Apr 4, 2024

I think it might be easier to back port this to the 0.17 branch. I will work on that today.

mkitti pushed a commit that referenced this pull request Apr 5, 2024
@mkitti
Copy link
Member

mkitti commented Apr 5, 2024

I released HDF5.jl 0.17.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segfault when writing variable length string as attribute
4 participants