-
Notifications
You must be signed in to change notification settings - Fork 88
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
Workaround libncurses.so as a linker script #441
Conversation
This maybe isn't probably isn't the best approach, but it will allow `Fiddle::Terminfo.curses_dl` to work. I documented more details about this in an issue on fiddle: ruby/fiddle#107 It is probably better to deal with it there. But this is workaround is simpler. FYI: `reline` itself seems to be working just fine for me _without_ loading ncurses. But I wanted to be able to use `Reline::Terminfo` for my own projects. :)
I'm not sure why it's only stuck with Ruby 3.0 and 3.1. @st0012 If you detect the root cause of this stuck, I'll revert this. |
I think it's because the list is only loaded when https://github.com/ruby/reline/blob/master/lib/reline/terminfo.rb#L49 Which is set when Ruby is >= Lines 35 to 38 in 4347e4f
And #451 also proves that reverting this will fix the issue. |
Should we only add versioning so files into Ruby < 3.0? |
Based on fiddle's final implementation and other gems', I don't think loading fixed versioning so files is the best option, regardless the Ruby version. And as @nevans suggested, the proper way to fix ruby/fiddle#107 is to support linker script in So IMO, this PR should not be accepted in the first place, at least not without the CI result. |
Is there a solution for the environment that has only fixed versions of curses? I hope to help that users. |
I think that's what this fiddle commit does? When having trouble reading
|
Revert "Merge pull request #441 from nevans/workaround-linker-script-so"
OK, I revert this. But I was frustrated that you only focused on resolving the downstream repos. I'm happy to resolve the root cause in the next time. |
I'm sorry that you feel that way. I'm actually using docker to debug the issue locally. I think it needs to be reverted urgently because it's been breaking downstream repo CIs for over 2 weeks. And it's hard to trace the cause from those repos (I spent 2 days debugging ruby/debug just to found it's not its issue), nor is there any workaround for it. |
Here's what I found about the CI hanging issue:
I think this workaround does work, but |
It seems to me that the best place to handle linker resolution is fiddle, so reverting it seems reasonable to me. But, if this is failing because it succeeds in loading |
I used docker to run With your patch irb(main):001:0> Reline::Terminfo.curses_dl_files
=> ["libncursesw.so", "libcursesw.so", "libncurses.so", "libcurses.so", "libncursesw.so.6", "libncurses.so.6"]
irb(main):002:0> Reline::Terminfo.curses_dl
=> #<Fiddle::Handle:0x0000ffff803ef8e8>
irb(main):003:0> ls _
Fiddle::Handle#methods: [] close close_enabled? disable_close enable_close file_name sym to_i to_ptr
=> nil
irb(main):004:0> Reline::Terminfo.curses_dl.file_name
=> "/lib/aarch64-linux-gnu/libncursesw.so.6"
irb(main):005:0> exit With latest fiddle irb(main):001:0> Fiddle.dlopen "libncurses.so" # fixed #dlopen
=> #<Fiddle::Handle:0x0000ffffafe434c8>
irb(main):002:0> exit @nevans I assume you also didn't see any issue with it, otherwise you'd have reported it? |
This maybe isn't probably isn't the best approach, but it should allow
Fiddle::Terminfo.curses_dl
to work. I documented more details aboutthis in an issue on fiddle: ruby/fiddle#107
It is probably better to deal with it there. But this workaround is
simpler.
FYI:
reline
itself seems to be working just fine for me withoutloading ncurses. But I wanted to be able to use
Reline::Terminfo
formy own projects. :)