drop rb_safe_level() from ruby-curses to fix irqtop from missing symbols and deprecation warnings

Bug #1907932 reported by Ferdinand Postema
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ruby-curses (Debian)
Fix Released
Unknown
ruby-curses (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
In Progress
Medium
Matthew Ruffell
Jammy
In Progress
Medium
Matthew Ruffell

Bug Description

[Impact]

rb_safe_level() had been marked for deprecation for some time, and was finally removed in Ruby 3.0.

ruby-curses uses rb_safe_level(), and it causes issues with its rdepends, most notably irqtop.

irqtop is unusuable on Jammy, with it failing to start due to not finding the rb_safe_level symbol.

$ sudo irqtop
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require': /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.0.0/curses.so: undefined symbol: rb_safe_level - /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.0.0/curses.so (LoadError)
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from /usr/lib/ruby/vendor_ruby/curses.rb:18:in `rescue in <top (required)>'
 from /usr/lib/ruby/vendor_ruby/curses.rb:14:in `<top (required)>'
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from /usr/bin/irqtop:9:in `<main>'

On Focal, irqtop fills the screen with deprecation warnings making the tool unusable.

/usr/bin/irqtop:545: warning: rb_safe_level will be removed in Ruby 3.0

[Testcase]

$ sudo apt install irqtop
$ sudo irqtop

On Jammy:
Check to see if the tool launches, and you no longer get the "undefined symbol: rb_safe_level - /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.0.0/curses.so (LoadError)" error.

on Focal:
Launch the tool, press enter several times to refresh the results. There should be no mention of "/usr/bin/irqtop:545: warning: rb_safe_level will be removed in Ruby 3.0", and the tool should be readable.

Test packages are available in the following ppa:

https://launchpad.net/~mruffell/+archive/ubuntu/sf385554-test

If you install the test packages, irqtop will function normally.

[Where Problems Could Occur]

We are removing a long deprecated string safety check, which I assure you, does not change the security of the tools using the ruby-curses library, due to most levels being disabled already in ruby itself.

As for the effect on the programs that depend on ruby-curses, ruby-curses only has 2 redepends, one of which is irqtop:

$ apt rdepends ruby-curses
ruby-curses
Reverse Depends:
  Depends: irqtop
  Depends: ruby-blade

If a regression were to occur, it would only impact irqtop and ruby-blade users. Users could downgrade ruby-curses while a fix is developed.

[Other Info]

This was fixed in the below commit, in version 1.3.2:

commit a9b9db9b5d5a4b52e3d0e0eaf0fbb2be839a3c29
From: Eric Wong <email address hidden>
Date: Sat, 30 Nov 2019 01:45:21 +0000
Subject: drop rb_safe_level check
Link: https://github.com/ruby/curses/commit/a9b9db9b5d5a4b52e3d0e0eaf0fbb2be839a3c29

Both Focal and Jammy required a backport. Only window and mouse events are implemented in 1.2.4, so I removed the hunks that targeted events that were implemented later.

Tags: focal jammy sts
Revision history for this message
Axel Beckert (xtaran) wrote :

This is an issue in ruby-curses, not irqtop. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=958973

Interestingly this no more happens on Debian Unstable/Testing. This seems to have fixed upstream a few months ago:

commit df3f52a6331f1a47af9933b77311a8650727d8d1
  Author: nagachika <email address hidden>
  Date: 2020-09-29 22:43:25 +0900

    merge revision(s) 996af2ce086249e904b2ce95ab2fcd1de7d757be: [Backport #16345] [Backport #17000]

            Disable deprecation warning by the default [Feature #16345]

            And `-w` option turns it on.

That commit likely made it into ruby 2.7.2, which hit Debian Unstable in mid-October 2020.

Nevertheless this obviously needs to be fixed in ruby-curses.

Revision history for this message
Axel Beckert (xtaran) wrote :

Note: The cited commit and "fix" was in the package ruby, but the problem in ruby-curses still exists as ruby only silenced the deprecation warnings by default.

summary: - irqtop emits a warning
+ ruby-curses: Emits warning: "rb_safe_level will be removed in Ruby 3.0",
+ affects at least irqtop
Changed in ruby-curses (Debian):
status: Unknown → Confirmed
Changed in ruby-curses (Debian):
status: Confirmed → Fix Released
Revision history for this message
Erik Meitner (eamuwmath) wrote : Re: ruby-curses: Emits warning: "rb_safe_level will be removed in Ruby 3.0", affects at least irqtop

Problem does not seem to be solved as now irqtop fails completely.

root@hongkong:~# irqtop
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require': /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.0.0/curses.so: undefined symbol: rb_safe_level - /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.0.0/curses.so (LoadError)
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from /usr/lib/ruby/vendor_ruby/curses.rb:18:in `rescue in <top (required)>'
 from /usr/lib/ruby/vendor_ruby/curses.rb:14:in `<top (required)>'
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from /usr/bin/irqtop:9:in `<main>'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- 3.0/curses.so (LoadError)
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from /usr/lib/ruby/vendor_ruby/curses.rb:16:in `<top (required)>'
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
 from /usr/bin/irqtop:9:in `<main>'

root@hongkong:~# dpkg -l irqtop ruby-curses
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=============-============-=============================================
ii irqtop 2.6-2ubuntu1 all Observe IRQ and SoftIRQ in a top-like fashion
ii ruby-curses 1.2.4-1build3 amd64 curses binding for Ruby

root@hongkong:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

Revision history for this message
Farshid Tavakolizadeh (farshidtz) wrote :

This is reportedly fixed on the newer versions of ruby-curses. Here is the bug report for Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=958973

Ubuntu Jammy (22.04) is still on ruby-curses 1.2.4 which is makes irqtop nonfunctional. Newer versions of Ubuntu are not affected.

no longer affects: iptables-netflow (Ubuntu)
Changed in ruby-curses (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Matthew Ruffell (mruffell)
tags: added: focal jammy sts
Changed in ruby-curses (Ubuntu):
status: In Progress → Fix Released
importance: Medium → Undecided
assignee: Matthew Ruffell (mruffell) → nobody
Changed in ruby-curses (Ubuntu Focal):
status: New → In Progress
Changed in ruby-curses (Ubuntu Jammy):
status: New → In Progress
Changed in ruby-curses (Ubuntu Focal):
importance: Undecided → Medium
Changed in ruby-curses (Ubuntu Jammy):
importance: Undecided → Medium
Changed in ruby-curses (Ubuntu Focal):
assignee: nobody → Matthew Ruffell (mruffell)
Changed in ruby-curses (Ubuntu Jammy):
assignee: nobody → Matthew Ruffell (mruffell)
Revision history for this message
Matthew Ruffell (mruffell) wrote :

Attached is a debdiff for jammy which solves this issue.

summary: - ruby-curses: Emits warning: "rb_safe_level will be removed in Ruby 3.0",
- affects at least irqtop
+ drop rb_safe_level() from ruby-curses to fix irqtop from missing symbols
+ and deprecation warnings
description: updated
Revision history for this message
Matthew Ruffell (mruffell) wrote :

Attached is a debdiff which solves this issue for focal.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.