]> Sergey Matveev's repositories - zsh-autoenv.git/commit
_autoenv_get_file_upwards: do not dereference symlinks (#73)
authorRob Speed <speed.rob@gmail.com>
Thu, 2 Nov 2017 01:40:45 +0000 (21:40 -0400)
committerDaniel Hahler <github@thequod.de>
Thu, 2 Nov 2017 01:40:45 +0000 (02:40 +0100)
commit7e0d027b213b92a761c2c18c7272796fb5f1393c
tree2c8fd13ad898e5df247c6f2b21181f6545745567
parent2db6d697744dad9d8584ae23bb59e5daa5d858a4
_autoenv_get_file_upwards: do not dereference symlinks (#73)

This prevents issues where autoenv scripts use $0. When a shell enters the directory holding the autoenv scripts, it works as expected with $0 being the path to the symlink. However, if the shell enters one of its child directories the path to the script is dereferenced, and $0 is instead the path to the symlink's target.

From `man 1 zshexpn`:

> A – Turn a file name into an absolute path as the 'a' modifier does, and then pass  the  result  through  the  realpath(3) library function to resolve symbolic links.

Note: Symlinks are dereferenced elsewhere for authorization, so that behavior is unchanged.
autoenv.zsh
tests/_autoenv_utils.t