Bug 237833 - lang/ruby26: irb, rdoc, ri is broken
Summary: lang/ruby26: irb, rdoc, ri is broken
Status: In Progress
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...
Depends on: 237870
  Show dependency treegraph
Reported: 2019-05-11 05:09 UTC by Hajimu UMEMOTO
Modified: 2020-05-18 07:43 UTC (History)
7 users (show)

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

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 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 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 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 2019-05-13 08:50:43 UTC
I've created bug 237830 for irb.
Comment 4 Hajimu UMEMOTO freebsd_committer 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 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 2019-05-14 00:34:48 UTC
Created attachment 204366 [details]
Comment 7 Hajimu UMEMOTO freebsd_committer 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 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 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
Comment 10 Koichiro Iwao freebsd_committer 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 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.


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 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.

Comment 14 Matthias Fechner freebsd_committer 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 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 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 2019-12-21 21:57:07 UTC
(In reply to Koichiro Iwao from comment #16)


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 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

  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)

Comment 20 Dani 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!