Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeze when running activate.sh on Mac Catalina OS #188

Closed
koreazombie opened this issue Oct 8, 2019 · 21 comments · Fixed by #203
Closed

Freeze when running activate.sh on Mac Catalina OS #188

koreazombie opened this issue Oct 8, 2019 · 21 comments · Fixed by #203

Comments

@koreazombie
Copy link

Hello.

Updated to Mac Catalina OS. I've tested it on more than one Mac and have the same thing.

@hche608
Copy link

hche608 commented Oct 8, 2019

I have the same issue

@sennav
Copy link

sennav commented Oct 8, 2019

I did a little debugging on this and it seems activate.sh enters a infinite loop trying to search all .env files recursively. The following line is supposed to break a "while true" loop:
https://github.com/inishchith/autoenv/blob/53fa011debe9dbacb71956a124e805aea2ff5d3b/activate.sh#L34
But in my machine it ends up comparing [ / '=' /System/Volumes/Data ']' forever. So, I suspect that the output of:
https://github.com/inishchith/autoenv/blob/53fa011debe9dbacb71956a124e805aea2ff5d3b/activate.sh#L15
changed in the new version of OSX (specifically I suspect the output of df -P or pwd -P changed somehow), I don't have the old version now so I can't compare but I can check with other people tomorrow.

One quick fix is to hard code line 15 to _mountpoint="/" (works for me at least). It should work for the trivial cases but I don't fully understand the need of using df, I guess it's probably to support multiple mounting points (different hard disks?).

Anyway, I'm not an expert in shell scripting but I'm happy to help if you can guide me in the right direction.

@liufuyang
Copy link

liufuyang commented Oct 9, 2019

Setting line 15 _mountpoint="/" seems working for me as well. On bash.

@martnu
Copy link

martnu commented Oct 9, 2019

The diff is in the df -P "${PWD}".

On Catalina:

Filesystem   512-blocks      Used Available Capacity iused      ifree %iused  Mounted on
/dev/disk1s1  976490576 532032976 420124688    56% 4463321 4877989559    0%   /System/Volumes/Data

On Mojave:

Filesystem   512-blocks      Used Available Capacity iused      ifree %iused  Mounted on
/dev/disk1s1  976490576 532032976 420124688    56% 4463321 4877989559    0%   /

@meermanr
Copy link

On my system I've addressed this by adding a second break condition:

index 6553e98..18d3d33 100755
--- a/activate.sh
+++ b/activate.sh
@@ -32,6 +32,7 @@ ${_file}"
                                fi
                        fi
                        [ "$(\pwd -P)" = "${_mountpoint}" ] && \break
+                       [ "$(\pwd -P)" = "/" ] && \break
                        \command -v chdir >/dev/null 2>&1 && \chdir "$(\pwd -P)/.." || builtin cd "$(pwd -P)/.."
                done
        )```

@meermanr
Copy link

It seems Catalina is using a new "bi-directional wormhole in path traversal" called firmlinks.

I've not found any tools which are firmlink-aware...

@eXamadeus
Copy link

eXamadeus commented Oct 28, 2019

From Apple's slide presentation on firmlinks:

image

heh...

@s5b
Copy link

s5b commented Nov 11, 2019

Further to the comments here, I was having a lot of trouble with autoenv after upgrading to macOS Catalina, running zsh (Apple native), with zprezto. Now, zprezto has an alias for cd, which I have disabled.

And I have also implemented the change recommend by meermanr.

But changing to a new directory prompts with the "Are you sure you want to allow this?" , as it should, but just hangs when answering "y". The reason?

Well, it appears that rm (in my environment, again through zprezto) is aliased to "rm -i". And without a backslash on the front of the rm in the /usr/local/opt/autoenv/activate.sh script will hang, of course.

Solution: put a backslash on the front of the rm command (just like the existing cp and grep commands in the same script.)

@J-Liu
Copy link

J-Liu commented Nov 16, 2019

On my system I've addressed this by adding a second break condition:

index 6553e98..18d3d33 100755
--- a/activate.sh
+++ b/activate.sh
@@ -32,6 +32,7 @@ ${_file}"
                                fi
                        fi
                        [ "$(\pwd -P)" = "${_mountpoint}" ] && \break
+                       [ "$(\pwd -P)" = "/" ] && \break
                        \command -v chdir >/dev/null 2>&1 && \chdir "$(\pwd -P)/.." || builtin cd "$(pwd -P)/.."
                done
        )```

It does work for .env, but .env.leave doesn't.
Is it the same issue?

@teddyhartanto
Copy link

teddyhartanto commented Nov 18, 2019

@J-Liu the quick fix proposed by @sennav works for both the .env and .env.leave in my case:

One quick fix is to hard code line 15 to _mountpoint="/" (works for me at least). It should work for the trivial cases but I don't fully understand the need of using df, I guess it's probably to support multiple mounting points (different hard disks?).

I think the issue here is that as @martnu have showed us, the _mountpoint on Catalina is pointing to a different directory that the script didn't expect. It ran into an infinite loop because the termination condition is never met. You can hard code it to / for now.

@J-Liu
Copy link

J-Liu commented Nov 18, 2019

@teddyhartanto
I did replace ${_mountpoint} into /, but env.leave doesn't work.

@teddyhartanto
Copy link

@J-Liu have you done export AUTOENV_ENABLE_LEAVE="true"?

@J-Liu
Copy link

J-Liu commented Nov 18, 2019

@teddyhartanto
Screen Shot 2019-11-18 at 21 53 17
Yes I did, so, it is really weird.

@Dahie
Copy link

Dahie commented Dec 27, 2019

For future reference, the autoenv version available in homebrew is outdated and does not contain the fixes in #190. I manually changed the activate.sh to the one in the latest version and it works now.

@kingofsevens
Copy link

I mentioned this #189 but let me mentioned this here again. Does anybody experiencing a longer wait in changing directories or with autocomplete when changing directories. While autoenv disabled changing directories is instantaneous, but with autoenv it takes up to 3-4 seconds and with autocomplete as well. It sometimes unbearable. Also affected some of my bash scripts.

@yozlet
Copy link

yozlet commented Feb 7, 2020

@inishchith Given @Dahie's comment above, maybe it's time for a 0.2.2 release (or something)?

@SEONGTAEK01
Copy link

SEONGTAEK01 commented Mar 16, 2020

I've solved the freezed problem replace${_mountpoint} with /. But still had a problem that if I change a directory using cd target-dir then autoenv works. If I change a directory using alias registered in shell resource file like .zshrc, autoenv had not worked. The alias was like, alias="Users/taek/dev/src without cd command. So I added cd command, alias="cd /Users/taek/dev/src then it all works :)
Not directly related to the title but post a reply for someone who suffer from the similar problem.

@phrfpeixoto
Copy link

I just installed from brew and this issue is still present.

@animate-object
Copy link

I just installed from brew and this issue is still present.

Same. Bump for this:

@inishchith Given @Dahie's comment above, maybe it's time for a 0.2.2 release (or something)?

@otobrglez
Copy link

Hey guys!

Just wanted to let u know that to this date; this is still a problem.

Versions: macOS Catalina - 10.15.6 (19G73), autoenv: stable 0.2.1, HEAD (via homebrew)

Hope it helps someone out there,... Cheers!

@chkdmin
Copy link

chkdmin commented Nov 7, 2020

Hello

This problem has already been fixed and Merge on Master Branch.
But I don't know why not update new release
Check out this link to install using git
https://github.com/inishchith/autoenv#using-git

@hyperupcall hyperupcall mentioned this issue Sep 5, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.