Bug #7276

TestFile#test_utime failure

Added by Jon Forums over 1 year ago. Updated about 1 year ago.

[ruby-core:48854]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
Category:core
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-11-04 trunk 37467) [i386-mingw32] Backport:

Description

I'm currently travelling and am in UTC-5. I get the following make test-all failure on Win7 32bit with mingw-w64 gcc 4.7.2. It appears that trunk@37467 is not handling daylight savings time correctly.

I'm not going to have time to try to repro on my Arch system, but can anyone else in UTC-5 (or other DST observing region) repro on either a Win7 or Linux system?

[ 3509/11467] TestFile#testutime = 0.00 s
5) Failure:
test
utime(TestFile) [c:/Jenkins/workspace/ruby-trunk-svn/test/ruby/test_file.rb:287]:
.
expected but was
.
...
Finished tests in 641.449135s, 17.8767 tests/s, 4150.9932 assertions/s.
11467 tests, 2662651 assertions, 1 failures, 0 errors, 83 skips

ruby -v: ruby 2.0.0dev (2012-11-04 trunk 37467) [i386-mingw32]


Related issues

Related to Backport93 - Backport #6385: mtime vie File.stat(filename).utime vs File.open(filename... Closed 05/01/2012

Associated revisions

Revision 38992
Added by Nobuyoshi Nakada about 1 year ago

win32.h: revert r37337

  • include/ruby/win32.h (fstat): revert r37337, which uses _fstati64() instead of fstati64() on mingw32. [Bug #7276]

History

#1 Updated by Jon Forums over 1 year ago

Appears to be a trunk regression as TestFile#test_utime passes on ruby19_3@37334

C:\Jenkins\workspace\ruby-193-svn>ruby -v test\ruby\test_file.rb
ruby 1.9.3p305 (2012-10-26 revision 37334) [i386-mingw32]
Run options:

Running tests:

................................

Finished tests in 1.154402s, 27.7200 tests/s, 127.3387 assertions/s.

#2 Updated by Yusuke Endoh over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to Nobuyoshi Nakada

#3 Updated by Jon Forums over 1 year ago

Ping.

This is the only test-all fail I have when building trunk on Win7 with mingw-w64 gcc 4.7.2.

This fail does not show up at http://ci.rubyinstaller.org/ because the current build slaves reside in an area that doesn't participate in the daylight savings time circus.

#4 Updated by Luis Lavena over 1 year ago

  • Assignee changed from Nobuyoshi Nakada to Usaku NAKAMURA

Nakamura-san,

Do you have any idea about this? Nobu seems not responding so perhaps you can help us figure out the best solution for this.

Thank you.

#5 Updated by Jon Forums over 1 year ago

No failure when building trunk@37710 on Arch 3.6.6 with gcc 4.7.2

#6 Updated by Hiroshi Shirosaki over 1 year ago

This seems due to r37337. I don't know the reason of r37337, but reverting the commit (use rbw32fstati64 for fstat) will fix this.

#7 Updated by Usaku NAKAMURA over 1 year ago

  • Assignee changed from Usaku NAKAMURA to Nobuyoshi Nakada

#8 Updated by Jon Forums over 1 year ago

This still fails as of r38131 on my Win7 32bit system. Given Shirosaki-san's comment, what's preventing this from being quickly fixed on trunk?

Since this bug is not made visible by the rubyinstaller CI (build slave location) I will manually run any tests or builds you need in order to validate the fix. Let me know what you need.

#9 Updated by Jon Forums over 1 year ago

Status? Is this planned to be fixed for 2.0.0?

This is the only failure I get when building trunk (make test-all and make test) with mingw-w64 4.7.2 32bit on Win7.

As stated previously, you don't see this failure at http://ci.rubyinstaller.org/ because Luis' build slaves are located in an uneffected timezone.

#10 Updated by Heesob Park about 1 year ago

This daylight savings time bug is described at
http://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting
and
http://support.microsoft.com/kb/158588/en-us

The workaround is using the Windows API call instead of using the C library call.

#11 Updated by Jon Forums about 1 year ago

Nobu-san: why was r37337 required and rb_w32_fstati64 no longer correct?

Heesob: good read. After reverting r37337 as per Hiroshi's comment, I get 0 fails on trunk@38966 (Win7 32bit + mingw-w64 4.7.2) because fstat -> rb_w32_fstati64 (win32/win32.c:4474) rather than fstat -> _fstati64 which causes mingw-w64 to use msvcrt's _fstat64 (i686-w64-mingw32/include/mingwstat64.h:12)

http://msdn.microsoft.com/en-us/library/221w8e43%28v=vs.90%29.aspx

Given the info you linked, do you think the current rb_w32_fstati64 is a valid workaround? Does reverting r37337 also work for you on Win8?

#12 Updated by Heesob Park about 1 year ago

Reverting r37337 works on Windows 8.

I think the only drawback to rbw32fstati64 is a little performance loss.

#13 Updated by Nobuyoshi Nakada about 1 year ago

I don't remember the reason well, probably some mingw failed to link the dll or extension libraries.
But I can't find which failed, so revert it.

#14 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38992.
Jon, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


win32.h: revert r37337

  • include/ruby/win32.h (fstat): revert r37337, which uses _fstati64() instead of fstati64() on mingw32. [Bug #7276]

Also available in: Atom PDF