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

πŸ› error: "stream did not contain valid UTF-8" #218

Closed
balta2ar opened this issue Jun 4, 2020 · 3 comments
Closed

πŸ› error: "stream did not contain valid UTF-8" #218

balta2ar opened this issue Jun 4, 2020 · 3 comments

Comments

@balta2ar
Copy link

balta2ar commented Jun 4, 2020

Issue

delta crashes on non-unicode symbols in a patch. diff-so-fancy and git diff handle it just fine.

Output

20:23:22 bz.boltmsi Β» rc.arch 101 β†’ cat /tmp/crash.patch | RUST_BACKTRACE=1 delta
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidData, error: "stream did not contain valid UTF-8" }', /home/bz/.cargo/registry/src/github.com-1ecc6299db9ec823/git-delta-0.1.1/src/main.rs:65:44
stack backtrace:

bz/history/boltmsi-histfile
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────┐
 python -c 'from memrise_sync import interactive; interactive("test3.txt")' β”‚
β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
76
 python -c 'from memrise_sync import interactive; interactive("test1.txt")'
 python -c 'from memrise_sync import interactive; interactive("sample.txt")'
 python -c 'from memrise_sync import interactive; interactive("sample2.txt")'
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  11: rust_begin_unwind
             at src/libstd/panicking.rs:385
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:89
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1272
  14: delta::delta::delta
  15: delta::main
  16: std::rt::lang_start::{{closure}}
  17: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  18: std::panicking::try::do_call
             at src/libstd/panicking.rs:297
  19: std::panicking::try
             at src/libstd/panicking.rs:274
  20: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  21: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  22: main
  23: __libc_start_main
  24: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Diff to reproduce the problem

Among other weird symbols it is supposed to contain Hangul (Korean characters).

crash.txt

Version

delta 0.1.1

@dandavison
Copy link
Owner

Hi @balta2ar, thanks for this. This is fixed in master, but unreleased (see #187). In master it will replace non-utf8 text with a replacement symbol, but in #188 we plan to add support for specifying non-utf-8 encodings explicitly. This is master:

image

If building from source is an option for you, the instructions are simple:


You'll need to install the rust tools. Then:

cargo build --release

and use the executable found at ./target/release/delta.

@balta2ar
Copy link
Author

balta2ar commented Jun 4, 2020

Oops, sorry for the noise, I should have searched existing issues better. Thank you for letting me know this is fixed! I'm fine with waiting for another release cut.

@balta2ar balta2ar closed this as completed Jun 4, 2020
@dandavison
Copy link
Owner

Great. In the future I'll try to get better about releasing bug fixes while new features are under development and hence the master branch is not releasable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants