Repository navigation
Quote operator symbols containing // or /* in the text writer - #1171
Merged
tgregg merged 2 commits intoDec 3, 2026
Merged
Conversation
A symbol made only of operator characters is written unquoted inside an s-expression, but // and /* start a comment when the text is read back, so the symbol and whatever follows it on re-read are lost or reparsed.
Contributor
Author
|
any update? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1171 +/- ##
============================================
+ Coverage 67.23% 68.39% +1.15%
- Complexity 5484 5753 +269
============================================
Files 159 160 +1
Lines 23025 23518 +493
Branches 4126 4243 +117
============================================
+ Hits 15481 16084 +603
+ Misses 6262 6133 -129
- Partials 1282 1301 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
Did this get corresponding additions to the ion-test suite? It's a significant defect so we should make sure we have testing for all implementations. |
Contributor
|
Also, thanks for the fix, this was a great catch. (And an embarrassing bug) |
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.
Issue #, if available:
Description of changes:
IonTextUtils.symbolVariantand_Private_IonTextAppender.symbolNeedsQuotingtreat any symbol made only of operator characters as an operator, so the text writer andPrinteremit it unquoted inside an s-expression.//,/*and anything containing them (+/*,*//) are all operator characters, but the text reader starts a comment at/followed by/or*, so the written text no longer reads back as the same data.(// x)is whatIonTextWriterBuilderandIonValue.toString()currently produce for a sexp of the symbols//andx. Reading it back dropsxand everything else on the line./*, the comment runs until the next*/, including one inside a later string. A pretty-printed{tags:(/*), role:user, note:"*/), role:admin, note:1 //"}reads back as{tags:(), role:admin, note:1}, so an application that writes untrusted symbol text can have other fields replaced on re-read.Both helpers now quote the symbol when a
/is directly followed by/or*. A lone/or*/still goes out unquoted. Added cases toTextTest.testSymbolNeedsQuotingand a round-trip test toTextWriterTest. Both fail without the change and pass with it, and./gradlew buildis green. The header rewrites in the touched files come from the spotless ratchet.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.