enhancd icon indicating copy to clipboard operation
enhancd copied to clipboard

Strange output "No such file or directory"

Open daryapotanina opened this issue 2 years ago • 7 comments

What did you expect to happen? Just cd

What actually happened? cd with strange output

Output

base ❯ cd src
find: /Users/admin/my_znap_path/enhancd
/Users/admin/my_znap_path
/Users/admin
/Users
/: No such file or directory

Additional context

Mac OS 13.1 (22C65) (Macbook air Apple M2)

base ❯ zsh --version zsh 5.8.1 (x86_64-apple-darwin22.0)

/Users/admin/.zshrc

source ~/my_znap_path/zsh-snap/znap.zsh
znap prompt sindresorhus/pure
znap source b4b4r07/enhancd

video

https://user-images.githubusercontent.com/39034397/233792466-18b2761f-bdfd-48fd-92af-397949d57985.mp4

daryapotanina avatar Apr 22 '23 15:04 daryapotanina

I'm facing the same issue on OpenSuse Tumbleweed (and Leap on WSL2).

My fix, for now, is to revert to tag v2.5.0

cd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/enhancd/
git checkout tags/v2.5.0

Seems like the program is adding a \n on all folders (but that only happens in some cases, just like you showed in the video,

or is trying to concatenate the previous folder, with the new one and add those \n in the middle, just a guess based on the behavior though :D

My ZSH config: https://github.com/renantmagalhaes/workstation/blob/master/zsh/zshrc#L370

Taking a deeper look seems to be related with this file: https://github.com/b4b4r07/enhancd/blob/9a54fc3c6312eeaa7016f1744dd964524e686d61/functions/enhancd/lib/help.awk changed by @b4b4r07.

I will see if I can fix that for my use case, and let you know

renantmagalhaes avatar Apr 23 '23 12:04 renantmagalhaes

I'm facing the issue too.

OS: macOS 13.3.1 22E261 x86_64
Shell: zsh 5.9

Looks like https://github.com/b4b4r07/enhancd/pull/204/commits/d56316df9bf236897a20862f518da57d386df05a#diff-f4b9a07e00178cdb558a83c33afbf12a26940082674585f16ef62ea0fa7c896b cause this issue.

-  dirs=( "${PWD}" $(__enhancd::filepath::get_parent_dirs "${1:-${PWD}}") )
+  dirs=( "${PWD}" "$(__enhancd::filepath::get_parent_dirs "${1:-${PWD}}")" )
+__enhancd::filepath::walk:6> dirs=+__enhancd::filepath::walk:6> __enhancd::filepath::get_parent_dirs /etc/apache2
+__enhancd::filepath::get_parent_dirs:1> __enhancd::command::awk -f /Users/******/.zim/modules/enhancd/functions/enhancd/lib/step_by_step.awk -v 'dir=/etc/apache2'
+__enhancd::command::awk:2> type gawk
+__enhancd::command::awk:3> gawk -f /Users/*******/.zim/modules/enhancd/functions/enhancd/lib/step_by_step.awk -v 'dir=/etc/apache2'
+__enhancd::filepath::walk:6> dirs=( /etc/apache2 $'/etc\n/' ) # <-- HERE!!!
+__enhancd::filepath::walk:7> set +x
find: /etc
/: No such file or directory

revert 83fca51 should work for bash and zsh users.

Obviously, this will re-cause the fish shell issue that #204 tries to fix. And the problem seems to be related to 'capturing output of awk into array'

I'm not familiar with fish, can't go further.

vlaw avatar Apr 28 '23 03:04 vlaw

save issue on macOS 12.6, zsh 5.9 (x86_64-apple-darwin21.3.0)

gatspy avatar May 13 '23 06:05 gatspy

It happens to me too. Can't say when exactly but I see it quite often.

home\n/’: No such file or directory

OS: Linux Mint 21.1 x86_64
Shell: zsh 5.8.1 

grozmus avatar May 16 '23 13:05 grozmus

Can confirm I am experiencing the same issue on zsh 5.8.1 (x86_64-apple-darwin22.0)

andreicozma1 avatar Jun 13 '23 16:06 andreicozma1

Sorry for inconvenience. I reverted the cause part. Please check it

babarot avatar Jun 16 '23 16:06 babarot