ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:47841] [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds
@ 2012-10-05  6:47 bkabrda (Bohuslav Kabrda)
  2012-10-05  7:10 ` [ruby-core:47842] " Tanaka Akira
  2012-11-05 12:08 ` [ruby-core:48903] [ruby-trunk - Bug #7109][Rejected] " mame (Yusuke Endoh)
  0 siblings, 2 replies; 6+ messages in thread
From: bkabrda (Bohuslav Kabrda) @ 2012-10-05  6:47 UTC (permalink / raw
  To: ruby-core


Issue #7109 has been reported by bkabrda (Bohuslav Kabrda).

----------------------------------------
Bug #7109: File.utime doesn't set nanoseconds
https://bugs.ruby-lang.org/issues/7109

Author: bkabrda (Bohuslav Kabrda)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


Hi,
I'm having a problem with File.utime on RHEL 5/CentOS 5. The File.utime method seems not to set nanoseconds properly, see the attached test case, that fails (the nanoseconds get rounded to thousand, so in fact I get microseconds). The test doesn't seem to fail on newer platforms with the same Ruby version, though (RHEL 6/CentOS 6, Fedora 17). Note, that when creating/modifying files, the nanoseconds get set and are returned properly, so it seems that they are supported by filesystem.

Sample failure:
  1) Failure:
test_utime(TestUtime) [/builddir/build/BUILD/rubygem-sprockets-2.4.5/opt/rh/ruby193/root/usr/share/gems/gems/sprockets-2.4.5/file_utime_fail.rb:10]:
Expected: 391199303
  Actual: 391199000

Any idea what might be wrong?
Thanks!


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:47842] Re: [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds
  2012-10-05  6:47 [ruby-core:47841] [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds bkabrda (Bohuslav Kabrda)
@ 2012-10-05  7:10 ` Tanaka Akira
  2012-10-05  7:34   ` [ruby-core:47843] " Bohuslav Kabrda
  2012-11-05 12:08 ` [ruby-core:48903] [ruby-trunk - Bug #7109][Rejected] " mame (Yusuke Endoh)
  1 sibling, 1 reply; 6+ messages in thread
From: Tanaka Akira @ 2012-10-05  7:10 UTC (permalink / raw
  To: ruby-core

2012/10/5 bkabrda (Bohuslav Kabrda) <bkabrda@redhat.com>:

> I'm having a problem with File.utime on RHEL 5/CentOS 5. The File.utime method seems not to set nanoseconds properly, see the attached test case, that fails (the nanoseconds get rounded to thousand, so in fact I get microseconds). The test doesn't seem to fail on newer platforms with the same Ruby version, though (RHEL 6/CentOS 6, Fedora 17). Note, that when creating/modifying files, the nanoseconds get set and are returned properly, so it seems that they are supported by filesystem.

utimensat system call is required to set nanosecond filestamp.
It is available since Linux 2.6.22.
(glibc support is also required but I'm not sure the exact version.)

I guess RHEL 5/CentOS 5 is older than that.
-- 
Tanaka Akira

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:47843] Re: [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds
  2012-10-05  7:10 ` [ruby-core:47842] " Tanaka Akira
@ 2012-10-05  7:34   ` Bohuslav Kabrda
  2012-10-05  9:17     ` [ruby-core:47845] " Tanaka Akira
  2012-10-05 18:48     ` [ruby-core:47850] " KOSAKI Motohiro
  0 siblings, 2 replies; 6+ messages in thread
From: Bohuslav Kabrda @ 2012-10-05  7:34 UTC (permalink / raw
  To: ruby-core

----- Original Message -----
> 2012/10/5 bkabrda (Bohuslav Kabrda) <bkabrda@redhat.com>:
> 
> > I'm having a problem with File.utime on RHEL 5/CentOS 5. The
> > File.utime method seems not to set nanoseconds properly, see the
> > attached test case, that fails (the nanoseconds get rounded to
> > thousand, so in fact I get microseconds). The test doesn't seem to
> > fail on newer platforms with the same Ruby version, though (RHEL
> > 6/CentOS 6, Fedora 17). Note, that when creating/modifying files,
> > the nanoseconds get set and are returned properly, so it seems
> > that they are supported by filesystem.
> 
> utimensat system call is required to set nanosecond filestamp.
> It is available since Linux 2.6.22.
> (glibc support is also required but I'm not sure the exact version.)
> 
> I guess RHEL 5/CentOS 5 is older than that.
> --
> Tanaka Akira
> 
> 

True, kernel version is 2.6.19. So is there another way to solve this or do I have to get along with microseconds?

Thanks.

-- 
Regards,
Bohuslav "Slavek" Kabrda.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:47845] Re: [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds
  2012-10-05  7:34   ` [ruby-core:47843] " Bohuslav Kabrda
@ 2012-10-05  9:17     ` Tanaka Akira
  2012-10-05 18:48     ` [ruby-core:47850] " KOSAKI Motohiro
  1 sibling, 0 replies; 6+ messages in thread
From: Tanaka Akira @ 2012-10-05  9:17 UTC (permalink / raw
  To: ruby-core

2012/10/5 Bohuslav Kabrda <bkabrda@redhat.com>:

> True, kernel version is 2.6.19. So is there another way to solve this or do I have to get along with microseconds?

We can't set a timestamp without appropriate system call.
-- 
Tanaka Akira

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:47850] Re: [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds
  2012-10-05  7:34   ` [ruby-core:47843] " Bohuslav Kabrda
  2012-10-05  9:17     ` [ruby-core:47845] " Tanaka Akira
@ 2012-10-05 18:48     ` KOSAKI Motohiro
  1 sibling, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2012-10-05 18:48 UTC (permalink / raw
  To: ruby-core

>> utimensat system call is required to set nanosecond filestamp.
>> It is available since Linux 2.6.22.
>> (glibc support is also required but I'm not sure the exact version.)
>>
>> I guess RHEL 5/CentOS 5 is older than that.
>
> True, kernel version is 2.6.19. So is there another way to solve this or do I have to get along with microseconds?

No another way. This is kernel limitation. In other word, you can't
compare gettimeofday() result and stat() result straightforwardly.

btw, even tough you use RHEL6, you can see this issue if you use some
older filesystems.
it depend on filesystem.

btw2, http://en.wikipedia.org/wiki/Ext4 says nanosecond timestamp is a
new feature of ext4.
I suspect your "RHEL5" mean ext3.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:48903] [ruby-trunk - Bug #7109][Rejected] File.utime doesn't set nanoseconds
  2012-10-05  6:47 [ruby-core:47841] [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds bkabrda (Bohuslav Kabrda)
  2012-10-05  7:10 ` [ruby-core:47842] " Tanaka Akira
@ 2012-11-05 12:08 ` mame (Yusuke Endoh)
  1 sibling, 0 replies; 6+ messages in thread
From: mame (Yusuke Endoh) @ 2012-11-05 12:08 UTC (permalink / raw
  To: ruby-core


Issue #7109 has been updated by mame (Yusuke Endoh).

Status changed from Open to Rejected

It cannot be avoided because the limitation is due to OS.  Closing.

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #7109: File.utime doesn't set nanoseconds
https://bugs.ruby-lang.org/issues/7109#change-32399

Author: bkabrda (Bohuslav Kabrda)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


Hi,
I'm having a problem with File.utime on RHEL 5/CentOS 5. The File.utime method seems not to set nanoseconds properly, see the attached test case, that fails (the nanoseconds get rounded to thousand, so in fact I get microseconds). The test doesn't seem to fail on newer platforms with the same Ruby version, though (RHEL 6/CentOS 6, Fedora 17). Note, that when creating/modifying files, the nanoseconds get set and are returned properly, so it seems that they are supported by filesystem.

Sample failure:
  1) Failure:
test_utime(TestUtime) [/builddir/build/BUILD/rubygem-sprockets-2.4.5/opt/rh/ruby193/root/usr/share/gems/gems/sprockets-2.4.5/file_utime_fail.rb:10]:
Expected: 391199303
  Actual: 391199000

Any idea what might be wrong?
Thanks!


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-05 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05  6:47 [ruby-core:47841] [ruby-trunk - Bug #7109][Open] File.utime doesn't set nanoseconds bkabrda (Bohuslav Kabrda)
2012-10-05  7:10 ` [ruby-core:47842] " Tanaka Akira
2012-10-05  7:34   ` [ruby-core:47843] " Bohuslav Kabrda
2012-10-05  9:17     ` [ruby-core:47845] " Tanaka Akira
2012-10-05 18:48     ` [ruby-core:47850] " KOSAKI Motohiro
2012-11-05 12:08 ` [ruby-core:48903] [ruby-trunk - Bug #7109][Rejected] " mame (Yusuke Endoh)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).