From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_PASS,T_DKIM_INVALID, T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 52B831FA7B for ; Sun, 11 Jun 2017 03:44:02 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 17A5D1207C7; Sun, 11 Jun 2017 12:43:58 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id E424F1207C1 for ; Sun, 11 Jun 2017 12:43:55 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=gzDvmMcKYW/oElLqi/6yIAHGG/w=; b=EFJ4VBy5VsaAEehpCF SRJwmVRNn2peqgAarYlOPJvFI6c1GdClXu++tIKEiqB3kfbFWl6+woBZ4Sq1VCB2 it7INx3P1YfM4uXJ14d48rDUUoy1BcuioeOzomnVWrVInyfLuU4NWFY+JdvOTr6l 5D2bY/r+aQyUbPaRfWe2rMIR4= Received: by filter1187p1mdw1.sendgrid.net with SMTP id filter1187p1mdw1-31454-593CBC77-2B 2017-06-11 03:43:51.466548586 +0000 UTC Received: from herokuapp.com (ec2-54-81-93-203.compute-1.amazonaws.com [54.81.93.203]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id TQ4m44x6TgSo_SgzuWaZFQ Sun, 11 Jun 2017 03:43:51.425 +0000 (UTC) Date: Sun, 11 Jun 2017 03:43:51 +0000 From: Greg.mpls@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 56677 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13644 X-Redmine-Issue-Author: MSP-Greg X-Redmine-Sender: MSP-Greg X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS4I95R1HqaMdDTCWz/j0+Nrkek1LtAmjh69jd WZMepCr3e4YVD+G0mkULh3Sh7qYkIxPy0bT+30683ghkmRgGu+KI7KpgZk3WkPldFLpK9STIxH83jE MlB45Q43CfwR2e591X3SP/SXDdI0MHhHcSnnKL7X1h96Bz/XeEM73jpk3w== X-ML-Name: ruby-core X-Mail-Count: 81649 Subject: [ruby-core:81649] [Ruby trunk Bug#13644] Windows - Setting Time.now X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #13644 has been updated by MSP-Greg (Greg L). File test-logger-test_logdevice.rb.patch added nobu, Attached is the patch I'm using in my MinGW build system for the test in question. It passes, and my [test-all](https://msp-greg.github.io/file.mingw_test-all.html#test-all-3-failures) is now at 3 failures. I ran into three issues with the current test mock. 1. Once I patched logger to use atime, the test wouldn't pass if the FakeTime.now DST setting was different that the current system DST setting. So, I moved the mock FakeTime.now to today. 2. Temp Directories using a block. I had issues with readline tests and temp files. With this, I could not get all the asserts to pass with a block. As to files, I believe Windows may have issues with - if process A does not close a file, process B can neither close nor delete the file. 3. As I understand Logger, there was code that would not be used in a normal Logger application. Removed/changed code that opened the log file first, code that closed and then opened (with `.new`) the log file, etc. The current test uses a midnight delta of -1mS and +01:01:01. The plus delta seems high, and from the [GH 539](https://github.com/ruby/ruby/pull/539), the author (megayu) states > In my real situation, if there is some events in 23:59:59, it will never shift the log file. Seems to imply a minus delta of around a second. So, I set up the test with a symmetrical delta. I tested three deltas, 1000mS, 500mS, and 10mS, no failures with three processes running 50 tests each. I can't test any other platform without pushing a PR. I learned a bit about the logger library. Aside - found an interesting line in the file #729, just after the test in question. ``` env_tz_works = /linux|darwin|freebsd/ =~ RUBY_PLATFORM # borrow from test/ruby/test_time_tz.rb ``` ---------------------------------------- Bug #13644: Windows - Setting Time.now https://bugs.ruby-lang.org/issues/13644#change-65345 * Author: MSP-Greg (Greg L) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.0dev (2017-06-04 trunk 59013) [x64-mingw32] * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- While reviewing a MinGW build `test-all` failure in [TestLogDevice#test_shifting_midnight_exist_file](https://github.com/ruby/ruby/blob/trunk/test/logger/test_logdevice.rb#L687-L727), I determined the cause. The test in question (and other tests that seem to have newer/better exception handling) sets `Time.now`. The thread [StackOverflow - Change system date programmatically](https://stackoverflow.com/questions/650849/change-system-date-programmatically) seems to imply that in some instances/configurations, changing the system time on Windows systems requires elevated permissions. I tested on both a mswin build (`ruby 2.5.0dev (2017-05-27 trunk 58922) [x64-mswin64_140]`) and a MinGW build (`ruby 2.5.0dev (2017-06-08 trunk 59046) [x64-mingw32]`), and both responded to: ```ruby Time.now = Time.mktime(2017, 1, 3, 1, 1, 1) ``` with the following eror: ``` undefined method `now=' for Time:Class (NoMethodError) ``` Both also had `false = Time.respond_to?(:now=)`. So, I'm confused as to how this test passes on mswin. Regardless, the test requires a skip to bypass it and allow MinGW test-all to pass. I thought I'd file an issue before doing a PR. I'm building and testing on Win7. Finally, if anyone has time, where is the method `now=` defined? ---Files-------------------------------- test-logger-test_logdevice.rb.patch (3.6 KB) -- https://bugs.ruby-lang.org/