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

Ruby/2.3.3 support #150

Closed
jgphpc opened this issue Dec 2, 2016 · 14 comments
Closed

Ruby/2.3.3 support #150

jgphpc opened this issue Dec 2, 2016 · 14 comments

Comments

@jgphpc
Copy link

jgphpc commented Dec 2, 2016

I am not a Ruby expert hence apology in advance for my question.
Whle i can install/use timetrap with Ruby/2.2.2, it fails with Ruby/2.3.3:

Ruby/2.3.3 (not ok)

$ gem install timetrap
Successfully installed timetrap-1.14.0
Parsing documentation for timetrap-1.14.0
Done installing documentation for timetrap after 0 seconds
1 gem installed
  • $ timetrap
cannot load such file --
 timetrap: ["/apps/common/UES/sandbox/jgp/easybuild./software/Ruby/2.3.3/lib/ruby/2.3.0
/rubygems/core_ext/kernel_require.rb:55:in `require'", "/apps/common/UES/sandbox/jgp/easybuild.
/software/Ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", "/apps
/common/UES/sandbox/jgp/easybuild./software/Ruby/2.3.3/lib/ruby/gems/2.3.0/gems/timetrap-
1.14.0/bin/timetrap:3:in `<top (required)>'", "/apps/common/UES/sandbox/jgp/easybuild./software
/Ruby/2.3.3/bin/timetrap:22:in `load'", "/apps/common/UES/sandbox/jgp/easybuild./software
/Ruby/2.3.3/bin/timetrap:22:in `<main>'"]

Ruby/2.2.2 (OK)

$ gem install timetrap
Fetching: chronic-0.10.2.gem (100%)
Successfully installed chronic-0.10.2
Fetching: sqlite3-1.3.12.gem (100%)
Building native extensions.  This could take a while...
Successfully installed sqlite3-1.3.12
Fetching: sequel-4.0.0.gem (100%)
Successfully installed sequel-4.0.0
Fetching: timetrap-1.14.0.gem (100%)
Successfully installed timetrap-1.14.0
Parsing documentation for chronic-0.10.2
Installing ri documentation for chronic-0.10.2
Parsing documentation for sqlite3-1.3.12
Installing ri documentation for sqlite3-1.3.12
Parsing documentation for sequel-4.0.0
Installing ri documentation for sequel-4.0.0
Parsing documentation for timetrap-1.14.0
Installing ri documentation for timetrap-1.14.0
Done installing documentation for chronic, sqlite3, sequel, timetrap after 24 seconds
4 gems installed

Any hint please ?

@walm
Copy link

walm commented Dec 14, 2016

I've same issue on a clean installation with ruby 2.3.3p222, and it seems to be not finding the gem's lookup path or something. Even that gem env all looks good.

You can get timetrap to run by using the dev_t command that will load it's lib correct with hardpath's. Just make sure you have just one version of timetrap installed I guess.

@jgphpc
Copy link
Author

jgphpc commented Dec 14, 2016

ok, thanks for the hint, i would say you can close my issue.

@legrostdg
Copy link

I have the same problem. Running dev_t works, but sounds like a workaround...

@dashkb
Copy link
Contributor

dashkb commented Mar 4, 2017

I'd love to help you all (because I love this gem). @jgphpc your gem search path looks weird; can you share more about the system you're on and how you installed Ruby? Are you able to successfully install and use other global CLI gems? (you can try one of mine, gem install dburl to test if you want.)

/cc @walm @legrostdg

trust, but verify: dashkb/dburl

@legrostdg
Copy link

$ gem install --user-install dburl
Successfully installed dburl-0.1.4
Parsing documentation for dburl-0.1.4
Installing ri documentation for dburl-0.1.4
Done installing documentation for dburl after 0 seconds
1 gem installed
$ dburl 
Usage: dburl [DATABASE_URL]

compared to

$ gem install --user-install timetrap
Successfully installed timetrap-1.14.1
Parsing documentation for timetrap-1.14.1
Done installing documentation for timetrap after 0 seconds
1 gem installed
$ t
cannot load such file -- timetrap: ["/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", "/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", "/home/user/.gem/ruby/2.3.0/gems/timetrap-1.14.1/bin/t:3:in `<top (required)>'", "/home/user/.gem/ruby/2.3.0/bin/t:22:in `load'", "/home/user/.gem/ruby/2.3.0/bin/t:22:in `<main>'"]

I use Debian unstable, with ruby installed with apt install ruby

$ ruby --version
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

@jgphpc
Copy link
Author

jgphpc commented Mar 6, 2017

I retried with ruby/2.4.0 and timetrap/1.14.1 and the issue is not present anymore:

Suse

  • gcc version 4.8.5 (SUSE Linux)
    • gem install --user-install dburl 🆗
    • gem install --user-install timetrap && timetrap 🆗

RedHat

  • gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
    • gem install --user-install dburl 🆗
    • gem install --user-install timetrap && timetrap 🆗

I could try on other systems too but i consider my problem to be resolved.

@dashkb
Copy link
Contributor

dashkb commented Mar 6, 2017

Yeah @jgphpc I'd have to guess something was messed up with your install of 2.3.3.

@legrostdg does it work for you on the latest ruby?

@EdwinHoksberg
Copy link

EdwinHoksberg commented May 4, 2017

Hi, I am getting the same error:

cannot load such file -- timetrap: ["/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", "/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'", "/var/lib/gems/2.3.0/gems/timetrap-1.14.1/bin/timetrap:3:in `<top (required)>'", "/usr/local/bin/timetrap:22:in `load'", "/usr/local/bin/timetrap:22:in `<main>'"]

I've installed timetrap with: sudo gem install timetrap
My Ruby/gem version:

$ ruby --version
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

$ gem --version
2.5.2

My OS is Debian 9.0 (Sid/Unstable)

@adamplumb
Copy link

I'm having this same issue on a recent install of Fedora 25 with the default ruby 2.3.3.

ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]

@dashkb
Copy link
Contributor

dashkb commented May 8, 2017

If y'all can set up an easy repro (like in a docker container or something) then I'll try to debug...

My advice failing that is to NOT use the system Ruby (or apt/yum/whatever) and use either RVM or Homebrew/Linuxbrew to install a Ruby owned by your user, so you don't need sudo to install gems. Ruby is up to 2.4 anyway.

@ToadJamb
Copy link

ToadJamb commented Jul 1, 2017

I just realized that an issue I opened (#159) may actually be a duplicate of this. For the record, I am using rvm on Ubuntu.

@dashkb "Ruby is up to 2.4 anyway" is not an acceptable answer for 2 reasons:

  1. This issue was raised PRIOR to 2.4 being released, so that response implies that maintainers are willing to just wait until new versions come out to see if it fixes itself. It's understandable that people are busy and have other priorities. It is not understandable to say "Oh. Look at that. We waited long enough that a new version came out and now it works. Everyone upgrade!"

  2. Even if it works under 2.4.x, 2.3.3 is still a supported ruby version and Timetrap should work as expected. There are many cases where projects cannot be upgraded trivially and then you're asking users to change ruby versions, switch terminals, or hack their binaries (my interim solution) to use timetrap.

As a final thought, I'm not 100% convinced this is timetrap's fault, but I have no trouble with any other gems under 2.3.3, so it seems likely that it is and at the very least seems like it's reasonable for the timetrap community to help track down the problem.

@ToadJamb
Copy link

ToadJamb commented Jul 1, 2017

I spent way more time on this than I have, but here's what I found.

This line https://github.com/samg/timetrap/blob/master/lib/Getopt/Declare.rb#L1267 checks $@, which has already been flagged, but it is presumably there to catch errors on the previous line. In my case, clearing $@ prior to err = code(@caller) allows timetrap to work as expected.

A little more examination shows that the error appears to occur prior to even loading lib/timetrap.rb, so it may be a combination of some changes in ruby 2.3.3 and the fact that timetrap is relying on global error variables.

Something like $@ = nil at the top of lib/timetrap.rb would fix the problem. It's weird to be getting cannot load such file -- timetrap when clearly that file IS actually in the process of loading.

@dashkb
Copy link
Contributor

dashkb commented Jul 2, 2017 via email

@samg
Copy link
Owner

samg commented Jul 7, 2017

I was able to replicate this issue. As far as I can tell it's related to some subtle difference in how load_paths are set up in new ruby installs. I believe I've fixed the issue in https://rubygems.org/gems/timetrap/versions/1.14.2 by updating the syntax for requiring the timetrap lib files relative to the bin.

Could you let me know if this resolves the error on your install and close out the issue if so.

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

9 participants