Project

General

Profile

Actions

Bug #11679

closed

Partial name of coding is allowed at magic comment

Added by h.shirosaki (Hiroshi Shirosaki) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-11-12 trunk 52549)
[ruby-core:71460]

Description

Encoding of magic comment is allowed by just c: ....
Is this expected result or not?

$ cat test.rb
# -*- c: foo -*-

$ ./miniruby -v test.rb
ruby 2.3.0dev (2015-11-12 trunk 52549) [x86_64-linux]
test.rb:1: unknown encoding name: foo (ArgumentError)

$ cat test.rb
# c: foo

$ ./miniruby -v test.rb
ruby 2.3.0dev (2015-11-12 trunk 52549) [x86_64-linux]
test.rb:1: unknown encoding name: foo (ArgumentError)

# c: foo behavior is changed by r52208.

This is same as frozen-string-literal.

$ cat testf.rb
# f: true
p 'foo'.frozen?

$ ./miniruby testf.rb
true

I attached a patch not to allow partial name.


Files

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Status changed from Open to Closed

Applied in changeset r52550.


parse.y: exact magic comment name

Actions

Also available in: Atom PDF

Like0
Like0