Project

General

Profile

Actions

Bug #10577

closed

Confusing behavior of File.open with bad filenames in windows

Added by prijutme4ty (Ilya Vorontsov) over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
2.1.5p273; 2.0.0p451
[ruby-core:66734]

Description

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)

Updated by usa (Usaku NAKAMURA) over 9 years ago

  • Status changed from Open to Rejected

Google "NTFS Alternate Data Streams".

Actions

Also available in: Atom PDF

Like0
Like0