Subject: bug#79257: 31.0.50; flymake's ruby-backend test fails with ruby 3.4.5

From: Eli Zaretskii <[email-masked]>
Date: Tue, 26 Aug 2025 15:22:04 +0300

> From: john muhl <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 25 Aug 2025 22:46:40 -0500
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> Cc: [email-masked]
> >> From: john muhl <[email-masked]>
> >> Date: Mon, 25 Aug 2025 16:23:16 -0500
> >> 
> >> Dmitry Gutov <[email-masked]> writes:
> >> 
> >> > Hi!
> >> >
> >> > On 24/08/2025 19:35, john muhl wrote:
> >> >> The cause is a change in the check output of new Ruby versions
> >> >> which include the location of the executable; e.g.
> >> >>    # Ruby 3.3.8
> >> >>    -:3: warning: statement not reached
> >> >>    -:6: syntax error, unexpected end-of-input, expecting `end' or dummy end
> >> >>    # Ruby 3.4.5
> >> >>    -:3: warning: statement not reached
> >> >>    /usr/bin/ruby: -:5: syntax errors found (SyntaxError)
> >> >> Here’s a patch that updates the regex to account for it. Tests
> >> >> pass with both Ruby 3.3 and 3.4.
> >> >
> >> > Thanks, that works, I've pushed the change to master.
> >> >
> >> > Curiously, in my testing with ruby 3.4.5 the executable name is not
> >> > absolute, just 'ruby: '. That still works with your change.
> >> 
> >> It seems to output however ruby gets invoked; e.g.
> >> 
> >>   $ /usr/bin/ruby -wc o.rb
> >>   vs.
> >>   $ ruby -wc o.rb
> >> 
> >> > I wonder if you've managed to find the specific commit in Ruby that
> >> > did that (or bugs.ruby-lang.org entry).
> >> > This change log mentions some other changes in the output, but not
> >> > this:
> >> > https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-0-released/
> >> 
> >> No. At first I thought it was something to do with the switch to
> >> the prism parser but using --parser=parse.y doesn’t change that
> >> part of the output.
> >> 
> >> >> -             "^\\(?:.*\\.rb\\|-\\):\\([0-9]+\\): \\(.*\\)$"
> >> >> +             "^\\(?:.*ruby: \\)?\\(?:.*\\.rb\\|-\\):\\([0-9]+\\):
> >> >   \\(.*\\)$"
> >> >
> >> > We could also make the first wildcard non-greedy (.*?).
> >> >
> >> > Perhaps put an initial slash before it too, for faster matching, but
> >> > I'm not sure how your variant of the output will look on Windows
> >> > (perhaps it starts with 'c:/').
> >> 
> >> Unfortunately I have no way to test Windows stuff.
> >
> > If an absolute file name is expected there, we should allow it to
> > begin with a drive letter on Windows.
> 
> I don’t think it ever happens that ruby-flymake-simple would get
> an absolute path in the output. If you look there you’ll see it
> calls plain “ruby -w -c” (and I don’t see anyway to customize
> that) so it will just have “ruby: ” in the output. You have to
> call Ruby with an absolute path to get one in the output.

In the example you brought up, I see

  /usr/bin/ruby: -:5: syntax errors found (SyntaxError)

The "/usr/bin/ruby" part is an absolute file name.

Apologies if I'm confused.