autoenv
autoenv copied to clipboard
Autoenv replacing cd breaks things that cd
Platform
- macos
- zsh 5.9
- brew
- 0.4.0
Describe the bug
If you have things like, e.g., . script where script cd's into a dir, it doesn't cd into the dir
Expected behavior
it cd's into the dir
Additional context
fixed with AUTOENV_PRESERVE_CD=1
Thanks for the report! Do you have an exact reproduction? I tried to reproduce with the following:
Contents of ~/autoenv/script:
cd ~/autoenv
. ./activate.sh
# . /opt/homebrew/opt/autoenv/activate.sh # Fails in this case also
echo 'SUBDIR'
cd ./dir
ls
echo ''
echo 'ROOT DIR'
cd /
ls
echo ''
cd ~/autoenv
Contents of ~/autoenv/dir/.env:
echo 'CD IN'
In ~/autoenv, I run:
$ . ./script
SUBDIR
CD IN
ROOT DIR
Applications Users cores home sbin var
Library Volumes dev opt tmp
System bin etc private usr
On my system with ZSH 5.8.1 and macOS 12.6.8 and autoenv v0.4.0 (both Git and Brew install) it seems to work.
Is there an error message or does it just not print anything and not cd? Could you show the output of \type builtin?
For me cd with no args doesn't do anything - should be equivalent to cd ~. Bug appears to be introduced in 231791ae885c16380c8cab4a35827ec63c9d6909. Ubuntu 24.04, zsh 5.9.
Thanks for the extra info! I've reverted that commit in #255 (0c6a4c6ef389c490bf0179de66e216d0ca909ec9). It should be accessible with brew install autoenv --HEAD. I'll find some time later today to properly debug that
For me
cdwith no args doesn't do anything - should be equivalent tocd ~. Bug appears to be introduced in 231791a. Ubuntu 24.04, zsh 5.9.
i can also confirm this behaviour @calliecameron described, with macOS Sequoia 15.4.1 (24E263) and zsh 5.9 (arm64-apple-darwin24.0).
Thanks for the extra info! I've reverted that commit in #255 (0c6a4c6). It should be accessible with
brew install autoenv --HEAD. I'll find some time later today to properly debug that
this fixes it for me -- any update or progress from the debug side?
I confirm the behavio described by @calliecameron - cd without any argument does nothing, I expect to be back to $HOME