Crystal: 0.24.2 - error `String contains null byte` when running in path with non ASCII chars

Created on 10 Mar 2018  Â·  9Comments  Â·  Source: crystal-lang/crystal

Error:

$ cd ~/Документы/Проекты
$ echo 'puts "123"' > test.cr
$ crystal run test.cr
String contains null byte
???
???
???
???
???
???
???
???

Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

All is ok:

$ cd /tmp
$ echo 'puts "123"' > test.cr
$ crystal run test.cr
123

Most helpful comment

I always suggest to keep moving forward with breaking changes and releases in master and forget about hot fixes and bug fixes releases until we hit 1.0. It's simpler, and this kind of issues don't happen. But it seems they don't like it (I think everyone except Manas liked the old way)

All 9 comments

I can reproduce this, but using a built compiler seems to make it go away. Investigating more...

Narrowed it down to this corruption: https://carc.in/#/r/3p2k

p "/home/rx14/Документы/Проекты/test.cr".gsub('/', '-')
"-home-rx14-Доку\xD0-ент\xD1-/Про\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"

triggered by https://github.com/crystal-lang/crystal/blob/92c3d42315760c08bdeca9d414188bb633299d10/src/compiler/crystal/codegen/cache_dir.cr#L34

Looks like a duplicate of #5348, the fix for which didn't make it into 0.24.2.

Thanks for investigation :)

It's odd that old issue is closed and bug was still there in 0.24.2 release.

@ZaWertun 0.24.2 was released from a different branch with cherry-picked bugfixes. Unfortunately this bugfix wasn't cherry-picked for 0.24.2. Given how badly 0.24.2 seems to have gone I hope we don't do the same again.

Ah, got it

@RX14 This is really sad considering that you explicitly recommended to include #5348 in 0.24.2 :(

I always suggest to keep moving forward with breaking changes and releases in master and forget about hot fixes and bug fixes releases until we hit 1.0. It's simpler, and this kind of issues don't happen. But it seems they don't like it (I think everyone except Manas liked the old way)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ArthurZ picture ArthurZ  Â·  3Comments

RX14 picture RX14  Â·  3Comments

TechMagister picture TechMagister  Â·  3Comments

asterite picture asterite  Â·  3Comments

lgphp picture lgphp  Â·  3Comments