Project

General

Profile

Actions

Bug #17738

closed

Ruby can still freeze ENV

Added by kachick (Kenichi Kamiya) about 3 years ago. Updated about 3 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
[ruby-core:102961]

Description

After https://bugs.ruby-lang.org/issues/15920 and https://github.com/ruby/ruby/commit/f53d7e4bfd604be6f8131c5460c29f4af16da117, ENV.freeze raises TypeError.
But we can still freeze ENV as below.

Kernel.instance_method(:freeze).bind(ENV).call()
p ENV.frozen? #=> true

This loophole should be ignored?

Actions

Also available in: Atom PDF

Like0
Like0Like0