Fix multiple backwards compatibility issues found in fpm v1.17.0#2123
Merged
jordansissel merged 4 commits intomainfrom Nov 14, 2025
Merged
Fix multiple backwards compatibility issues found in fpm v1.17.0#2123jordansissel merged 4 commits intomainfrom
jordansissel merged 4 commits intomainfrom
Conversation
Ruby v2.7.0 upgraded `strscan` to v1.0.3 which allowed String argument to
the StringScanner#scan() method.
On Ruby v2.6.0 and older, fpm 1.17.0's python.rb would call `#scan("\n")`
which fails with the following:
```
`scan': wrong argument type String (expected Regexp)
```
Passing a regex solves this and works on both newer and older rubies, as
tested: v2.5.0 and v3.4.0
Citations:
https://github.com/ruby/ruby/blob/v2_7_0/NEWS?plain=1#L677-L680
> StringScanner: Upgrade to 1.0.3.
https://github.com/ruby/strscan/blob/master/NEWS.md?plain=1#L321-L322
> 1.0.2: Added support for `String` as a pattern. This improves performance.
Found while investigating #2120
Ruby v2.6.0 introduces "endless range" syntax, such as "foo"[1..] where `1..` is the endless range. To fix this for rubies older than 2.6.0, the older syntax can be used, where `String#[3..]` is the same as `String#[3..-1]` as a negative value on a range, for a String slice, is relative to the end of the string. Citations: https://github.com/ruby/ruby/blob/v2_6_0/NEWS?plain=1#L29-L36 > Endless ranges are introduced Fixes #2120
Ruby 2.6.0 added Array#filter as an alias for an existing method, Array#select. Citations: https://github.com/ruby/ruby/blob/v2_6_0/NEWS?plain=1#L65 > Array#filter is a new alias for Array#select Found while investigating #2120
Owner
Author
|
GHA test suite doesn't test Ruby 2.7, so I'm testing locally --- on ruby 2.5.0, the full test suite result: The one failure seems to be a bug or misuse of fileutils: On ruby 2.5.0 and Linux, calling Testing in isolation: Same error, basically. This failure seems unrelated to this change and more about how fpm may be calling copy_entry incorrectly for symlinks? I'll ignroe it for this issue. |
Owner
Author
|
Found it -- I"ll fix it here anyway. The test suite is calling FileUtil#copy_entry with preserve=true for a symlink and this errors on Ruby 2.5.0, but not 3.4.0. |
Owner
Author
|
New test, 2.5.0: Passes on 3.4.0 also |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes:
-1as end of range if appropriate. (introduced in ruby 2.6.0)Fixes #2120