Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aeson-2.1.2.1 test suite fails on 32bit/i686 #1060

Open
sternenseemann opened this issue Aug 14, 2023 · 2 comments
Open

aeson-2.1.2.1 test suite fails on 32bit/i686 #1060

sternenseemann opened this issue Aug 14, 2023 · 2 comments

Comments

@sternenseemann
Copy link

The offending tests seem to be:

  • /i_number_huge_exp.json.tokens bs/
  • /i_number_huge_exp.json.tokens lbs/
  • /i_number_huge_exp.json.decode via tokens/

Full log

Using Nix/nixpkgs, i686-linux, GHC 9.4.6

@iliastsi
Copy link

We are seeing this in Debian as well, the error is:

  i_number_huge_exp.json
      decode:                                      FAIL
        Test output was different from 'tests/JSONTestSuite/results/i_number_huge_exp.txt'. Output of ["diff","-u","tests/JSONTestSuite/results/i_number_huge_exp.txt","/tmp/i_number_huge_exp3240953-4.actual"]:
        --- tests/JSONTestSuite/results/i_number_huge_exp.txt	2001-09-09 01:46:40.000000000 +0000
        +++ /tmp/i_number_huge_exp3240953-4.actual	2023-10-21 06:05:02.580198038 +0000
        @@ -1 +1 @@
        -Right (Array [Number 4.0e-30000000995])
        +Right (Array [Number 4.0e64770077])
        
        Use -p '$0=="tests.JSONTestSuite.i_number_huge_exp.json.decode"' to rerun this test only.
      decode via tokens:                           FAIL
        Test output was different from 'tests/JSONTestSuite/results/i_number_huge_exp.txt'. Output of ["diff","-u","tests/JSONTestSuite/results/i_number_huge_exp.txt","/tmp/i_number_huge_exp3240953-5.actual"]:
        --- tests/JSONTestSuite/results/i_number_huge_exp.txt	2001-09-09 01:46:40.000000000 +0000
        +++ /tmp/i_number_huge_exp3240953-5.actual	2023-10-21 06:05:02.588198009 +0000
        @@ -1 +1 @@
        -Right (Array [Number 4.0e-30000000995])
        +Right (Array [Number 4.0e64770077])
        
        Use -p '/i_number_huge_exp.json.decode via tokens/' to rerun this test only.
      tokens bs:                                   FAIL (0.01s)
        Test output was different from 'tests/JSONTestSuite/results/i_number_huge_exp.tok'. Output of ["diff","-u","tests/JSONTestSuite/results/i_number_huge_exp.tok","/tmp/i_number_huge_exp3240953-6.actual"]:
        --- tests/JSONTestSuite/results/i_number_huge_exp.tok	2001-09-09 01:46:40.000000000 +0000
        +++ /tmp/i_number_huge_exp3240953-6.actual	2023-10-21 06:05:02.596197979 +0000
        @@ -1,4 +1,4 @@
         TkArrayOpen
         TkItem
        -TkNumber NumScientific 4.0e-30000000995
        +TkNumber NumScientific 4.0e64770077
         TkArrayEnd
        
        Use -p '/i_number_huge_exp.json.tokens bs/' to rerun this test only.
      tokens lbs:                                  FAIL
        Test output was different from 'tests/JSONTestSuite/results/i_number_huge_exp.tok'. Output of ["diff","-u","tests/JSONTestSuite/results/i_number_huge_exp.tok","/tmp/i_number_huge_exp3240953-7.actual"]:
        --- tests/JSONTestSuite/results/i_number_huge_exp.tok	2001-09-09 01:46:40.000000000 +0000
        +++ /tmp/i_number_huge_exp3240953-7.actual	2023-10-21 06:05:02.604197950 +0000
        @@ -1,4 +1,4 @@
         TkArrayOpen
         TkItem
        -TkNumber NumScientific 4.0e-30000000995
        +TkNumber NumScientific 4.0e64770077
         TkArrayEnd
        
        Use -p '/i_number_huge_exp.json.tokens lbs/' to rerun this test only.

I bisected this and found the commit that introduced this regression is f089cdb (CC @phadej ). I believe this commit is wrong because the cached results are only valid for 64-bit systems and not for 32-bit ones. In Debian, I have reverted this commit in Debian for now.

@phadej
Copy link
Collaborator

phadej commented Oct 21, 2023

The real issue here is that on both systems the exponent in numbers may overflow (and on 32bit system JSONTestSuite happened to have tests where it does), but the parse is still successful. So that is clearly wrong.

There are two options:

  • change Scientific exponent to be an Integer, so overflow won't happen. Then the behavior will be the same.
  • Catch overflows and report parse errors. That will result in different behaviors on different systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants