Tarrasch / zsh-autoenv

Autoenv for zsh
700 stars 30 forks source link

Does not work with shwordsplit option (endless loop with path containing space) #75

Closed zcalusic closed 6 years ago

zcalusic commented 7 years ago

Check this out:

% mkdir "foo bar baz"
cd foo\ bar\ baz
[ prompt doesn't return... ]

Top reports:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                     
 5096 zcalusic  20   0   57284  15988   1600 R 100.0  0.1   0:06.18 zsh                         

Zsh is stuck in some kind of loop. Ctrl-C helps to get out of it. It happens only if 2 or more spaces are in directory name.

This started happening after I installed zsh-autoenv.

Other than this bug, it's really cool, solves some things very nicely!

blueyed commented 7 years ago

Thanks for the feedback!

I cannot reproduce it in some of my autoenv-enabled dirs.

Can you provide steps to reproduce this based on some dir in e.g. /tmp ?

zcalusic commented 7 years ago

Hello @blueyed!

All there is to it are 2 lines in the beginning of my report. Mkdir & then chdir. Don't forget 2 spaces in the name! Also, .autoenv.zsh files are not even involved in this experiment.

If you can't reproduce it, then it could be some setting specific to my zsh. Here's the list of my zsh setopts, in case it's relevant:

setopt automenu autolist autocd notify nohup nobgnice nopromptcr noclobber
setopt histignorealldups sharehistory shwordsplit completeinword rmstarsilent
setopt nohistsavebycopy

Zsh version 5.3.1

blueyed commented 6 years ago

Can you try setting AUTOENV_DEBUG=3 and then trigger it, please?

zcalusic commented 6 years ago
[/tmp]% mkdir "foo bar baz"
[/tmp]% cd "foo bar baz" 
[autoenv] Calling
[autoenv] chpwd
[autoenv] handler:
[autoenv] PWD=/tmp/foo
[autoenv] bar
[autoenv] baz
[autoenv] Looking
[autoenv] for
[autoenv] env_file:
[autoenv] /tmp/foo
[autoenv] bar
[autoenv] baz/.autoenv.zsh
[ stuck here, 100% CPU, ctrl-C breaks the loop ]
blueyed commented 6 years ago

shwordsplit is the problem - which can already be seen in the debug output (where the lines are split on words). A fix should be rather easy, will look into it later.

zcalusic commented 6 years ago

Can confirm it is fixed. Thanks!