haskell / ghc-events

Library and tool for parsing .eventlog files from GHC
http://www.haskell.org/haskellwiki/ThreadScope
Other
33 stars 34 forks source link

Allow parsing UserBinaryMessage events that have non-utf payloads #91

Closed TeofilC closed 1 year ago

TeofilC commented 1 year ago

This keeps behaviour pretty much in line with what we have currently. Instead of failing on non-utf binary payloads, we just replace non-utf8 text with '.' as we do for non-printable characters.

Fixes #90

Mikolaj commented 1 year ago

This changes a bit more than seems necessary (perhaps for the better). One can hope decodeUtf8With doesn't crash if it encounters "unprintable bytes". Do you think a test (a little eventlog with some unprintable bytes, non-utf payloads and both) would be reasonably easy to add?

maoe commented 1 year ago

LGTM.

One can hope decodeUtf8With doesn't crash if it encounters "unprintable bytes".

As far as I can see, it never crashes unless you pass a function that crashes, which is not the case here.

Do you think a test (a little eventlog with some unprintable bytes, non-utf payloads and both) would be reasonably easy to add?

That would be great.

TeofilC commented 1 year ago

I've added a test that contains an event with some non-utf text

TeofilC commented 1 year ago

Is this ready to merge or would you like anything changed @maoe ?

Mikolaj commented 1 year ago

If @maoe is busy, I can merge once I remember what it's about, but for a release we'd better wait for @maoe.

maoe commented 1 year ago

Sorry for the delay. I'll take a look again tomorrow.

maoe commented 1 year ago

LGTM. Thanks!

TeofilC commented 1 year ago

Thanks both! Literally no worries about the delay

maoe commented 1 year ago

Released https://hackage.haskell.org/package/ghc-events-0.18.0