Skip to content

[Bug]: ruby3.2: bundle exec rake test fails even if modifying taintness issue with liquid 4 #9236

@mtasaka

Description

@mtasaka

Operating System

Fedora 38 x86_64

Ruby Version

ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux] ruby/ruby@a528908

Jekyll Version

0951a46

GitHub Pages Version

No response

Expected Behavior

$ bundle exec rake test succeeds.

Current Behavior

Even if using liquid-4.0.3 with taintness issue patched out (ref: https://src.fedoraproject.org/rpms/rubygem-liquid/c/aa6d7d89cf2ffd0f73033b2a28d99c590c650113 ), bundle exec rake test for jekyll head ( 0951a46 ) still fails like:

$ env TZ=UTC ruby -S bundle exec rake TESTOPTS=--profile test
/usr/bin/ruby -w -I"lib:lib:test" /builddir/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb "test/test_ansi.rb" "test/test_cleaner.rb" "test/test_coffeescript.rb" "test/test_collections.rb" "test/test_command.rb" "test/test_commands_serve.rb" "test/test_commands_serve_servlet.rb" "test/test_configuration.rb" "test/test_convertible.rb" "test/test_data_reader.rb" "test/test_doctor_command.rb" "test/test_document.rb" "test/test_drop.rb" "test/test_entry_filter.rb" "test/test_excerpt.rb" "test/test_excerpt_drop.rb" "test/test_filters.rb" "test/test_front_matter_defaults.rb" "test/test_generated_site.rb" "test/test_kramdown.rb" "test/test_layout_reader.rb" "test/test_liquid_extensions.rb" "test/test_liquid_renderer.rb" "test/test_log_adapter.rb" "test/test_new_command.rb" "test/test_page.rb" "test/test_page_without_a_file.rb" "test/test_path_manager.rb" "test/test_path_sanitization.rb" "test/test_plugin_manager.rb" "test/test_post_reader.rb" "test/test_regenerator.rb" "test/test_related_posts.rb" "test/test_sass.rb" "test/test_site.rb" "test/test_site_drop.rb" "test/test_static_file.rb" "test/test_tag_highlight.rb" "test/test_tag_include.rb" "test/test_tag_include_relative.rb" "test/test_tag_link.rb" "test/test_tag_post_url.rb" "test/test_theme.rb" "test/test_theme_assets_reader.rb" "test/test_theme_data_reader.rb" "test/test_theme_drop.rb" "test/test_url.rb" "test/test_utils.rb" "test/test_win_tz.rb" --profile
# -------------------------------------------------------------
# SPECS AND TESTS ARE RUNNING WITH WARNINGS OFF.
# SEE: https://github.com/Shopify/liquid/issues/730
# SEE: https://github.com/jekyll/jekyll/issues/4719
# -------------------------------------------------------------

# Running tests with run options --profile --seed 32975:

..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................E............E.........................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished tests in 87.256646s, 10.9218 tests/s, 24.2388 assertions/s.


Error:
TestFilters#test_: filters jsonify filter should call #to_liquid . :
ArgumentError: unknown keywords: kay
    /builddir/build/GIT/jekyll/test/test_filters.rb:721:in `initialize'
    /builddir/build/GIT/jekyll/test/test_filters.rb:721:in `new'
    /builddir/build/GIT/jekyll/test/test_filters.rb:721:in `to_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:467:in `as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:464:in `block in as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:464:in `map'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:464:in `as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:171:in `jsonify'
    /builddir/build/GIT/jekyll/test/test_filters.rb:750:in `block (3 levels) in <class:TestFilters>'
    /builddir/build/GIT/jekyll/test/test_filters.rb:735:in `instance_exec'
    /builddir/build/GIT/jekyll/test/test_filters.rb:735:in `block in create_test_from_should_hash'

Error:
TestFilters#test_: filters jsonify filter should handle hashes with all sorts of weird keys and values. :
ArgumentError: unknown keywords: kay
    /builddir/build/GIT/jekyll/test/test_filters.rb:721:in `initialize'
    /builddir/build/GIT/jekyll/test/test_filters.rb:721:in `new'
    /builddir/build/GIT/jekyll/test/test_filters.rb:721:in `to_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:467:in `as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:464:in `block in as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:464:in `map'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:464:in `as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:462:in `block in as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:462:in `each'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:462:in `each_with_object'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:462:in `as_liquid'
    /builddir/build/GIT/jekyll/lib/jekyll/filters.rb:171:in `jsonify'
    /builddir/build/GIT/jekyll/test/test_filters.rb:791:in `block (3 levels) in <class:TestFilters>'
    /builddir/build/GIT/jekyll/test/test_filters.rb:763:in `instance_exec'
    /builddir/build/GIT/jekyll/test/test_filters.rb:763:in `block in create_test_from_should_hash'

953 tests, 2115 assertions, 0 failures, 2 errors, 0 skips

This is very much like toshimaru/jekyll-toc#164 : due to "announced" Strcut behavior changed in ruby3.2 that "keyword_init" being true by default:

So passing keyword argument to Struct behaves differently in ruby3.2.

Relevant log output

No response

Code Sample

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions