Non-UTF8 value in the environment crashes the server
inejge opened this issue · comments
If there is a non-UTF8 value in the environment at startup, the server will panic.
RUST_BACKTRACE=1 BAD_ENV=$(printf '\250') cargo run --quiet --example hello_world
leads to:
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: "\u{fffd}"', ../src/libcore/result.rs:785
stack backtrace:
1: 0x7f2edad28fe4 - std::sys::backtrace::tracing::imp::write::h6528da8103c51ab9
2: 0x7f2edad2c99b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hbe741a5cc3c49508
3: 0x7f2edad2c623 - std::panicking::default_hook::he0146e6a74621cb4
4: 0x7f2edad1e2fd - std::panicking::rust_panic_with_hook::h587239a80cad02d2
5: 0x7f2edad2cc31 - std::panicking::begin_panic::h77cefecf7d758cdf
6: 0x7f2edad1fa8a - std::panicking::begin_panic_fmt::hb3024643f3039337
7: 0x7f2edad2cbc1 - rust_begin_unwind
8: 0x7f2edad623ff - core::panicking::panic_fmt::h5594591d20dedfcd
9: 0x7f2edad1f48f - core::result::unwrap_failed::hb2a22bd06e85c51b
10: 0x7f2edad1f3d4 - _<std..env..Vars as core..iter..iterator..Iterator>::next::hfe079082d9fccd19
11: 0x7f2edab424ae - _<&'a mut I as core..iter..iterator..Iterator>::next::hd1d3bb66bf0adbc9
at ../src/libcore/iter/iterator.rs:2109
12: 0x7f2edab422e3 - core::iter::iterator::Iterator::any::h629a4dd9dd82e53f
at ../src/libcore/iter/iterator.rs:1417
13: 0x7f2edab3e7cc - _<nickel..nickel..Nickel<D>>::listen::h0d40cbd89d03c8aa
at src/nickel.rs:214
14: 0x7f2edab315f4 - hello_world::main::h828adf8c4b210db6
at examples/hello_world.rs:12
15: 0x7f2edad2c238 - std::panicking::try::call::hd0906b54b9bfbb20
16: 0x7f2edad3663b - __rust_try
17: 0x7f2edad365de - __rust_maybe_catch_panic
18: 0x7f2edad2bc6c - std::rt::lang_start::hfe4efe1fc39e4a30
19: 0x7f2edab6b109 - main
20: 0x7f2ed9ec8d5c - __libc_start_main
21: 0x7f2edab09c88 - <unknown>
error: Process didn't exit successfully: `target/debug/examples/hello_world` (exit code: 101)
A PR with a fix is incoming.