This repository was archived by the owner on Dec 8, 2025. It is now read-only.
forked from marcoroth/herb
-
Notifications
You must be signed in to change notification settings - Fork 0
Merge upstream into main #9
Merged
Merged
Conversation
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
…ctory (marcoroth#493) Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `vite` from 6.3.5 to 6.3.6 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Upgrade Prism to [`v1.5.1`](https://github.com/ruby/prism/releases/tag/v1.5.1), also see [`v1.5.0`](https://github.com/ruby/prism/releases/tag/v1.5.0).
This pull request updates the parser to allow HTML Attributes to start
with a colon, which is typical in the Vue.js style:
```html
<div :class="classes"></div>
```
Previously, this caused a syntax error:
```js
@ UnexpectedError (location: (1:5)-(1:6))
├── message: "Unexpected Token. Expected: `TOKEN_IDENTIFIER, TOKEN_AT, TOKEN_ERB_START,TOKEN_WHITESPACE, or TOKEN_NEWLINE`, found: `TOKEN_COLON`."
├── description: "Unexpected Token"
├── expected: "TOKEN_IDENTIFIER, TOKEN_AT, TOKEN_ERB_START,TOKEN_WHITESPACE, or TOKEN_NEWLINE"
└── found: "TOKEN_COLON"
```
Now this parses as:
```js
@ HTMLAttributeNode (location: (1:5)-(1:21))
├── errors: []
├── name:
│ └── @ HTMLAttributeNameNode (location: (1:5)-(1:11))
│ ├── errors: []
│ └── children: (1 item)
│ └── @ LiteralNode (location: (1:5)-(1:11))
│ ├── errors: []
│ └── content: ":class"
│
├── equals: "=" (location: (1:11)-(1:12))
└── value:
└── @ HTMLAttributeValueNode (location: (1:12)-(1:21))
├── errors: []
├── open_quote: """ (location: (1:12)-(1:13))
├── children: (1 item)
│ └── @ LiteralNode (location: (1:13)-(1:20))
│ ├── errors: []
│ └── content: "classes"
│
│
├── close_quote: """ (location: (1:20)-(1:21))
└── quoted: true
```
I noticed a problem where the symptom was a wrong font used in the template. this is because the html was somehow escaped wrong. I removed the escape and everything seems to work just fine. <img width="1546" height="408" alt="CleanShot 2025-09-08 at 20 33 54@2x" src="https://github.com/user-attachments/assets/d9be670b-e868-4eba-aa0f-274ecf61a9e7" /> Co-authored-by: Marco Roth <marco.roth@intergga.ch>
…LI (marcoroth#466) This allows calling `herb-format` with arguments for customizing width ( `--indent-width` ) and line length ( `--max-line-length`) The expected behavior is to use the json config, but allowing cli args opens up to some workarounds while we don't have all integrations (eg: Zed)
When opening a link on ReActionView there's no possibility to open the source code with Cursor, it's opening VSCode by default. By adding the editor here I can open cursor now.
This pull request updates the Ruby C-Extension to use `rb_utf8_str_new_cstr()` over `rb_str_new_cstr()` when constructing Ruby Strings from the C `char[]`. This ensures we always have a UTF-8 string so we don't trigger a `Encoding::CompatibilityError (incompatible character encodings: BINARY (ASCII-8BIT) and UTF-8)` when concatenating strings. It looks like `rb_str_new_cstr()` sometimes produces an `UTF-8` string and sometimes an `ASCII-8BIT` string based on the content. Resolves marcoroth#492 Resolves marcoroth/reactionview#4
…rom the opening div (marcoroth#501) `parser_advance` consumes the `TOKEN_HTML_TAG_END`, which ends up not closing the opening tag. Snapshot diff (most notably, only a single `HTMLAttributeNode` and `HTMLCloseTagNode` now appears): <details><summary>Diff</summary> <p> ```patch diff --git a/test/snapshots/parser/attributes_test/test_0046_Empty_attribute_value_with_closing_bracket_immediatly_following_it_56df6b7e184a50db1eac62508206a332.txt b/test/snapshots/parser/attributes_test/test_0046_Empty_attribute_value_with_closing_bracket_immediatly_following_it_56df6b7e184a50db1eac62508206a332.txt index 41997bb..0f1e93e 100644 --- a/test/snapshots/parser/attributes_test/test_0046_Empty_attribute_value_with_closing_bracket_immediatly_following_it_56df6b7e184a50db1eac62508206a332.txt +++ b/test/snapshots/parser/attributes_test/test_0046_Empty_attribute_value_with_closing_bracket_immediatly_following_it_56df6b7e184a50db1eac62508206a332.txt @@ -1,61 +1,49 @@ @ DocumentNode (location: (1:0)-(1:38)) -├── errors: (1 error) -│ └── @ UnclosedElementError (location: (1:38)-(1:38)) -│ ├── message: "Tag `<div>` opened at (1:1) was never closed before the end of document." -│ └── opening_tag: "div" (location: (1:1)-(1:4)) -│ └── children: (1 item) └── @ HTMLElementNode (location: (1:0)-(1:38)) - ├── errors: (1 error) - │ └── @ MissingClosingTagError (location: (1:1)-(1:4)) - │ ├── message: "Opening tag `<div>` at (1:1) doesn't have a matching closing tag `</div>`." - │ └── opening_tag: "div" (location: (1:1)-(1:4)) - │ ├── open_tag: - │ └── @ HTMLOpenTagNode (location: (1:0)-(1:38)) + │ └── @ HTMLOpenTagNode (location: (1:0)-(1:21)) │ ├── tag_opening: "<" (location: (1:0)-(1:1)) │ ├── tag_name: "div" (location: (1:1)-(1:4)) - │ ├── tag_closing: ">" (location: (1:37)-(1:38)) - │ ├── children: (2 items) - │ │ ├── @ HTMLAttributeNode (location: (1:5)-(1:21)) - │ │ │ ├── name: - │ │ │ │ └── @ HTMLAttributeNameNode (location: (1:5)-(1:19)) - │ │ │ │ └── children: (1 item) - │ │ │ │ └── @ LiteralNode (location: (1:5)-(1:19)) - │ │ │ │ └── content: "attribute-name" - │ │ │ │ - │ │ │ │ - │ │ │ ├── equals: "=" (location: (1:19)-(1:20)) - │ │ │ └── value: - │ │ │ └── @ HTMLAttributeValueNode (location: (1:20)-(1:21)) - │ │ │ ├── errors: (1 error) - │ │ │ │ └── @ UnexpectedError (location: (1:20)-(1:21)) - │ │ │ │ ├── message: "Unexpected Token. Expected: `TOKEN_IDENTIFIER, TOKEN_QUOTE, TOKEN_ERB_START`, found: `TOKEN_HTML_TAG_END`." - │ │ │ │ ├── description: "Unexpected Token" - │ │ │ │ ├── expected: "TOKEN_IDENTIFIER, TOKEN_QUOTE, TOKEN_ERB_START" - │ │ │ │ └── found: "TOKEN_HTML_TAG_END" - │ │ │ │ - │ │ │ ├── open_quote: ∅ - │ │ │ ├── children: [] - │ │ │ ├── close_quote: ∅ - │ │ │ └── quoted: false - │ │ │ - │ │ │ - │ │ └── @ HTMLAttributeNode (location: (1:21)-(1:37)) + │ ├── tag_closing: ">" (location: (1:20)-(1:21)) + │ ├── children: (1 item) + │ │ └── @ HTMLAttributeNode (location: (1:5)-(1:21)) │ │ ├── name: - │ │ │ └── @ HTMLAttributeNameNode (location: (1:21)-(1:37)) + │ │ │ └── @ HTMLAttributeNameNode (location: (1:5)-(1:19)) │ │ │ └── children: (1 item) - │ │ │ └── @ LiteralNode (location: (1:21)-(1:37)) - │ │ │ └── content: "div-content</div" + │ │ │ └── @ LiteralNode (location: (1:5)-(1:19)) + │ │ │ └── content: "attribute-name" │ │ │ │ │ │ - │ │ ├── equals: ∅ - │ │ └── value: ∅ + │ │ ├── equals: "=" (location: (1:19)-(1:20)) + │ │ └── value: + │ │ └── @ HTMLAttributeValueNode (location: (1:20)-(1:21)) + │ │ ├── errors: (1 error) + │ │ │ └── @ UnexpectedError (location: (1:20)-(1:21)) + │ │ │ ├── message: "Unexpected Token. Expected: `TOKEN_IDENTIFIER, TOKEN_QUOTE, TOKEN_ERB_START`, found: `TOKEN_HTML_TAG_END`." + │ │ │ ├── description: "Unexpected Token" + │ │ │ ├── expected: "TOKEN_IDENTIFIER, TOKEN_QUOTE, TOKEN_ERB_START" + │ │ │ └── found: "TOKEN_HTML_TAG_END" + │ │ │ + │ │ ├── open_quote: ∅ + │ │ ├── children: [] + │ │ ├── close_quote: ∅ + │ │ └── quoted: false + │ │ │ │ │ └── is_void: false │ ├── tag_name: "div" (location: (1:1)-(1:4)) - ├── body: [] - ├── close_tag: ∅ + ├── body: (1 item) + │ └── @ HTMLTextNode (location: (1:21)-(1:32)) + │ └── content: "div-content" + │ + ├── close_tag: + │ └── @ HTMLCloseTagNode (location: (1:32)-(1:38)) + │ ├── tag_opening: "</" (location: (1:32)-(1:34)) + │ ├── tag_name: "div" (location: (1:34)-(1:37)) + │ ├── children: [] + │ └── tag_closing: ">" (location: (1:37)-(1:38)) + │ ├── is_void: false └── source: "HTML" \ No newline at end of file ``` </p> </details>
) This pull request adds a `visitors` option to the `Herb::Engine` for preprocessing the AST before the template gets compiled. This allows us to refactor/soft-deprecate the `debug` option, since we can just pass the `Herb::Engine::DebugVisitor` as a visitor for preprocessing the AST before compiling the template. It also allows to implement custom visitors that could implement new syntax/transformations/rewrites etc. (i.e use `<Component :class="vue-style">` syntax, erase all HTML Comments, strip certain attributes, ...)
Fix typo
This seems to fix marcoroth#467 but I might be missing some other bits and bobs
…oth#516) Bumps the npm_and_yarn group with 2 updates in the / directory: [esbuild](https://github.com/evanw/esbuild) and [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `esbuild` from 0.25.9 to 0.25.10 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…arcoroth#517) This pull request updates the parser and the analyzer to only transform an `ERBContentNode` node to an `ERBIfNode` or `ERBUnlessNode` when it has both `if/unless` and `end` keywords. Guard clauses or ternaries shouldn't be treated as `ERBIfNode` or `ERBUnlessNode`. We might want to revisit this when we expose the actual prism nodes for each `ERBContentNode`, but for the sake of parsing/formatting we shouldn't treat those `ERBIfNode` or `ERBUnlessNode` nodes for now. Resolves marcoroth#505
…ctory (marcoroth#519) Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `vite` from 7.0.7 to 7.1.5 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ctory (marcoroth#520) Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `vite` from 7.1.5 to 7.1.6 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This pull request updates the `html-no-empty-attributes` linter rule to allow for empty data attributes without an equal sign and attribute value. This **is not** allowed: ```html <div data-turbo-permament=""></div> ``` This **is** now allowed with this pull request: ```html <div data-turbo-permament></div> ``` Resolves marcoroth#483
…ctory (marcoroth#521) Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `vite` from 7.1.6 to 7.1.7 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…oroth#522) This pull request updates to formatter to fix an issue where HTML elements inside `<pre>`, `<style>`, `<script>`, and `<textarea>` tags lost spaces between tag names and attributes during formatting. For example, `<tt id="test">` was incorrectly formatted as `<ttid="test">`. Resolves marcoroth#477
…coroth#523) This pull request updates the formatter to also add surrounding spaces for `ERBContentNode` nodes within HTML attribute values when formatting HTML+ERB documents. Resolves marcoroth#482
As painstakingly worked out with @marcoroth during Kaigi on Rails, macOS 26 Tahoe introduces a function named `parser_init` that can clobber the Herb function with the same name. Precompiled gems no longer crash on macOS 26 after this change to ensure the Herb functions will not be clobbered by the OS functions. From what we could tell, macOS has a new(?) framework called "Biome" which both defines `parser_parse` and `parse_init` functions. We believe the reason why this bug only occured in the precompiled version of the gem is because at compile time it wouldn't know about both of these functions. So at runtime it would "choose" the first matching one, which happened to be the wrong one, thus messing with the stack/structs when calling the function here: https://github.com/marcoroth/herb/blob/b93eba9f80e7828428e084efd103acdf77bee81a/src/herb.c#L32 which then lead to this `EXC_BAD_ACCESS (code=1, address=0x29)` error later in: https://github.com/marcoroth/herb/blob/b93eba9f80e7828428e084efd103acdf77bee81a/src/parser.c#L1210 Resolves marcoroth#484 Resolves marcoroth/reactionview#13 Co-Authored-By: Marco Roth <marco.roth@intergga.ch>
Following up on our discussion. This should do it. What is also needed is: - add deployment env to your repo settings - configure truste publidhing in rubygems Please note I do not have a way to test it. I made it based on my: https://github.com/karafka/rdkafka-ruby/blob/main/.github/workflows/push_linux_x86_64_gnu.yml
davepilling
approved these changes
Sep 29, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Simply a merge of upstream commits. Locally, I had to fix a conflict in
playground/package.jsonas upstream had pinned a v7.x version to fix a dependency alert which I had fixed with a v6.x pin.Commit messages from upstream:
- **Update Snapshot file**Bump vite from 6.3.5 to 6.3.6 in the npm_and_yarn group across 1 directory (Bump vite from 6.3.5 to 6.3.6 in the npm_and_yarn group across 1 directory marcoroth/herb#493)
Bumps the npm_and_yarn group with 1 update in the / directory:
vite.
Updates
vitefrom 6.3.5 to 6.3.6Signed-off-by: dependabot[bot] support@github.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bump Prism to
v1.5.1(Bump Prism tov1.5.1marcoroth/herb#495)Upgrade Prism to
v1.5.1, also seev1.5.0.Allow Colon
:in HTML Attribute Names (Allow Colon:in HTML Attribute Names marcoroth/herb#496)This pull request updates the parser to allow HTML Attributes to start
with a colon, which is typical in the Vue.js style:
Previously, this caused a syntax error:
Now this parses as:
v0.7.1Update Snapshot and Stimulus Lint version
Remove double HTML-escaping from error template (Remove double HTML-escaping from error template marcoroth/herb#487)
I noticed a problem where the symptom was a wrong font used in the
template. this is because the html was somehow escaped wrong. I removed
the escape and everything seems to work just fine.
Co-authored-by: Marco Roth marco.roth@intergga.ch
Formatter: Add
--indent-widthand--max-line-lengthargs to the CLI (Formatter: Add--indent-widthand--max-line-lengthargs to the CLI marcoroth/herb#466)This allows calling
herb-formatwith arguments for customizing width (--indent-width) and line length (--max-line-length)The expected behavior is to use the json config, but allowing cli args
opens up to some workarounds while we don't have all integrations (eg:
Zed)
Add Cursor as available editor to link source files (Add Cursor as available editor to link source files marcoroth/herb#486)
When opening a link on ReActionView there's no possibility to open the
source code with Cursor, it's opening VSCode by default.
By adding the editor here I can open cursor now.
Use
rb_utf8_str_new_cstr()in Ruby C-Extension (Userb_utf8_str_new_cstr()in Ruby C-Extension marcoroth/herb#500)This pull request updates the Ruby C-Extension to use
rb_utf8_str_new_cstr()overrb_str_new_cstr()when constructing RubyStrings from the C
char[].This ensures we always have a UTF-8 string so we don't trigger a
Encoding::CompatibilityError (incompatible character encodings: BINARY (ASCII-8BIT) and UTF-8)when concatenating strings.It looks like
rb_str_new_cstr()sometimes produces anUTF-8stringand sometimes an
ASCII-8BITstring based on the content.Resolves incompatible character encodings with a non-breaking space marcoroth/herb#492
Resolves Render failure using "•" bullet character marcoroth/reactionview#4
Dev Tools: Also add
zedas available editorParser: Fix
<div foo=>bar</div>skipping over the closing bracket from the opening div (Parser: Fix<div foo=>bar</div>skipping over the closing bracket from the opening div marcoroth/herb#501)parser_advanceconsumes theTOKEN_HTML_TAG_END, which ends up notclosing the opening tag.
Snapshot diff (most notably, only a single
HTMLAttributeNodeandHTMLCloseTagNodenow appears):Diff
Engine: Add
visitorsfor modifying AST before compiling (Engine: Addvisitorsfor modifying AST before compiling marcoroth/herb#502)This pull request adds a
visitorsoption to theHerb::Engineforpreprocessing the AST before the template gets compiled.
This allows us to refactor/soft-deprecate the
debugoption, since wecan just pass the
Herb::Engine::DebugVisitoras a visitor forpreprocessing the AST before compiling the template.
It also allows to implement custom visitors that could implement new
syntax/transformations/rewrites etc. (i.e use
<Component :class="vue-style">syntax, erase all HTML Comments, strip certainattributes, ...)
v0.7.2Parser: Analyze parse errors as
partial_script(Parser: Analyze parse errors aspartial_scriptmarcoroth/herb#503)Update README.md (Update README.md marcoroth/herb#508)
Fix typo
Fix typo in pretty_print_analyzed_ruby method (Fix typo in pretty_print_analyzed_ruby method marcoroth/herb#512)
Add missing
filesand vendor Prism to allow compiling gem from source (Add missingfilesand vendor Prism to allow compiling gem from source marcoroth/herb#515)Resolves Installation error when Bundler
force_ruby_platformis set to true marcoroth/herb#258Resolves Problem installing herb 0.7.2 on OpenBSD/adJ 7.7:
LoadError: cannot load such file -- ...3.4/gems/herb-0.7.2/templates/template (LoadError)marcoroth/herb#510Add
TOKEN_BACKTICKto list of text content tokens (AddTOKEN_BACKTICKto list of text content tokens marcoroth/herb#468)This seems to fix Parser error on backtick token. marcoroth/herb#467 but I
might be missing some other bits and bobs
Bump the npm_and_yarn group across 1 directory with 2 updates (Bump the npm_and_yarn group across 1 directory with 2 updates marcoroth/herb#516)
Bumps the npm_and_yarn group with 2 updates in the / directory: esbuild and vite.
Updates
esbuildfrom 0.25.9 to 0.25.10Signed-off-by: dependabot[bot] support@github.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Parser: Don't treat guard clauses as
ERBIfNodeorERBUnlessNode(Parser: Don't treat guard clauses asERBIfNodeorERBUnlessNodemarcoroth/herb#517)This pull request updates the parser and the analyzer to only transform
an
ERBContentNodenode to anERBIfNodeorERBUnlessNodewhen ithas both
if/unlessandendkeywords.Guard clauses or ternaries shouldn't be treated as
ERBIfNodeorERBUnlessNode. We might want to revisit this when we expose the actualprism nodes for each
ERBContentNode, but for the sake ofparsing/formatting we shouldn't treat those
ERBIfNodeorERBUnlessNodenodes for now.Resolves Formatter: Indents the rest of code below guard clauses marcoroth/herb#505
Bump vite from 7.0.7 to 7.1.5 in the npm_and_yarn group across 1 directory (Bump vite from 7.0.7 to 7.1.5 in the npm_and_yarn group across 1 directory marcoroth/herb#519)
Bumps the npm_and_yarn group with 1 update in the / directory:
vite.
Updates
vitefrom 7.0.7 to 7.1.5Signed-off-by: dependabot[bot] support@github.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bump vite from 7.1.5 to 7.1.6 in the npm_and_yarn group across 1 directory (Bump vite from 7.1.5 to 7.1.6 in the npm_and_yarn group across 1 directory marcoroth/herb#520)
Bumps the npm_and_yarn group with 1 update in the / directory:
vite.
Updates
vitefrom 7.1.5 to 7.1.6Signed-off-by: dependabot[bot] support@github.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Linter: Allow empty data attributes with no value (Linter: Allow empty data attributes with no value marcoroth/herb#518)
This pull request updates the
html-no-empty-attributeslinter rule toallow for empty data attributes without an equal sign and attribute
value.
This is not allowed:
This is now allowed with this pull request:
Resolves Linter Rule: Reconsider html-no-empty-attributes, at least for data attributes marcoroth/herb#483
Bump vite from 7.1.6 to 7.1.7 in the npm_and_yarn group across 1 directory (Bump vite from 7.1.6 to 7.1.7 in the npm_and_yarn group across 1 directory marcoroth/herb#521)
Bumps the npm_and_yarn group with 1 update in the / directory:
vite.
Updates
vitefrom 7.1.6 to 7.1.7Signed-off-by: dependabot[bot] support@github.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Formatter: Fix attribute spacing in content-preserving elements (Formatter: Fix attribute spacing in content-preserving elements marcoroth/herb#522)
This pull request updates to formatter to fix an issue where HTML
elements inside
<pre>,<style>,<script>, and<textarea>tagslost spaces between tag names and attributes during formatting.
For example,
<tt id="test">was incorrectly formatted as<ttid="test">.Resolves Formatter: <pre><tt att="value"> problem marcoroth/herb#477
Formatter: Add spaces in
ERBContentNodewithin HTML attributes (Formatter: Add spaces inERBContentNodewithin HTML attributes marcoroth/herb#523)This pull request updates the formatter to also add surrounding spaces
for
ERBContentNodenodes within HTML attribute values when formattingHTML+ERB documents.
Resolves Formatter: Should format code to avoid erb-require-whitespace-inside-tags linter warning inside html attribute values marcoroth/herb#482
v0.7.3Engine: Add missing newline when compiling
<% # comment %>(Engine: Add missing newline when compiling<% # comment %>marcoroth/herb#530)Resolves Herb Engine: Comments in ERB files cause crashes when compiling templates marcoroth/reactionview#24
Parser: Namespace Parser C functions (Parser: Namespace Parser C functions marcoroth/herb#534)
As painstakingly worked out with @marcoroth during Kaigi on Rails, macOS
26 Tahoe introduces a function named
parser_initthat can clobber theHerb function with the same name. Precompiled gems no longer crash on
macOS 26 after this change to ensure the Herb functions will not be
clobbered by the OS functions.
From what we could tell, macOS has a new(?) framework called "Biome" which both defines
parser_parseandparse_initfunctions.We believe the reason why this bug only occured in the precompiled version of the gem is because at compile time it wouldn't know about both of these functions. So at runtime it would "choose" the first matching one, which happened to be the wrong one, thus messing with the stack/structs when calling the function here:
https://github.com/marcoroth/herb/blob/b93eba9f80e7828428e084efd103acdf77bee81a/src/herb.c#L32
which then lead to this
EXC_BAD_ACCESS (code=1, address=0x29)error later in:https://github.com/marcoroth/herb/blob/b93eba9f80e7828428e084efd103acdf77bee81a/src/parser.c#L1210
Resolves macOS 26: Segmentation fault when parsing files marcoroth/herb#484
Resolves Herb: Segmentation fault under Mac OS 26.0 Tahoe marcoroth/reactionview#13
Co-Authored-By: Marco Roth marco.roth@intergga.ch
Release
herbgem via trusted publishing (Releaseherbgem via trusted publishing marcoroth/herb#532)Following up on our discussion. This should do it. What is also needed
is:
Please note I do not have a way to test it. I made it based on my:
https://github.com/karafka/rdkafka-ruby/blob/main/.github/workflows/push_linux_x86_64_gnu.yml
v0.7.4Docs: Fix link for
html-no-self-closingrule in README (Docs: Fix link forhtml-no-self-closingrule in README marcoroth/herb#535)Bump tar-fs from 2.1.3 to 2.1.4 in the npm_and_yarn group across 1 directory (Bump tar-fs from 2.1.3 to 2.1.4 in the npm_and_yarn group across 1 directory marcoroth/herb#536)