Bug 206233

Summary: Offlineasm warnings with newer Ruby versions
Product: WebKit Reporter: Adrian Perez <aperez>
Component: JavaScriptCoreAssignee: Adrian Perez <aperez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, fpizlo, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Adrian Perez 2020-01-14 07:48:13 PST
Using Ruby 2.7 the following will be printed out:

  /home/aperez/WebKit/Source/JavaScriptCore/offlineasm/parser.rb:631:
  warning: deprecated Object#=~ is called on Annotation; it always returns nil

This is caused by the following change in Ruby:

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=65989&view=revision

I see that the Annotation class does *not* define an overload for the =~ operator,
so previously applying it to an Annotation instance was already returning “nil”
(but silently).

Therefore I *think* that swapping the checks in the code to something like

  if @tokens[@idx].is_a? Annotation
     # ...
  elsif (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
     # ...

should both silence the warning and still be correct.

Note that I do not have much experience with Ruby, nor with modifying offlineasm,
so suggestions are definitely welcome.
Comment 1 Adrian Perez 2020-01-14 07:52:28 PST
Created attachment 387655 [details]
Patch
Comment 2 Adrian Perez 2020-01-15 01:58:24 PST
The failed test run from the “mac-wk1” EWS seems unrelated.
Comment 3 Yusuke Suzuki 2020-01-15 10:52:33 PST
Comment on attachment 387655 [details]
Patch

r=me
Comment 4 WebKit Commit Bot 2020-01-15 12:32:21 PST
The commit-queue encountered the following flaky tests while processing attachment 387655 [details]:

The commit-queue is continuing to process your patch.
Comment 5 WebKit Commit Bot 2020-01-15 12:32:36 PST
The commit-queue encountered the following flaky tests while processing attachment 387655 [details]:

media/track/track-cues-sorted-before-dispatch.html bug 206225 (authors: simon.pena@samsung.com and vcarbune@chromium.org)
The commit-queue is continuing to process your patch.
Comment 6 WebKit Commit Bot 2020-01-15 14:15:43 PST
Comment on attachment 387655 [details]
Patch

Clearing flags on attachment: 387655

Committed r254637: <https://trac.webkit.org/changeset/254637>
Comment 7 WebKit Commit Bot 2020-01-15 14:15:45 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2020-01-15 14:16:19 PST
<rdar://problem/58618860>