The clone method of Fiddle::CStruct object is shallow copy
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 195
- Forks
- 53
- Avg merge
- 23h 57m
- Merged PRs (30d)
- 1
Description
Fiddle
require 'fiddle/import'
S = Fiddle::Importer.struct(["int i"])
a = S.malloc
a.i = 10
b = a.clone
b.i = 20
p a.i # 20
p b.i # 20
Ruby-FFI
require 'ffi'
class S < FFI::Struct
layout :i, :int
end
a = S.new
a[:i] = 10
b = a.clone
b[:i] = 20
p a[:i] # 10
p b[:i] # 20
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Fiddle::CStruct and Ruby-FFI examples in the issue and compare the clone results. Trace the Fiddle::CStruct clone behavior and determine how copied values should be isolated; done means changing the cloned struct no longer changes the original, while the Ruby-FFI comparison remains the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100