When attempting to use j to jump to a directory containing multiple underscores (e.g., 000_play__), autojump fails with a Python AttributeError instead of gracefully handling the search or providing a "directory not found" message.
It appears the get_ith_path lambda assumes that last(take(i, iterable)) will always return a valid object, but in this case, it returns None, causing the crash when accessing the .path attribute.
Steps to Reproduce
Create a directory with multiple underscores: mkdir -p ~/tmp/000_play__
Change into that directory to add it to the autojump database: cd ~/tmp/000_play__
Return to the home directory: cd ~
Attempt to jump using the underscore pattern: j 000_play__
Actual Behavior / Stack Trace
The command crashes with the following output:
[~]$ j 000_play__
Traceback (most recent call last):
File "/opt/homebrew/Cellar/autojump/22.5.3_3/libexec/bin/autojump", line 342, in <module>
sys.exit(main(parse_arguments()))
~~~~^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/autojump/22.5.3_3/libexec/bin/autojump", line 326, in main
get_ith_path(
~~~~~~~~~~~~^
tab_index,
^^^^^^^^^^
find_matches(entries, [tab_needle]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
),
^
File "/opt/homebrew/Cellar/autojump/22.5.3_3/libexec/bin/autojump", line 324, in <lambda>
get_ith_path = lambda i, iterable: last(take(i, iterable)).path
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'path'
autojump: directory '000_play__' not found
This appears to be the same root cause as reported in #669, but specifically triggered by directory names containing underscores during jump attempts.
When attempting to use j to jump to a directory containing multiple underscores (e.g., 000_play__), autojump fails with a Python AttributeError instead of gracefully handling the search or providing a "directory not found" message.
It appears the get_ith_path lambda assumes that last(take(i, iterable)) will always return a valid object, but in this case, it returns None, causing the crash when accessing the .path attribute.
Steps to Reproduce
Create a directory with multiple underscores: mkdir -p ~/tmp/000_play__
Change into that directory to add it to the autojump database: cd ~/tmp/000_play__
Return to the home directory: cd ~
Attempt to jump using the underscore pattern: j 000_play__
Actual Behavior / Stack Trace
The command crashes with the following output:
This appears to be the same root cause as reported in #669, but specifically triggered by directory names containing underscores during jump attempts.