When changing directory to a path that is both local and matches on $CDPATH, the builtin cd command gets confused and adds it to the path twice.
$ fish --version
fish, version 3.0.2
$ uname -a
Linux jacob-thinkpad 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 18:46:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ echo $TERM
xterm-256color
$ sh -c 'env HOME=$(mktemp -d) fish'
$ cd /tmp/tmp.0BDPc1pzW7/
$ echo $CDPATH
./ /tmp/tmp.0BDPc1pzW7/ /tmp/tmp.0BDPc1pzW7/code/ /tmp/tmp.0BDPc1pzW7/Documents/School/
$ mkdir -p Documents/School/phil205
$ cd ./Documents/School
$ pwd -P
/tmp/tmp.0BDPc1pzW7/Documents/School
$ cd phil205/
$ pwd -P
/tmp/tmp.0BDPc1pzW7/Documents/School/phil205/phil205
at this point, I begin typing another command but something in autocompletion causes a crash.
<E> fish: /build/fish-drULpq/fish-3.0.2/src/wutil.cpp:464: failed assertion: !wd.empty() && wd.front() == sep && wd.back() == sep && "Invalid working directory, it must start and end with /"
<E> fish: Backtrace:
<E> fish: 0 path_normalize_for_cd(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) + 1338
<E> fish: 1 fish(+0xf4364) [0x55dfb9256364]
<E> fish: 2 autosuggest_validate_from_history(history_item_t const&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, env_vars_snapshot_t const&) + 1178
<E> fish: 3 fish(+0xffb0d) [0x55dfb9261b0d]
<E> fish: 4 fish(+0xffe20) [0x55dfb9261e20]
<E> fish: 5 std::_Function_handler<void (), _iothread_trampoline<autosuggestion_result_t>::perform<std::function<autosuggestion_result_t ()>, void (*)(autosuggestion_result_t)>(std::function<autosuggestion_result_t ()> const&, void (* const&)(autosuggestion_result_t))::{lambda()#1}>::_M_invoke(std::_Any_data const&) + 49
<E> fish: 6 fish(+0xdfde4) [0x55dfb9241de4]
<E> fish: 7 /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db) [0x7efc8d1256db]
<E> fish: 8 clone + 63
Aborted (core dumped)
Returning to previous state, I can run
$ cd ./phil205
$ pwd -P
/tmp/tmp.BiIMMQ9Ps0/Documents/School/phil205
I also tested this using the same steps, but with builtin cd to circumvent the cd function.
I tested reverting to 2.7.1 and this issue was not present.
I am planning to try to get to the bottom of this myself. I just posted here to document the issue.
When changing directory to a path that is both local and matches on $CDPATH, the builtin cd command gets confused and adds it to the path twice.
at this point, I begin typing another command but something in autocompletion causes a crash.
Returning to previous state, I can run
I also tested this using the same steps, but with
builtin cdto circumvent the cd function.I tested reverting to 2.7.1 and this issue was not present.
I am planning to try to get to the bottom of this myself. I just posted here to document the issue.