Skip to content

gettext: error about execution flow in exception handling in ruby >=3.3 #107

@henk84

Description

@henk84

Bug reported on IRC, nickname of the reporter replaced with 'placeholder' because I’m not sure whether they want to be associated. Content of their pastebin is the codeblock below the quote from the IRC conversation, similarly pseudonymized:

07:55 https://dpaste.com/PLACEHOLDER_ID was my ruby3.3 patch, though of course I don't know if it's right.
08:32 oh, that’s not much … what’s the problem without that patch?
08:34 hrm, does it fail and then loop failing?
08:45 Mar 13 03:45:06 Loki rbot[569443]: internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:136:in require': 08:45 <placeholder> Mar 13 03:45:06 Loki rbot[569443]: /usr/lib/ruby/vendor_ruby/rbot/load-gettext.rb:71: Invalid retry after ensure (SyntaxError) 08:45 <placeholder> Mar 13 03:45:06 Loki rbot[569443]: retry 08:45 <placeholder> Mar 13 03:45:06 Loki rbot[569443]: ^~~~~ 08:45 <placeholder> Mar 13 03:45:06 Loki rbot[569443]: from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:136:in require'
08:45 Mar 13 03:45:06 Loki rbot[569443]: from /usr/lib/ruby/vendor_ruby/rbot/ircbot.rb:33:in <top (required)>' 08:45 <placeholder> Mar 13 03:45:06 Loki rbot[569443]: from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:136:in require'
08:45 Mar 13 03:45:06 Loki rbot[569443]: from internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:136:in require' 08:45 <placeholder> Mar 13 03:45:06 Loki rbot[569443]: from /usr/bin/rbot:90:in

'
08:53 henk: ↑ that's the error that happens.
09:49 errrr, wtf? there is no "ensure" in my code o_O
09:58 I get not a single search result for "Invalid retry after ensure"
09:58 on duckduckgo
10:10 lib/rbot/load-gettext.rb
10:10 133: ensure
10:12 yeah, that’s not in context. unless there is some chain of calls involved that I haven’t traced yet.
10:18 Only one I found in there. Like I said I don't really know the correct fix, but removing the retry at least gets me online.

Description: Fix launching with Ruby 3.3
Author: placeholder <placeholder@example.com>
Origin: vendor
Forwarded: no

---
 lib/rbot/load-gettext.rb |    1 -
 1 file changed, 1 deletion(-)

--- a/lib/rbot/load-gettext.rb
+++ b/lib/rbot/load-gettext.rb
@@ -68,7 +68,6 @@ begin
         result
       end
     end
-    retry
   end
 
   module GetText

The relevant code is

begin
bindtextdomain 'rbot'
rescue NoMethodError => e
error e
warning 'Trying to work around RubyGems/GetText incompatibility'
module ::Gem
def self.all_load_paths
result = []
Gem.path.each do |gemdir|
each_load_path all_partials(gemdir) do |load_path|
result << load_path
end
end
result
end
end
retry
end
and I don’t understand why it’s there, yet.
It’s also not really clear what the error means. There is no (obvious) call to ensure but maybe this piece of code is called in some ensure block in a file far, far away from where the error occurs.

If anyone wants to dig into that or knows what the error is about, that would be great!

In any case just retrying without end seems stupid, so getting rid of that retry call seems like a good idea in any case. Retrying X times, e.g. by introducing a retry counter, does not seem to make sense as the problem is likely permanent.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions