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

autoenv blocks when entering a subdirectory #15

Closed
ithinuel opened this issue Jan 12, 2018 · 2 comments
Closed

autoenv blocks when entering a subdirectory #15

ithinuel opened this issue Jan 12, 2018 · 2 comments

Comments

@ithinuel
Copy link
Contributor

ithinuel commented Jan 12, 2018

how to reproduce

case 1

# new shell is ok
cd Documents
# cd never returns

case 2

# new shell is ok
cd /usr
# everything is ok
cd include
# cd never returns

Hint

I have added

  • echo "out $_AUTOENV_OLDPATH" on line
  • echo "in $_AUTOENV_OLDPATH" on line

and this is what is reported :

in  /usr/
in  /usr//
in  /usr///usr
in  /usr///usr/usr
in  /usr///usr/usr/usr
in  /usr///usr/usr/usr/usr
in  /usr///usr/usr/usr/usr/usr
in  /usr///usr/usr/usr/usr/usr/usr
...
@grigorii-horos
Copy link
Member

@ithinuel Very intresting. But, I can't reproduce this
https://asciinema.org/a/Yah4tHSdTCoBzpiW2z3uwUYty

@ithinuel
Copy link
Contributor Author

I will probably try to play with the IFS var to handle paths as array.

join_path() { local IFS=/; echo "$*" }                                                                                                      
split_path() { local IFS=/; echo "$*" } # this does not break spaces in names. 
a=($(split_path 'ab cd/e/f/')) 
b=($(split_path '//gh i///j/k'))

echo $#a[@] $a[1]
join_path $a $b

results in :

4 ab cd
ab cd/e/f/gh i/j/k

I'll PR once it's fixed.

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

No branches or pull requests

2 participants