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

hangs fish #29

Closed
aeosynth opened this issue Feb 5, 2019 · 13 comments
Closed

hangs fish #29

aeosynth opened this issue Feb 5, 2019 · 13 comments

Comments

@aeosynth
Copy link

aeosynth commented Feb 5, 2019

Thanks for adding fish support, but when I use this, after cding once and then pressing enter, the prompt just hangs for a few seconds.

lua z.lua --init fish > ~/.config/fish/conf.d/z.fish
# open new terminal
cd dl
# press enter, hang

fish, version 3.0.0

@skywind3000
Copy link
Owner

strange. does fish have any profile tool ??

@skywind3000
Copy link
Owner

skywind3000 commented Feb 5, 2019

I can't reproduce it, could you try to modify your generated z.fish ??

z.lua/z.lua

Lines 2004 to 2014 in 56d56af

script_init_fish = [[
function _zlua_precmd --on-event fish_prompt
_zlua --add "$PWD" 2> /dev/null &
end
]]
script_init_fish_once = [[
function _zlua_precmd --on-variable PWD
_zlua --add "$PWD" 2> /dev/null &
end
]]

change:

_zlua --add "$PWD" 2> /dev/null &

to:

_zlua --add "$PWD" 

in your generated z.fish

@skywind3000
Copy link
Owner

@TeddyDD, do you have any clue for this ??

@TeddyDD
Copy link
Contributor

TeddyDD commented Feb 5, 2019

Works for me with this setup. nevermind, I can reproduce this @aeosynth does it work when you load script dynamically

$ cat ~/.config/fish/conf.d/z.fish
lua ~/Kod/z.lua/z.lua --init fish | source

We can get debug log like this fish -D 4 -d 5 -c 'cd /tmp && cd .' > debug.log 2>&1 but it's huge wall of text :V

@aeosynth
Copy link
Author

aeosynth commented Feb 5, 2019

same issue with dynamic loading, changing the generated z.fish doesn't help either.

debug output: https://gist.github.com/aeosynth/70acc5517b3c0217f539c45f2b87dcb4

@TeddyDD
Copy link
Contributor

TeddyDD commented Feb 5, 2019

Tried to bisect that, first bad commit seems to be c88b821 but I'm not entarily sure (it hangs but for shorter period of time than on master)

With modified z.lua I get this error on c88b821, but I can't reproduce this on master

/bin/lua: /home/teddy/Kod/z.lua/z.lua:640: attempt to concatenate a nil value (global 'tmpename')
stack traceback:
        /home/teddy/Kod/z.lua/z.lua:640: in function 'data_save'
        /home/teddy/Kod/z.lua/z.lua:895: in function 'z_add'
        /home/teddy/Kod/z.lua/z.lua:1152: in function 'main'
        /home/teddy/Kod/z.lua/z.lua:1711: in main chunk
        [C]: in ?

profiling log for master


For some reason adding the same dir multiple times is slow , @aeosynth try to run this command multiple times:

/bin/lua /path/to/z.lua --add /tmp 

edit: my mistake, this is most likely on Fish side, lua code is ok


honestly I have no frigging clue what's wrong 😱

@skywind3000
Copy link
Owner

_zlua --add "$PWD" 2> /dev/null &

I am afraid that fish will wait for background job finished in the pipe. and somehow, the background job delayed.

So I suggest to temporarily remove the & sign first.

@skywind3000
Copy link
Owner

maybe plugin conflicts ??

@TeddyDD
Copy link
Contributor

TeddyDD commented Feb 5, 2019

I removed & and I still can reproduce it.

maybe plugin conflicts ??

no, tested with sh -c 'env HOME=$(mktemp -d) fish', no custom scripts loaded

@skywind3000
Copy link
Owner

skywind3000 commented Feb 5, 2019

sad, still can't reproduce on my laptop,

z.lua/z.lua

Lines 811 to 823 in 4c5d0aa

if rnd ~= nil then
seed = seed .. rnd
end
if not windows then
local fp = io.open('/dev/random', 'rb')
if fp ~= nil then
seed = seed .. fp:read(10)
fp:close()
end
else
if math.random_inited == nil then
math.random_inited = 1
local name = os.tmpname()

If we remove line 815-819, do we still encounter this ?

even if it's an issue of fish, maybe there is a way to prevent this.

@TeddyDD
Copy link
Contributor

TeddyDD commented Feb 5, 2019

Yeah, removing 815-819 seems to fix that issue, @aeosynth could you confirm that?

@skywind3000
Copy link
Owner

ok, removed and updated, @aeosynth , could you please try the latest version ?

@aeosynth
Copy link
Author

aeosynth commented Feb 6, 2019

works great so far, thanks!

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

3 participants