Bug 237833 - lang/ruby26: irb, rdoc, ri is broken
Summary: lang/ruby26: irb, rdoc, ri is broken
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Koichiro Iwao
URL: https://lists.freebsd.org/pipermail/f...
Keywords:
Depends on: 237870
Blocks:
  Show dependency treegraph
 
Reported: 2019-05-11 05:09 UTC by Hajimu UMEMOTO
Modified: 2022-04-11 15:35 UTC (History)
10 users (show)

See Also:
bugzilla: maintainer-feedback? (ruby)


Attachments
patch (564 bytes, patch)
2019-05-14 00:34 UTC, Koichiro Iwao
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hajimu UMEMOTO freebsd_committer freebsd_triage 2019-05-11 05:09:13 UTC
It seems that rdoc of lang/ruby26 is broken.
Any idea?


% rdoc docs/bdb.rb
Traceback (most recent call last):
	2: from /usr/local/bin/rdoc:23:in `<main>'
	1: from /usr/local/lib/ruby/site_ruby/2.6/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/site_ruby/2.6/rubygems.rb:283:in `find_spec_for_exe': can't find gem rdoc (>= 0.a) with executable rdoc (Gem::GemNotFoundException)
% rdoc26 docs/bdb.rb
Traceback (most recent call last):
	2: from /usr/local/bin/rdoc26:23:in `<main>'
	1: from /usr/local/lib/ruby/site_ruby/2.6/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/site_ruby/2.6/rubygems.rb:283:in `find_spec_for_exe': can't find gem rdoc (>= 0.a) with executable rdoc (Gem::GemNotFoundException)
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [amd64-freebsd11]
Comment 1 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-13 04:46:44 UTC
ri and irb doesn't work, too.

% ri26
Traceback (most recent call last):
        2: from /usr/local/bin/ri26:23:in `<main>'
        1: from /usr/local/lib/ruby/2.6/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/2.6/rubygems.rb:283:in `find_spec_for_exe': can't find gem rdoc (>= 0.a) with executable ri (Gem::GemNotFoundException)

% irb26
Traceback (most recent call last):
        2: from /usr/local/bin/irb26:23:in `<main>'
        1: from /usr/local/lib/ruby/2.6/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/2.6/rubygems.rb:283:in `find_spec_for_exe': can't find gem irb (>= 0.a) with executable irb (Gem::GemNotFoundException)
Comment 2 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-13 05:43:08 UTC
Have you installed it rubygem-rdoc for Ruby 2.6?  See how /usr/local/bin/rdoc be. It is just a wrapper script since Ruby 2.6. Not an rdoc itself. rubygem-rdoc port needs to be installed. 

Same with irb. Ruby < 2.6, /usr/local/bin/irb is a irb itself. However Ruby >= 2.6 , it is no longer irb itself. It is a wrapper script to call irb gem. irb gem port doesn't exist right now. It should be created.
Comment 3 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-13 08:50:43 UTC
I've created bug 237830 for irb.
Comment 4 Hajimu UMEMOTO freebsd_committer freebsd_triage 2019-05-13 12:31:22 UTC
(In reply to Koichiro Iwao from comment #2)
Yes, I confirmed that installing rubygem-rdoc makes rdoc work.
However, I cannot think that it is intentional to installbroken rdoc without rubygem-rdoc installed.
Comment 5 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-14 00:06:38 UTC
(In reply to Hajimu UMEMOTO from comment #4)
It is not intentional. What about adding these gems runtime dependency of lang/ruby26?
Comment 6 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-14 00:34:48 UTC
Created attachment 204366 [details]
patch
Comment 7 Hajimu UMEMOTO freebsd_committer freebsd_triage 2019-05-14 12:27:24 UTC
(In reply to Koichiro Iwao from comment #5)
Adding run_depend to gems is still workaround.
Installing broken rdoc by lang/ruby26 seems bad idea.
Comment 8 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-14 12:54:47 UTC
(In reply to Hajimu UMEMOTO from comment #7)
However, it is a gem. What is your plan?
Comment 9 Hajimu UMEMOTO freebsd_committer freebsd_triage 2019-05-14 17:19:36 UTC
(In reply to Koichiro Iwao from comment #8)

I'm not sure how the default gem should be handled, but, the default gem seems
 different from the regular gem.  Perhaps, it should be:

1. Stop installing the broken bin scripts and useless related libs if
any, by lang/ruby26.

2. Providing the separated default gem port like ruby26-rdoc which
built and installed from the Ruby 2.6.X source.

3. The separated default gem port installs the bin script as well.

4. Optionally, the separate ports are RUN_DEPENDS from lang/ruby26.

5. The rubygem-rdoc can be installed to use latest version of the
rdoc.
Comment 10 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-17 05:34:45 UTC
I will learn about default gem and consider what should be done.
Comment 11 Koichiro Iwao freebsd_committer freebsd_triage 2019-05-28 02:20:43 UTC
As I already mentioned, irb, rdoc, ri and perhaps other components are installed as default gems since Ruby 2.6. However, files/patch-tool_rbinstall.rb prevents installing default gems. This is the cause why rdoc etc is not installed.

https://svnweb.freebsd.org/ports/head/lang/ruby26/files/patch-tool_rbinstall.rb?revision=501068&view=markup#l27

There should be a certain reason why this patch is added. Just removing the patch might break something so the patch needs to be removed carefully.
Comment 12 Koichiro Iwao freebsd_committer freebsd_triage 2019-09-09 09:23:29 UTC
Ruby 2.6 is now default r511605. Let's make irb, rdoc, ri as part of lang/ruby26.
Comment 13 mail 2019-09-12 03:48:51 UTC
After upgrading to Ruby 2.6 I can no longer start irb:

$ irb
Traceback (most recent call last):
        2: from /usr/local/bin/irb:23:in `<main>'
        1: from /usr/local/lib/ruby/site_ruby/2.6/rubygems.rb:303:in `activate_bin_path'
/usr/local/lib/ruby/site_ruby/2.6/rubygems.rb:284:in `find_spec_for_exe': can't find gem irb (>= 0.a) with executable irb (Gem::GemNotFoundException)

This is with ruby-2.6.4,1 compiled with Poudriere using default make options on FreeBSD 12.0-REL amd64.

Thanks.
Comment 14 Matthias Fechner freebsd_committer freebsd_triage 2019-09-12 21:23:28 UTC
(In reply to mail from comment #13)
Have you tried to install what the error message tells you?
pkg install rubygem-irb
Comment 15 mail 2019-09-13 01:39:10 UTC
(In reply to Matthias Fechner from comment #14)

OK, irb works after installing devel/rubygem-irb.

I'm not a Ruby user so that step was non-obvious, nor was it automatic after upgrading from Ruby 2.5.

Obviously rubygem-irb should be required as a dependency for a functioning Ruby installation.
Comment 16 Koichiro Iwao freebsd_committer freebsd_triage 2019-12-13 09:25:52 UTC
Kimura-san, what do you think if I just remove files/patch-tool_rbinstall.rb and include irb, rdoc, ri default gems as part of lang/ruby26?
Comment 17 Koichiro Iwao freebsd_committer freebsd_triage 2019-12-13 09:36:58 UTC
(In reply to Koichiro Iwao from comment #16)
I think the patch makes things difficult. It exists since Ruby 1.9.3 as far as I follow svn log. Now it is time to refine the patch. Ruby has been changed, but the patch hasn't been changed.
Comment 18 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-12-21 21:57:07 UTC
(In reply to Koichiro Iwao from comment #16)

Iwao-san,

Sorry for late response. I tried removing this patch and saw what happened. The result was that following gems were installed under /usr/local/lib/ruby/2.6 (directory where rubygem ports install their files).

* bundler 1.17.2
* did_you_mean 1.3.0
* irb 1.0.0
* minitest 5.11.3
* net-telnet 0.2.0
* power_assert 1.1.3
* rake 12.3.2
* rdoc 6.1.2
* test-unit 3.2.9
* xmlrpc 0.3.0

I found some of them exists as rubygem port in ports tree. And some of such ports has same version as above. That is, removing this patch results in installed file conflict with some rubygem ports. So this patch shouldn't be removed. I also found there isn't port of did_you_mean gem in ports tree. So it may be we should create it.

From this result I think we need to review other patches and understand what they do and/or why they are necessary.

Furthermore, it may be we need to ask ourselves following fundamental question.

"What should (or shouldn't) be install by this port?"

To be honest, I think I should have made consensus about answer to this question with others before I start creating lang/ruby26 port.
Comment 19 commit-hook freebsd_committer freebsd_triage 2020-01-29 02:25:54 UTC
A commit references this bug:

Author: meta
Date: Wed Jan 29 02:25:24 UTC 2020
New revision: 524527
URL: https://svnweb.freebsd.org/changeset/ports/524527

Log:
  lang/ruby27: throw out racc from lang/ruby27

  because racc is provied as "default gem" since Ruby 2.7 [1].

  We provide default gems as gem ports rather than a part of lang/ruby* port.
  files/patch-tool_rbinstall.rb does that. bin/*racc* are leftover wrapper
  script that the patch didn't remove default gem racc completely.

  racc is provided by devel/rubygem-racc. To avoid conflict racc gem port vs
  ruby port, throw it out completely from ruby port.

  [1] https://ruby-trunk-changes.hatenablog.com/entry/ruby_trunk_changes_20190620

  PR:		242359 237833
  Submitted by:	Yasuhiro KIMURA <yasu@utahime.org> (based on)

Changes:
  head/Mk/bsd.ruby.mk
  head/lang/ruby27/Makefile
  head/lang/ruby27/pkg-plist
Comment 20 Dani I. 2020-05-18 07:43:16 UTC
(In reply to Koichiro Iwao from comment #17)

What is the current state of this? The "default install" of ruby26 is still corrupt and that is the default version. This is really ugly and really should be taken care off. Thanks for taking a look at this!
Comment 21 Daniel Engberg freebsd_committer freebsd_triage 2021-12-08 21:53:05 UTC
Friendly ping
Comment 22 Koichiro Iwao freebsd_committer freebsd_triage 2021-12-23 04:23:45 UTC
(In reply to Daniel Engberg from comment #21)

Thanks for keeping your eyes on this.
I would like to solve this by adding RUN_DEPENDS but ume@ didn't agree. We need to discuss how to solve it.
Comment 23 Sean Champ 2021-12-29 06:14:04 UTC
I've seen similar errors, I believe it may have something to do with how the Gem API resolves gemspec pathnames

I think a lot of the issues might clear up with a newer ruby-gems version. I've sent a patch for this
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260780 

For bundling with tools like irb, rdoc, etc. it should be possible to provide a meta-port. I'll hopefully have a patch put together for that, if it could be of any use - something that could depend on the Ruby implementation of a given default version and the ports that would provide the common Ruby platform tools - e.g including the tools for the bundler, erb, irb, racc, rake, rbs, rdoc, and typeprof cmds, all of which are available via separate gems.

I'm not sure if it might seem initially very convenient, but after trying out some other approaches for installing a usable 'irb' locally, I believe it may work out well to use the individual ports e.g for irb, rdoc, etc. Those ports may be available at their latest public release, contrasted to whatever version was included in the Ruby platform bundle of some version. 

Considering the essential features of the ruby-gems port, in particular, the latest updates may provide some useful features e.g in affecting how the tools are launched from the console command line. Ideally, some bugs might go away after update, as such.

For the sake of convenience for a new Ruby installation with FreeBSD, it should be possible to put together a meta-port that would draw all of these separate Ruby ports together. I don't believe I've found the only approach for this, but I've been working on a new port for that - calling it lang/ruby-platform. Perhaps it's been tested enough that I could send a diff, for public review shortly, ostensibly for adding it to the ports tree or at least as a point of discussion.

The meta-port might depend on the ports providing the erb, irb, racc, rake, rbs, rdoc, and typeprof cmds such that might normally be available if everything works out in a new Ruby installation. To provide a single point for installation, those could be installed as dependencies of the metaport, at their latest published version in ports. Of course, this would also pull in any updates for the ruby-gems port.

Then there are the bundled gems in a baseline Ruby install, such that don't have command line tools - e.g the rss gem, such that might be of interest for podcast stuff etc.

Hopefully the ruby-gems update and the metaport might be of some use. I'll try to put the metaport patch together, for one approach to this.

Health, all
- Sean
Comment 24 Sean Champ 2021-12-29 09:07:02 UTC
There's a patch published now, for adding a lang/ruby-platform metaport
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260788

I've tested it under buld-deps and run-deps with Ruby 3.0 - will try to put together more of a testing environment shortly, for all the current Ruby platform versions in ports. This much would not need a huge distfile fetch, lol

Health, all,
- Sean
Comment 25 Rene Ladan freebsd_committer freebsd_triage 2022-03-31 20:02:47 UTC
lang/ruby26 expired today, the port is being removed from the tree.