Subtract with overflow panic in shell_expand
Reproduction:
fn test_func a0 a1 a2 a3
echo $a0 $a1 $a2 $a3
end
let x y = "" ""
let z = $(test_func $x $y $x $x)
Build information:
rustc -V
: rustc 1.33.0-nightly (2fadb0a16 2019-01-13)
git rev-parse HEAD
: e40e7947
Stacktrace:
Stacktrace
thread 'main' panicked at 'attempt to subtract with overflow', src/lib/parser/shell_expand/mod.rs:79:33 stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 1: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:70 2: std::panicking::default_hook::{{closure}} at src/libstd/sys_common/backtrace.rs:58 at src/libstd/panicking.rs:200 3: std::panicking::default_hook at src/libstd/panicking.rs:215 4: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:478 5: std::panicking::continue_panic_fmt at src/libstd/panicking.rs:385 6: rust_begin_unwind at src/libstd/panicking.rs:312 7: core::panicking::panic_fmt at src/libcore/panicking.rs:85 8: core::panicking::panic at src/libcore/panicking.rs:49 9: ion_shell::parser::shell_expand::expand_process at src/lib/parser/shell_expand/mod.rs:79 10: ion_shell::parser::shell_expand::expand_single_string_token at src/lib/parser/shell_expand/mod.rs:528 11: ion_shell::parser::shell_expand::expand_tokens at src/lib/parser/shell_expand/mod.rs:603 12: ion_shell::parser::shell_expand::expand_string at src/lib/parser/shell_expand/mod.rs:260 13: ion_shell::parser::assignments::checker::get_string at src/lib/parser/assignments/checker.rs:147 14: ion_shell::parser::assignments::checker::value_check at src/lib/parser/assignments/checker.rs:245 15: ::local at src/lib/shell/assignments.rs:285 16: ::execute_statement at src/lib/shell/flow.rs:181 17: ::on_command at src/lib/shell/flow.rs:491 18: ion_shell::shell::binary::terminate::terminate_script_quotes at ./src/lib/shell/binary/terminate.rs:37 19: ::terminate_script_quotes at ./src/lib/shell/binary/mod.rs:165 20: ion_shell::shell::Shell::execute_script at ./src/lib/shell/mod.rs:207 21: ion::main at src/main.rs:54 22: std::rt::lang_start::{{closure}} at /rustc/2fadb0a16c8737a45746e95df9138912590ed8ad/src/libstd/rt.rs:64 23: std::panicking::try::do_call at src/libstd/rt.rs:49 at src/libstd/panicking.rs:297 24: __rust_maybe_catch_panic at src/libpanic_unwind/lib.rs:92 25: std::rt::lang_start_internal at src/libstd/panicking.rs:276 at src/libstd/panic.rs:388 at src/libstd/rt.rs:48 26: std::rt::lang_start at /rustc/2fadb0a16c8737a45746e95df9138912590ed8ad/src/libstd/rt.rs:64 27: main 28: __libc_start_main 29: _start