-
Notifications
You must be signed in to change notification settings - Fork 397
Open
Description
Describe the bug
Current working directory is not restored when using _comp_compgen -C
in some cases.
To reproduce
Using removepkg
as an example because it uses _comp_compgen -C
:
- Run
mkdir -p tmp/var/log/packages && touch tmp/var/log/packages/{foo,bar,baz} && cd tmp
. - Run
ROOT=$PWD
(that's setup forremovepkg
). - Then try completing with a prefix that is not found, for example:
removepkg a
<TAB>. - After that, you can type Ctrl-U or Ctrl-C to clear the line.
- Run
pwd
and see that your current working directory has changed to./var/log/packages
($PWD
hasn't changed). - To clean-up:
cd "$ROOT"/.. && unset ROOT && rm -rf tmp
Expected behavior
After step 3, the shell's working directory should be the same as before.
Versions (please complete the following information)
- Operating system name/distribution and version: macOS 15.6.1
- bash version,
echo "$BASH_VERSION"
: 5.3.3(1)-release - bash-completion version,
(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
: 2 16 0
Additional context
Debug trace
Metadata
Metadata
Assignees
Labels
No labels