File#truncate works incorretly deleting entire file content
-----------------------------------------------------------
Key: JRUBY-1607
URL: http://jira.codehaus.org/browse/JRUBY-1607
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.x
Environment: Ubuntu Linux 7.10
ruby 1.8.5 (2007-11-22 rev 4842) [i386-jruby1.1b1]
Reporter: Vladimir Sizikov
Priority: Blocker
Attachments: file.diff
Invocation of File.truncate DELETES the content of the file, and fills the file
with zeroes. Deleting user's content is bad.
Simplest use case:
f = File.new("out", "w")
f.write(1234567890)
f.close
File.truncate("out", 5)
p File.read("out")
Under MRI prints "12345".
Under JRuby: "\000\000\000\000\000"
This also causes 4 Rubinius spec tests for File#truncate to fail.
The simple patch fixes all failures.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email