-
Notifications
You must be signed in to change notification settings - Fork 141
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
∞-loop, space==bound in primMapByteStringBounded #204
Conversation
In primMapByteStringBounded, when the potentially needed space for encoding one more byte (the 'bound' of the provided BoundedPrim) is exactly equal to the free space in the output buffer, we must fill the buffer, rather than signal BufferFull. Otherwise, when we ask for "bounded" more bytes, no new space is allocated, and an infinite loop follows.
What's the next step? Is there anything I need to do? |
Since @hvr has already expressed his desire for this fix in #117 I believe he or @dcoutts will accept and merge this PR quickly once they become aware of it. Since GitHub @-mentions seem to be rather ineffective means to catch their attention, you may want to try reaching out to them via other channels like IRC or email. Two things might be nice to have (from you), but are not for me to decide:
|
@vdukhovni your PR doesn't build on every version of the ci build matrix |
There are bugs in the test suite:
The master branch sometimes fails with (not at all surprising :-) infinite loop in the builder tests!
None of this is the result of my PR, which actually builds much cleaner than master. |
This test failure is the result of 8-bit truncation of the characters in the input strings, and recent QuickCheck generating unicode strings. The two characters in the string are identical mod 256, but not the same. The ByteString I'll shortly add a commit to this PR to resolve this one. |
That is caused by a file handle I/O roundtrip issue in GHC prior to 7.4 (and so as expected we see failures in 7.2). Rather than attempt to solve this, my inclination is to drop both 7.2 and 7.0 from the test matrix. The latter does not build at all, because "text" fails to build. As for 7.2, I'm not convinced this is worth trying to fix. All the other builds (including GHC "head") currently pass CI. So unless someone things that 7.2 is important to fix, this PR fixes all outstanding CI issues. |
ae7496b
to
3ff987c
Compare
@RyanGlScott any chance you can help out viktor on how to modernize the Travis ci formula and to what extent we can use newer cabal to work around that build failure on 7.0? |
3ff987c
to
5b8b9d6
Compare
I do recommend trying out the Haskell-ci tool to regenerate a better Travis ci formula. Also I think a cabal prject file that’s only used for the ci would fix the other historical cruft |
I tried newer cabal (multiple versions) ... no go. It seems that the real issue is that QuickCheck is too new, and is pulling in |
I'm sceptical that a stock formula would work here, there are some non-trivial bits in the existing one that the stock formula is unlikely to replicate, but I may take a look at what it generates... |
QuickCheck 2.10 still pulls in text 1.2.4.0, which still fails to build. I'm strongly inclined to say that CI for ByteString with 7.0 is not worth the effort. Or at least I don't see why I am the right person to figure this out. This PR is green from 7.4 all the way through 8.10, and only fixes bugs. The master branch also fails with 7.0 and 7.2 and also other versions for which my fixes are needed. While I'm coming up to speed with GHC/Haskell the language, my proficiency with the rest of the toolchain is still limited. I'd like to see #204 merged, and any work to restore CI for 7.0 and 7.2 (if justified) go into a separate follow-on PR. |
c6b8b1c
to
5b8b9d6
Compare
Does not seem to be QuickCheck. AFAIU Travis says:
Basically all these packages ask for Another viable and easier option (which I would personally go for) is to keep building I mean, it's totally reasonable to deprecate GHC 7.2 in 2020, but in this case one has probably to bump a lower version of @vdukhovni I'm sorry for this experience, I very well understand that fixing a critical bug, but waiting for review couple of months and being boggled in CI setup for obsolete GHCs is discouraging. You have all my sympathy. |
tests/Properties.hs
Outdated
-- coerce to 8-bit alphabet to avoid false-positives | ||
= let s8 = C.unpack $ C.pack s | ||
_ = l :: Int | ||
_ = x :: Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, what does this idiom mean? Is it just to fix types of l
and x
? We can probably throw a type signature for prop_findSubstringsBB
for this purpose.
Also, I suggest to keep formating of prop_findSubstringsBB
consistent with the next one, prop_findSubstringBB
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I just moved that code without changing it. Your guess about the syntax looks right to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you do that little cleanup Andrew suggested then I’ll apply this fix to master and then figure out build surgery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I force-pushed an updated and cleaned up set of commits, and perhaps also fixed a less likely, but still possible in principle failure in findSubstring
tests that is essentially the same as the one in findSubstrings
. When the input is not just 8-bit bytes pack
is not injective and there are more matches in the range than in the domain.
That's the current status of this PR. I've disabled tests for 7.0 and 7.2, and everything else passes. I'm not terribly motivated to fix these, but willing to play along for a bit if it turns out doable... |
all understood... maybe the right course of action is i/someone takes your base patch/change set, and then does the CI surgery. given the bandwidth of core folks, dropping from CI needs to be deliberate support work changes, rather than a possible fall through the gaps :) i can have a go, unless someone else feel they have capacity |
Naturally I can't "volunteer" you or anyone else who's not me for the task. Just wanted to mention, if someone is going to look at the build logic, that I haven't figured out how to build |
the answer is gonna be a cabal.project.ci file that we |
Sure, special logic for CI, but even without Travis, I just couldn't get
|
It looks like one of the issues is After removing "blaze" benchmarks from BenchAll.hs, and updating the QuickCheck bounds all cabal files to Progress, but that's a configuration without tests, I'm in too deep, perhaps someone can suggest how to do that... |
Regarding the benchmarks, #196 contains a solution for the dependency issue there. |
Sure, whether the blaze bits are kept or removed, this too needs be addressed. It seems that too many unaddressed issues are in the backlog, and could all be solved in a CI/toolchain PR that addresses the outstanding cabal issues. But then the PRs should be merged promptly, rather than left to bitrot again. |
@sjakobi if I squash and merge this as is, can you prepare a PR ON top that fixes the build and adds back 7 and 7.2? |
@cartazio I'll take a stab at it, but I can't promise how it will work out. Do you know of any users who want to use the next |
.travis.yml
Outdated
@@ -1,8 +1,10 @@ | |||
env: | |||
- GHCVER=7.0.4 CABALVER=1.16 | |||
### GHC 7.0.4 fails to build "text" 1.2.4.0 for QuickCheck | |||
# - GHCVER=7.0.4 CABALVER=1.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you revert commenting these out so we can see the failures inline?
.travis.yml
Outdated
### GHC 7.0.4 fails to build "text" 1.2.4.0 for QuickCheck | ||
# - GHCVER=7.0.4 CABALVER=1.16 | ||
### GHC 7.2.2 fails "hPutBuilder" tests due to encoding roundtrip issues | ||
# - GHCVER=7.2.2 CABALVER=1.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
- Add missing other-modules - Update QuickCheck bounds - Use same QuickCheck bounds in tests .cabal file.
5b8b9d6
to
b723d7b
Compare
I do ;-) |
Also dropping "head" which (being 8.7) is no longer worth testing. Noting: - GHC 7.0 fails to build QuickCheck 1.13, because it pulls in "text" 1.2.4.0 which in turn fails to build. - GHC 7.2 fails the "hPutBuilder test", because random Unicode Strings don't roundtrip read/write in GHC 7.2. Fixing this requires limiting the range of test inputs when GHC is too old.
b723d7b
to
6a0235c
Compare
todo: we should add this bug fix to change log |
LGTM, but note that I don't have much maintenance experience with this package. |
@hvr ? :) |
1 similar comment
@hvr ? :) |
In primMapByteStringBounded, when the potentially needed space for
encoding one more byte (the 'bound' of the provided BoundedPrim)
is exactly equal to the free space in the output buffer, we must
fill the buffer, rather than signal BufferFull.
Otherwise, when we ask for "bounded" more bytes, no new space
is allocated, and an infinite loop follows (at least when the output is
via the direct Builder hPut).
Code that was freezing without the change, runs fine with the test
condition updated to
<=