[ruby-core:66735] [ruby-trunk - Bug #10577] [Rejected] Confusing behavior of File.open with bad filenames in windows

From: usa@...
Date: 2014-12-07 13:03:37 UTC
List: ruby-core #66735
Issue #10577 has been updated by Usaku NAKAMURA.

Status changed from Open to Rejected

Google "NTFS Alternate Data Streams".

----------------------------------------
Bug #10577: Confusing behavior of File.open with bad filenames in windows
https://bugs.ruby-lang.org/issues/10577#change-50327

* Author: Ilya Vorontsov
* Status: Rejected
* Priority: Normal
* Assignee: 
* Category: platform/mingw
* Target version: 
* ruby -v: 2.1.5p273; 2.0.0p451
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
I've used a colon in a filename in my script and confronted with a confusing behavior when ran program in windows. Ruby ignored the wrong part of a filename and created a file with a shortened name. I find it very dangerous, that a program can silently touch a file with a different name and overwrite it.

File.open('c:\a:b.txt', 'w') do |fw|
  fw.puts 'test'
end

It creates a file named c:\a which is... empty. No exception is raised, but a file is created and content is missing.

I guess my version of ruby (actually both 2.0.0p451 and 2.1.5p273) is for mingw platform (I've downloaded them from rubyinstaller.org)



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next