${MWD} panics when the frirst two components of a path are the same length
Reproduction:
mkdir -p /something/something
cd /something/something
echo "${MWD}
Note: I can only hit this issue if the first two components of the path are the same length. E.g. ~/something/something
doesn't cause a panic for me.
Expected behavior: Keeps calm and does not panic.
Actual behavior:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: _ZN3std9panicking12default_hook28_$u7b$$u7b$closure$u7d$$u7d$17hef59f1d15185c20fE.llvm.272A3273
at /checkout/src/libstd/sys_common/backtrace.rs:68
2: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:397
at /checkout/src/libstd/panicking.rs:577
3: _ZN3std9panicking11begin_panic17hd8d93c98c4fac2daE.llvm.272A3273
at /checkout/src/libstd/panicking.rs:538
4: std::panicking::begin_panic_fmt
at /checkout/src/libstd/panicking.rs:522
5: core::panicking::panic_fmt
at /checkout/src/libstd/panicking.rs:498
6: core::panicking::panic
at /checkout/src/libcore/panicking.rs:51
7: ion::shell::variables::Variables::get_var
8: ion::parser::shell_expand::expand_tokens
9: ion::parser::shell_expand::expand_string
10: ion::parser::assignments::checker::get_string
11: ion::parser::assignments::checker::value_check
12: <ion::shell::Shell as ion::shell::assignments::VariableStore>::local
13: <ion::shell::Shell as ion::shell::flow::FlowLogic>::execute_statement
14: <ion::shell::Shell as ion::shell::flow::FlowLogic>::execute_statements
15: ion::shell::flow_control::Function::execute
16: <ion::shell::Shell as ion::shell::binary::Binary>::readln
17: <ion::shell::Shell as ion::shell::binary::Binary>::main
18: ion::main
19: main
20: __libc_start_main
21: _start
Build information: 63e6a991