Zulip Chat Archive

Stream: lean4

Topic: readFile omits parts of the file


Eric Wieser (Aug 01 2024 at 02:12):

I was pretty surprised to discover this:

#eval do
  let path := "/tmp/lean-zulip-example"
  IO.FS.writeBinFile path
    ("Hello\x00(this is a very secret message that must never be shared) world".toUTF8)
  let x  IO.FS.readFile path
  IO.println x

Eric Wieser (Aug 01 2024 at 02:13):

(lean4#4891)

Eric Wieser (Aug 01 2024 at 02:20):

(sorry for the edits, I over-minimized this to begin with)

Mac Malone (Aug 03 2024 at 03:51):

Yep, this was fun to discover while validating Lake's TOML parser. Interesting, this behavior is noted in the comments of the C get line funciton, but nowhere in the Lean code.

Henrik Böving (Aug 03 2024 at 07:04):

I have a fix for it, will PR next week

Henrik Böving (Aug 05 2024 at 06:38):

https://github.com/leanprover/lean4/pull/4906


Last updated: May 02 2025 at 03:31 UTC