Bug #9954
closedUnexpected Hash Modification and Segmentation Fault with Named Arguments
Description
While experimenting with named arguments in Ruby 2.1.2, I encountered some strange behavior where a hash was modified after being passed as a set of named arguments with the double-splat operator. While attempting to examine the issue further, I encountered a segmentation fault which I believe to be related.
I have attached a log of my experiment, and a .rb
file which reproduces both the unexpected hash modification and the segfault.
Files
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Is duplicate of Bug #9898: Keyword argument oddities added
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Status changed from Open to Closed
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: DONTNEED, 2.1: REQUIRED
Updated by Ajedi32 (Ajedi32 W) over 10 years ago
Hmm... that doesn't really seem like the same issue (it has totally different symptoms from what I described here) but I'll trust your judgement on this one.
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
2.1.2p132 segfaults by your script, due to the access to the non-Hash object as a Hash object.
r46342 fixes it to return the converted result.
Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago
- Backport changed from 2.0.0: DONTNEED, 2.1: REQUIRED to 2.0.0: DONTNEED, 2.1: DONE
Backported into ruby_2_1
branch at r46619.