File#truncate creates a new file if the file doesn't exist
----------------------------------------------------------

                 Key: JRUBY-1612
                 URL: http://jira.codehaus.org/browse/JRUBY-1612
             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


File.truncate, when provided the non-existing file name, creates that file, But 
MRI reports the No such file or directory (Errno::ENOENT), which seems to be a 
correct behavior.


MRI:

#ruby -e 'File.truncate("NOT_EXISTING_FILE", 5)'
-e:1:in `truncate': No such file or directory - NOT_EXISTING_FILE 
(Errno::ENOENT)
        from -e:1

JRuby:

#jruby -e 'File.truncate("NOT_EXISTING_FILE_XXX", 5)'

# ls -l NOT_EXISTING_FILE_XXX ==> -rw-r--r-- 1 user group 5 2007-11-23 01:16 
NOT_EXISTING_FILE_XXX

Note that JRuby creates the file and fills it with zeroes.



-- 
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

Reply via email to