https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112017-05-23T14:29:05ZRuby Issue Tracking SystemRuby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=650452017-05-23T14:29:05Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>MSVCRT uses <code>TZ</code>.<br>
See <a href="https://msdn.microsoft.com/en-us/library/w4ddyt9h.aspx" class="external">https://msdn.microsoft.com/en-us/library/w4ddyt9h.aspx</a></p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=650492017-05-23T15:39:01ZMSP-Greg (Greg L)
<ul></ul><p>Using a MinGW build, ENV['TZ'] seemed to have no affect on Time, and <a href="https://msp-greg.github.io/file.mingw_test-all.html#mspec-1-failure" class="external">time zone spec tests</a> failed.</p>
<p>I had previously been looking at 'Microsoft Time Zone Index Values'. Time#zone returns a value from the list, but setting ENV['TZ'] to another value did not seem to have the expected result.</p>
<p>Given that spec tests are not currently included in appveyor, do you know if the test <a href="https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/time/zone_spec.rb#L65-L77" class="external">'defaults to UTC when bad zones given'</a> passes on a mswin64 build?</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=650532017-05-23T17:33:27Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>MSP-Greg (Greg L) wrote:</p>
<blockquote>
<p>Given that spec tests are not currently included in appveyor, do you know if the test <a href="https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/time/zone_spec.rb#L65-L77" class="external">'defaults to UTC when bad zones given'</a> passes on a mswin64 build?</p>
</blockquote>
<p>You can see the results on <a href="http://rubyci.org/" class="external">RubyCI</a>.<br>
<code>vc12-x64</code> (known as mswinci) is a mswin64 CI.<br>
Its report of trunk includes the result of Spec.</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651202017-05-27T02:46:21ZMSP-Greg (Greg L)
<ul><li><strong>ruby -v</strong> changed from <i>ruby 2.5.0dev (2017-05-18 trunk 58780) [x64-mingw32]</i> to <i>ruby 2.5.0dev (2017-05-27 trunk 58911) [x64-mswin64_140]</i></li></ul><p>Having now built with <a href="https://github.com/unak/mswin-build" class="external">mswin-build</a>, this test still fails. Also, I'm seeing some of the same issues in test-all (test-enum callcc segv, etc).</p>
<p>Please try and run the spec tests (or this specific test) from a command prompt. Something is amiss if I'm getting different results...</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651222017-05-27T05:18:23Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>I haven't seen such failure on AppVeyor yet.<br>
<a href="https://ci.appveyor.com/project/nobu/ruby/build/1.0.119" class="external">https://ci.appveyor.com/project/nobu/ruby/build/1.0.119</a></p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651262017-05-27T05:53:47ZMSP-Greg (Greg L)
<ul></ul><p>Nobu,</p>
<p>I'll have a look at your code, see if I can determine whats going on. Believe me, I did a couple of builds, and it kept failing...</p>
<p>Thanks.</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651272017-05-27T09:33:37ZEregon (Benoit Daloze)
<ul><li><strong>Assignee</strong> set to <i>Eregon (Benoit Daloze)</i></li></ul><p>FWIW the patch looks OK to me, I think we should merge it.</p>
<p>This might be a difference between the different configuration of Windows builds.<br>
Testing for invalid timezones is rather difficult,<br>
some platforms behave differently, and this test had to be refined a couple times to work on all Linux CIs.</p>
<p>MSP-Greg (Greg L) wrote:</p>
<blockquote>
<p>I'll have a look at your code, see if I can determine whats going on. Believe me, I did a couple of builds, and it kept failing...</p>
</blockquote>
<p>Could you just post a failing stacktrace here when running the test in isolation?<br>
You can do so with $ make test-rubyspec MSPECOPT="-e bad spec/rubyspec/core/time/zone_spec.rb"<br>
or $ spec/mspec/bin/mspec -e bad spec/rubyspec/core/time/zone_spec.rb<br>
if the built ruby is on $PATH.</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651292017-05-27T10:26:09Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Rejected</i> to <i>Feedback</i></li></ul><p>Once I reproduced the behavior, but after some maintenance of my mingw environment, it doesn't appear.</p>
<p>Anyway at this time, it's considered as a bug of ruby or spec or mingw or something.<br>
Just removing spec sounds not appropriate.</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651322017-05-27T15:46:30ZMSP-Greg (Greg L)
<ul></ul><p>Sorry for the delay, I'm at -0500 (Central US), and I seem to have lost a video card this morning.</p>
<p>Anyway, error is identical to <a href="https://msp-greg.github.io/file.mingw_test-all.html#mspec-1-failure" class="external">mingw mspec</a>. Below is the full rubyspec results from nmake (I believe the 2nd failure is intermittent):</p>
<pre><code>1)
Time#zone defaults to UTC when bad zones given FAILED
Expected 3600
to equal 0
E:/build/mswin-build/ruby/spec/rubyspec/core/time/zone_spec.rb:68:in `block (4 levels) in <top (required)>'
E:/build/mswin-build/ruby/spec/rubyspec/core/time/zone_spec.rb:67:in `block (3 levels) in <top (required)>'
E:/build/mswin-build/ruby/spec/rubyspec/core/time/zone_spec.rb:3:in `<top (required)>'
2)
C-API Thread function rb_thread_call_without_gvl runs a C function with the global lock unlocked FAILED
Expected nil not to be nil
E:/build/mswin-build/ruby/spec/rubyspec/optional/capi/thread_spec.rb:114:in `block (3 levels) in <top (required)>'
E:/build/mswin-build/ruby/spec/rubyspec/optional/capi/thread_spec.rb:16:in `<top (required)>'
Finished in 214.546800 seconds
3568 files, 25779 examples, 202018 expectations, 2 failures, 0 errors, 0 tagged
NMAKE : fatal error U1077: '.\ruby.exe' : return code '0x1'
</code></pre>
<p>I've got recent mswin and mingw builds, and did some irb exploring. On windows, ENV['TZ'] seems like a read-only setting.</p>
<p>My mingw/MSYS2 env is up to date, and I run as much of my building from the command prompt as possible, with only what is required in PATH. As to MinGW, I've built several OpenSSL packages (which pass all OpenSSL and Ruby OpenSSL tests), and a GDBM package. The doc site is generated from recent mingw builds, and I've got curses, eventmachine w/SSL, libxml, nokogiri, rdiscount, redcarpet, RedCloth, and Thin gem extensions installed.</p>
<p>I'm building mswin with VS2017, and I'm using Win7. I may have OpenSSL-Win 1.1.0f configured wrong, as I've got an issue in test-all that stops it. I hope to get mswin test-all completing soon. Previous builds seemed to show a segv issue that also occurred in MinGW builds with <code>test_enum.rb</code> / <code>TestEnumerable#test_callcc</code>.</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651332017-05-27T17:25:22ZEregon (Benoit Daloze)
<ul></ul><p>Interesting, an offset of 3600 means 1 hour so UTC+1, like current TZ=Europe/London summer time.</p>
<p>Does anyone know what could go wrong?</p>
<p>I am thinking part of it might be that C functions related to time<br>
might behave slightly differently between OS and<br>
the result might also depend on the system time zone and settings<br>
(if the system time zone is UTC then we cannot test the difference between local zone and UTC zone).</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=651342017-05-27T18:39:08ZMSP-Greg (Greg L)
<ul></ul><p>Usaku,</p>
<p>You are correct. Linked from the page you mentioned is <a href="https://msdn.microsoft.com/en-us/library/90s5c885.aspx" class="external">_tzset</a>. This (sort of) doc's what ENV['TZ'] can be set to.</p>
<p>From my testing, the strings can be anything. I called the following with several strings.</p>
<pre><code>puts "TZ DST SST"
def tz_test(s)
dst = [2017, 6, 1, 12, 0] # daylight - June
sst = [2017, 1, 1, 12, 0] # standard - January
ENV['TZ'] = s
puts "#{s.ljust(10)} #{(Time.new(*dst).utc_offset/3600).to_s.rjust(4)} #{(Time.new(*sst).utc_offset/3600).to_s.rjust(4)}"
end
</code></pre>
<p>output below.</p>
<pre><code>TZ DST SST
hello-foo 1 0
hello+foo 1 0
1,2 0 0
Sun,Fri,2 1 0
12 0 0
-1aaa 1 0
aaa+8 -8 -8
AAA+8 -8 -8
aaa+8bbb -7 -8
AAAA+8BBBB 1 0
aaa-8 8 8
AAA-8 8 8
aaa-8bbb 9 8
AAAA-8BBBB 1 0
</code></pre>
<p>A classic case of a function that assumes you have validated the input, and, if not, be prepared for anything. My opinion, Ruby mingw and mswin builds are fine, the <code>_tzset</code> function is expecting validation that ruby can't or shouldn't do. There's a gem for that...</p> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=654182017-06-19T13:00:18ZEregon (Benoit Daloze)
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li></ul><p>Applied in changeset trunk|r59113.</p>
<hr>
<p>Adapt Time#zone spec to deal with differences of TZ validation on Windows</p>
<ul>
<li>[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ'] (Closed)" href="https://redmine.ruby-lang.org/issues/13591">#13591</a>] <a href="/issues/13591">[ruby-core:81347]</a></li>
</ul> Ruby master - Bug #13591: spec/rubyspec/core/time/zone_spec - Windows does not support ENV['TZ']https://redmine.ruby-lang.org/issues/13591?journal_id=654192017-06-19T13:02:26ZEregon (Benoit Daloze)
<ul></ul><p>Fixed in r59113.<br>
I split the spec to only include cases that seem to work on Windows according Greg's tests.<br>
This test is inherently dependent on the OS parsing function for TZ, so we need to deal with those differences.</p>