Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,867
    • Issues 4,867
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 457
    • Merge requests 457
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #19976
Closed
Open
Created Jun 10, 2021 by Bodigrim@BodigrimDeveloper

Mysterious issue with bytestring "LazyWord8.fromString literal" test

Reproduction

git clone https://github.com/haskell/bytestring
cd bytestring
# git checkout 06cbef10f4869c6afdac210a22d9813b4f7f2fe6

Run tests with GHC 8.10 and 9.0, both should succeed:

$ cabal run -w ghc-8.10.4 prop-compiled -- --hide-successes -p "LazyWord8.fromString literal"
All 1 tests passed (0.00s)
$ cabal run -w ghc-9.0.1 prop-compiled -- --hide-successes -p "LazyWord8.fromString literal"
All 1 tests passed (0.00s)

Now apply an innocent patch:

$ git show d701a2a9a51da47da8240a7d3adf2794ba891e90
--- a/Data/ByteString/Lazy/Internal.hs
+++ b/Data/ByteString/Lazy/Internal.hs
+packBytes [] = Empty
 packBytes cs0 =
     packChunks 32 cs0
...
 packChars :: [Char] -> ByteString
+packChars [] = Empty
 packChars cs0 = packChunks 32 cs0

$ git cherry-pick d701a2a9a51da47da8240a7d3adf2794ba891e90
Auto-merging Data/ByteString/Lazy/Internal.hs

and rerun tests.

Expected results

Tests suceed both in GHC 8.10.4 and 9.0.1.

Actual results

Tests succeed in GHC 8.10.4, but fail in 9.0.1:

$ cabal run -w ghc-8.10.4 prop-compiled -- --hide-successes -p "LazyWord8.fromString literal"
All 1 tests passed (0.00s)
$ cabal run -w ghc-9.0.1 prop-compiled -- --hide-successes -p "LazyWord8.fromString literal"
All
  LazyWord8
    fromString literal: FAIL
      *** Failed! Falsified (after 1 test)

What surprises me most is that the failing test has no apparent connection to the patch in question:

  , testProperty "fromString literal" $
    fromString "\0\1\2\3\4" == B.pack [0,1,2,3,4]

See earlier discussion at https://github.com/haskell/bytestring/pull/394 CC @sjakobi @phadej

Edited Jun 10, 2021 by Bodigrim
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking