Opened 7 months ago

Last modified 6 months ago

#16201 patch bug

ghci063 failing on Darwin

Reported by: bgamari Owned by:
Priority: highest Milestone: 8.8.1
Component: Compiler Version: 8.6.3
Keywords: ci-breakage Cc:
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): https://gitlab.haskell.org/ghc/ghc/merge_requests/440
Wiki Page:

Description

The test in question is just a normal ghci_script test:

:! echo module A where {} >A.hs
:! echo module B where { import A } >B.hs

:load B

-- We're going to replace B.hs with an invalid module but without
-- changing its timestamp.  A :reload should *not* look at the
-- contents of the file, because the timestamp hasn't changed.
:! cp B.hs B.hs-copy
:! touch -r B.hs B.hs-copy
:! echo "*** INVALID ***" >B.hs
:! touch -r B.hs-copy B.hs

:reload

-- Put the original file back, now it should work
:! cp B.hs-copy B.hs
:reload

I have no idea why GHCi would be trying to parse the !echo, much less only on Darwin.

This is currently the last issue Darwin issue keeping us from setting allow_failure to false so I'm going to mark this as broken.

Change History (8)

comment:1 Changed 6 months ago by RyanGlScott

Ironically, ghci063 is now breaking the CI build on validate-x86_64-darwin because it is unexpectedly passing (nondeterministically, of course). Here is an example from a recent run:

=====> ghci063(ghci) 1644 of 6844 [0, 0, 0]
cd "ghci/scripts/ghci063.run" && HC="/Users/builder/builds/b4bc6410/0/ghc/ghc/inplace/bin/ghc-stage2" HC_OPTS="-dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output " "/Users/builder/builds/b4bc6410/0/ghc/ghc/inplace/bin/ghc-stage2" --interactive -v0 -ignore-dot-ghci -fno-ghci-history +RTS -I0.1 -RTS -fghci-leak-check -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output   < ghci063.script

<elided>

*** unexpected pass for ghci063(ghci)

<elided>

SUMMARY for test run started at Sat Feb 23 21:45:56 2019 PST
 0:27:56 spent to go through
    6844 total tests, which gave rise to
   26554 test cases, of which
   19254 were skipped

      42 had missing libraries
    7156 expected passes
     101 expected failures

       0 caused framework failures
       0 caused framework warnings
       1 unexpected passes
       0 unexpected failures
       0 unexpected stat failures

Unexpected passes:
   ghci/scripts/ghci063.run  ghci063 [unexpected] (ghci)

comment:2 Changed 6 months ago by RyanGlScott

Keywords: ci-breakage added

comment:3 Changed 6 months ago by int-index

I have confirmed the non-deterministic nature of this locally. Out of 6 repeated runs there was 1 unexpected pass.

comment:4 Changed 6 months ago by int-index

I figured it out, touch -r leads to precision loss:

ghc(master)*$ echo "" > file
ghc(master)*$ /nix/store/acnfbicd84bnya2l2dq868b5l482qihw-coreutils-8.30/bin/stat file  
  File: file
  Size: 1         	Blocks: 8          IO Block: 4096   regular file
Device: 1000004h/16777220d	Inode: 14905419    Links: 1
Access: (0644/-rw-r--r--)  Uid: (  501/int-index)   Gid: (   20/   staff)
Access: 2019-02-25 01:11:23.807505116 +0300
Modify: 2019-02-25 01:11:23.807627350 +0300
Change: 2019-02-25 01:11:23.807627350 +0300
 Birth: 2019-02-25 01:11:23.807505116 +0300
ghc(master)*$ touch -r file file
ghc(master)*$ /nix/store/acnfbicd84bnya2l2dq868b5l482qihw-coreutils-8.30/bin/stat file
  File: file
  Size: 1         	Blocks: 8          IO Block: 4096   regular file
Device: 1000004h/16777220d	Inode: 14905419    Links: 1
Access: (0644/-rw-r--r--)  Uid: (  501/int-index)   Gid: (   20/   staff)
Access: 2019-02-25 01:11:23.807505000 +0300
Modify: 2019-02-25 01:11:23.807627000 +0300
Change: 2019-02-25 01:11:39.159813166 +0300
 Birth: 2019-02-25 01:11:23.807505116 +0300

The test passes nondeterministically when the last three digits are zero even before touch, I think. I was lucky to observe this locally after only a few runs, otherwise I would probably not even attempt to debug this!

The solution is to do touch -r B.hs B.hs to nullify the digits before the first :load.

Last edited 6 months ago by int-index (previous) (diff)

comment:5 Changed 6 months ago by int-index

Differential Rev(s): https://gitlab.haskell.org/ghc/ghc/merge_requests/440

comment:6 Changed 6 months ago by int-index

Status: newpatch

comment:7 Changed 6 months ago by Ben Gamari <ben@…>

In 0b705fad/ghc:

testsuite: Mark ghci063 as broken on Darwin

This is the last failing test on Darwin preventing us from disallowing CI
failures. See #16201.

comment:8 Changed 6 months ago by Vladislav Zavialov <vlad.z.4096@…>

In f320f3b/ghc:

Fix the ghci063 test on Darwin (Trac #16201)

We use "touch -r" to set modification timestamps, which leads to precision loss
on Darwin. For example,

   before: 2019-02-25 01:11:23.807627350 +0300
   after:  2019-02-25 01:11:23.807627000 +0300
                                     ^^^
This means we can't trick GHCi into thinking the file hasn't been changed by
restoring its old timestamp, as we cannot faithfully restore all digits.

The solution is to nullify the insignificant digits before the first :load
Note: See TracTickets for help on using tickets.