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

Fix for exception on hanging doublequote #222

Conversation

gzh
Copy link
Contributor

@gzh gzh commented Feb 27, 2023

Hi,

There's a problem with escaped fields parser, -- it is partial on opening double quote. Means, it throws Haskell error instead of properly failing. The problem is because of ByteString.init being called on possibly empty bytestring (w/o checking). This small PR suggest a fix for this, plus adds some tests for decoding of escaped input.

@yitz-zoomin
Copy link

@andreasabel @phadej Any updates on this simple fix for a nasty bug (caused by use of partial function init)?

@yitz-zoomin yitz-zoomin force-pushed the bugfix/exception-on-hanging-doublequote branch from 8feec3e to a4627a6 Compare January 3, 2024 16:39
@yitz-zoomin yitz-zoomin force-pushed the bugfix/exception-on-hanging-doublequote branch from 47d7eb5 to c7bdbca Compare January 3, 2024 16:53
@andreasabel
Copy link
Member

Tests are failing, e.g. https://github.com/haskell-hvr/cassava/actions/runs/7400077740/job/20151432820?pr=222#step:20:84

escapedMalformed1: [Failed]

Building the tests also fails, e.g. https://github.com/haskell-hvr/cassava/actions/runs/7400077740/job/20151434424?pr=222#step:19:34

tests/UnitTests.hs:64:52: error:
• Variable not in scope: (<>) :: IO a0 -> String -> Assertion

@andreasabel andreasabel added this to the 0.5.3.2 milestone Aug 3, 2024
@andreasabel andreasabel self-assigned this Aug 3, 2024
@andreasabel andreasabel added the re: error reporting Concerning error messages delivered by the parser label Aug 3, 2024
andreasabel pushed a commit that referenced this pull request Aug 3, 2024
Squashed from commits:

- task: add test cases for decoding escaped input

  Test case `escapedMalformed0` is failing, throwing uncaught `error`

- fix: handle case when input for field parser is a single opening double-quote

- Fix output of escapedMalformed1 test
  (this contribution got deleted)

- Fixup PR #222: remove failing test, drop testing for GHC < 8.4

Co-authored-by: German Zhyvotnikov <[email protected]>
@andreasabel andreasabel mentioned this pull request Aug 3, 2024
@andreasabel
Copy link
Member

Fixup of this PR in

@andreasabel andreasabel closed this Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: error reporting Concerning error messages delivered by the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants