File.utime and File.mtime
-------------------------

                 Key: JRUBY-1983
                 URL: http://jira.codehaus.org/browse/JRUBY-1983
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
            Reporter: Assaf Arkin


The FileUtils.touch method updates the file's current timestamp by calling 
(line 1029):

  File.utime(nil, nil, path)

In MRI, this updates the file's atime and mtime to Time.now, in JRuby it 
updates them to Time.at(0).

A second bug exists in File.mtime.  When trying to read the file's mtime using 
this method, on files that have this Epoch timestamp, JRuby raises a ENOENT 
error.  However, using File.lstat(path).mtime returns the correct result.

To test this:

  require 'fileutils'

  # touch fails when updating existing file, not when creating it.
  File.open('foo', 'w') { }
  FileUtils.touch('foo')
  # Should return Time.now.
  puts File.state(path).mtime
  # Should not fail.
  puts File.mtime(path)

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