Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#973248: Deprecation warning in Ruby 2.7: $SAFE will become a normal global variable in Ruby 3.0

215 views
Skip to first unread message

Miquel van Smoorenburg

unread,
Oct 27, 2020, 4:10:05 PM10/27/20
to
Package: puppet
Version: 5.5.22-1

This is a similar but different bug as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955532 .

I get this warning on a puppet run:

/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning:
$SAFE will become a normal global variable in Ruby 3.0

I tried fixing it by setting Warning[:deprecated] = false, but that does
not work for this specific warning, weirdly enough.

So I tried another minimal approach. This fixes it for me, and it should
also fix those other deprecation warnings from #955532, so that patch
can be dropped if you want.

--- a/puppet 2020-10-25 18:04:24.000000000 +0100
+++ b/puppet 2020-10-27 19:45:13.784467214 +0100
@@ -1,5 +1,11 @@
#!/usr/bin/ruby

+def Warning.warn(w)
+ if w !~ /warning: (URI.(un|)escape is obsolete|\$SAFE will become a
normal global variable)/
+ super w
+ end
+end
+
begin
require 'puppet/util/command_line'
Puppet::Util::CommandLine.new.execute

Mike.

intrigeri

unread,
Mar 8, 2021, 3:00:04 AM3/8/21
to
Control: tag -1 + patch
Control: severity -1 important

Hi,

Miquel van Smoorenburg (2020-10-27):
> I get this warning on a puppet run:
>
> /usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning:
> $SAFE will become a normal global variable in Ruby 3.0

Confirmed here.

I'm bumping the severity to "important" because with typical Puppet
deployments, this bug will yield tons of noise in whatever monitoring
system is used, which makes it pretty much unusable as-is.

> So I tried another minimal approach. This fixes it for me, and it should
> also fix those other deprecation warnings from #955532, so that patch
> can be dropped if you want.

The way #955532 was fixed (by backporting an upstream commit) seems
cleaner to me so personally, I'd rather see the big-hammer approach
proposed here used as little as possible.

Below, I'll share the version of the patch that I'm now using.
It only tackles the problem this bug is about,
and I believe the code style is a bit more canonical Ruby
(guard clause instead of "if" + unspecified else).

Dear maintainers, I would like this bug to be fixed in Bullseye, to
avoid having to maintain a local workaround on the Tails infra for the
next 2-5 years. If it may help, I could negotiate a freeze exception
with the release team, and if they agree, upload a NMU.

What do you think?


--- /a/puppet 2020-10-25 17:04:24.000000000 +0000
+++ /b/puppet 2021-03-08 07:39:16.294675668 +0000
@@ -1,5 +1,12 @@
#!/usr/bin/ruby

+
+def Warning.warn(w)
+ return if w =~ /warning: \$SAFE will become a normal global variable/
+
+ super w

Thomas Goirand

unread,
Mar 8, 2021, 2:50:04 PM3/8/21
to
Hi,

The patch is super small and looks clean. I also am very annoyed by this
problem and would like it to be fixed. I'm not sure I can be the voice
of all of the team, but I would say: please go ahead with NMU + dealing
with the release team. Can someone else approve? Apollon maybe?

Cheers,

Thomas Goirand (zigo)

> --- /a/puppet 2020-10-25 17:04:24.000000000 +0000
> +++ /b/puppet 2021-03-08 07:39:16.294675668 +0000
> @@ -1,5 +1,12 @@
> #!/usr/bin/ruby
>
> +
> +def Warning.warn(w)
> + return if w =~ /warning: \$SAFE will become a normal global variable/
> +
> + super w
> +end
> +
> begin
> require 'puppet/util/command_line'
> Puppet::Util::CommandLine.new.execute
>
> _______________________________________________
> Pkg-puppet-devel mailing list
> Pkg-pupp...@alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-puppet-devel
>

Georg Faerber

unread,
Mar 8, 2021, 5:10:04 PM3/8/21
to
Hi,

On 21-03-08 20:46:54, Thomas Goirand wrote:
> The patch is super small and looks clean. I also am very annoyed by
> this problem and would like it to be fixed. I'm not sure I can be the
> voice of all of the team, but I would say: please go ahead with NMU +
> dealing with the release team. Can someone else approve? Apollon
> maybe?

ACK from my side as well, please go ahead.

Thanks for caring and dealing this.

Cheers,
Georg
0 new messages