Project

General

Profile

Actions

Bug #11679

closed

Partial name of coding is allowed at magic comment

Bug #11679: Partial name of coding is allowed at magic comment

Added by h.shirosaki (Hiroshi Shirosaki) almost 10 years ago. Updated almost 10 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

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago Actions #1

  • Status changed from Open to Closed

Applied in changeset r52550.


parse.y: exact magic comment name

Actions

Also available in: PDF Atom