Version difference in the Ruby version installed and directories created as part of RPM installation

181 views
Skip to first unread message

pratiks...@gmail.com

unread,
Aug 13, 2021, 6:12:17 AM8/13/21
to Fluentd Google Group
Hi,

I have downloaded td-agent RPM v4.2.0. I see that the ruby getting installed has version 2.7.4. However, the directories getting created has version 2.7.0 as shown below:

/opt/td-agent/lib/ruby/2.7.0
/opt/td-agent/lib/ruby/vendor_ruby/2.7.0
/opt/td-agent/lib/ruby/gems/2.7.0
/opt/td-agent/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0
/opt/td-agent/lib/ruby/site_ruby/2.7.0

bash-4.2# cat /usr/sbin/td-agent
#!/opt/td-agent/bin/ruby
ENV["GEM_HOME"]="/opt/td-agent/lib/ruby/gems/2.7.0/"
ENV["GEM_PATH"]="/opt/td-agent/lib/ruby/gems/2.7.0/"
ENV["FLUENT_CONF"]="/etc/td-agent/td-agent.conf"
ENV["FLUENT_PLUGIN"]="/etc/td-agent/plugin"
ENV["FLUENT_SOCKET"]="/var/run/td-agent/td-agent.sock"
if ARGV.include?("--version")
  require "/opt/td-agent/share/config"
  Dir.glob("/opt/td-agent/lib/ruby/**/gems/**/fluent/version.rb").each do |v|
    require v.delete_suffix(".rb")
  end
  puts "td-agent #{PACKAGE_VERSION} fluentd #{Fluent::VERSION} (#{FLUENTD_REVISION})"
  exit 0
end
load "/opt/td-agent/bin/fluentd"

The version getting installed is:
bash-4.2# /opt/td-agent/bin/ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
bash-4.2#

Please explain why there is a mismatch and how these directories are getting created with name having an older version .

Thanks in advance
 

hiroshi hatake

unread,
Aug 13, 2021, 11:58:44 AM8/13/21
to flu...@googlegroups.com
Hi, 

This is normal behavior and td-agent uses rubygems mechanism to load Fluentd plugins and its dependencies.

This value glitch comes from:

And RbConfig::CONFIG['ruby_version'] should be returned 2.7.0 instead of 2.7.4 when you using Ruby 2.7.4.

Thanks to this behavior, Ruby ensures gems compatibilities for patch level versions.

Best,

Hiroshi

2021年8月13日(金) 19:12 pratiks...@gmail.com <pratiks...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fluentd/dc26ef76-1948-49dc-9324-e1fabc11036en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages