Bug #19150
closedpack/unpack silently ignores unknown directives
Description
But I believe it should be an error instead.
Typically when a parser sees a syntax error it should fail not continue silently.
For instance [1].pack('<L')
succeeds and only emits a warning if $VERBOSE
is true.
This behavior caused confusion in https://github.com/oracle/truffleruby/issues/2791
I think it should fail with an ArgumentError
instead.
Extracted from https://bugs.ruby-lang.org/issues/19108#note-3
Updated by Eregon (Benoit Daloze) almost 2 years ago
- Related to Bug #19108: Format routines like pack blindly treat a string as ASCII-encoded added
Updated by matz (Yukihiro Matsumoto) almost 2 years ago
For 3.2 unknown directives always warn; for 3.3 they raise exceptions.
Matz.
Updated by mame (Yusuke Endoh) almost 2 years ago
Updated by mame (Yusuke Endoh) almost 2 years ago
- Status changed from Open to Closed
Applied in changeset git|ee7a338d2b21a84d194015c3680bd2a95c0dd23f.
Unconditionally warn "unknown pack/unpack directive"
[Bug #19150]
Updated by byroot (Jean Boussier) almost 2 years ago
- Status changed from Closed to Open
Reopening so we remember to make it raise in 3.3
Updated by Eregon (Benoit Daloze) almost 2 years ago
- Status changed from Open to Closed
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED
Done in https://github.com/ruby/ruby/commit/03dd37775afb40eef392ae2920d728235af302c8, also needed changes in specs: https://github.com/ruby/spec/commit/9d69b95a7bbac3d89e7218a98bd50ecf173d9c6f