Skip to content

Keep org-ruby, creole and wikicloth working with frozen string literals - #2106

Open
Kyonax wants to merge 1 commit into
github:masterfrom
Kyonax:fix/frozen-string-literals
Open

Kyonax wants to merge 1 commit into
github:masterfrom
Kyonax:fix/frozen-string-literals

Conversation

@Kyonax

@Kyonax Kyonax commented Oct 2, 2026

Copy link
Copy Markdown

Related to #2105

Why

org-ruby, creole and wikicloth change string literals in place. With frozen string literals (--enable=frozen-string-literal today, possibly the default in a future Ruby), every Org, Creole and MediaWiki render fails with FrozenError. None of these gems has had a release in years, so upgrading them isn't an option.

This probably isn't what's behind the issue above, but it's the same kind of break waiting to happen.

What changed

  • The Org, Creole and MediaWiki renderers now load their gem with mutable string literals, but only when literals are frozen. Otherwise nothing changes.
  • A new Ruby 4.0 CI job runs the tests with frozen string literals.

Testing

bundle exec rake passes on Ruby 3.4 with and without RUBYOPT=--enable=frozen-string-literal, with 100% line and branch coverage. Without this change, the frozen run fails the Org, Creole and MediaWiki tests.

It only helps when the gem is first loaded through github-markup, not when an app has already loaded it.

org-ruby 0.9.12 (with rubypants), creole 0.5.0 and wikicloth 0.8.3
modify string literals in place, so every Org, Creole and MediaWiki
render raises FrozenError when string literals are frozen by default
(--enable=frozen-string-literal, or a future Ruby).

GemImplementation now accepts mutable_string_literals: true. When
literals are frozen, it loads the gem with frozen_string_literal: false
and restores the compile option afterwards. In the default "chilled"
mode it does nothing, because Ruby can't restore that state once it has
been changed.

Also add a Ruby 4.0 CI job that runs the tests with frozen string
literals.
@Thaodan

Thaodan commented Oct 3, 2026

Copy link
Copy Markdown

Note there are some PR's (didn't test) to fix this in org-ruby at least:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants