Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single line comments can end in newline or EOF. Fixes #11815 #11816

Merged
merged 4 commits into from
Jan 10, 2024

Conversation

camerondurham
Copy link
Contributor

@camerondurham camerondurham commented Jan 9, 2024

Description

Changes grammar of painless language to accept single-line comments that end in \n, \r or EOF.

Related Issues

Resolves #11815

To Reproduce Bug Before Fix

docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" public.ecr.aws/opensearchproject/opensearch:2.11.1

# wait for single-node cluster to init

curl -ku 'admin:admin' -XGET "https://localhost:9200/_scripts/painless/_execute" -H 'Content-Type: application/json' -d'{ 
    "script": 
        { 
            "source": "return 5 // I am an unparsable comment" 
        } 
}'


{"error":{"root_cause":[{"type":"script_exception","reason":"compile error","script_stack":["return 5 // I am an unparsable comm ...","          ^---- HERE"],"script":"return 5 // I am an unparsable comment","lang":"painless","position":{"offset":10,"start":0,"end":35}}],"type":"script_exception","reason":"compile error","script_stack":["return 5 // I am an unparsable comm ...","          ^---- HERE"],"script":"return 5 // I am an unparsable comment","lang":"painless","position":{"offset":10,"start":0,"end":35},"caused_by":{"type":"illegal_argument_exception","reason":"unexpected character [/ I am an unparsable comment].","caused_by":{"type":"lexer_no_viable_alt_exception","reason":null}}},"status":400}%

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented. (skipping since no new functionality added)
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created (not including since this is a "bug fix" that wasn't documented before)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

github-actions bot commented Jan 9, 2024

❌ Gradle check result for b486a87: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Jan 9, 2024

❕ Gradle check result for de002fb: UNSTABLE

  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteIndexPrimaryRelocationIT.testPrimaryRelocationWhileIndexing

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ebda963) 71.38% compared to head (88912d1) 71.38%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #11816      +/-   ##
============================================
- Coverage     71.38%   71.38%   -0.01%     
+ Complexity    59353    59330      -23     
============================================
  Files          4919     4919              
  Lines        278909   278909              
  Branches      40548    40548              
============================================
- Hits         199098   199092       -6     
- Misses        63294    63314      +20     
+ Partials      16517    16503      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Jan 9, 2024

❕ Gradle check result for fdfb640: UNSTABLE

  • TEST FAILURES:
      1 org.opensearch.remotestore.multipart.RemoteStoreMultipartIT.testNoSearchIdleForAnyReplicaCount

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@reta
Copy link
Collaborator

reta commented Jan 9, 2024

Ah ... conflicts, could you please rebase against latest main? Thank you.

Copy link
Contributor

github-actions bot commented Jan 9, 2024

❌ Gradle check result for 5c5c595: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: camerondurham <u64.cam@gmail.com>
Signed-off-by: Cameron Durham <u64.cam@gmail.com>
Signed-off-by: Cameron Durham <u64.cam@gmail.com>
Copy link
Contributor

github-actions bot commented Jan 9, 2024

❕ Gradle check result for 88912d1: UNSTABLE

  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreStatsIT.testNonZeroPrimaryStatsOnNewlyCreatedIndexWithZeroDocs

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@reta
Copy link
Collaborator

reta commented Jan 9, 2024

@dblock @msfroh could you please back me up here folks in case I am missing something, thank you!

@dblock
Copy link
Member

dblock commented Jan 10, 2024

@dblock @msfroh could you please back me up here folks in case I am missing something, thank you!

LGTM. The fact that no tests broke is promising, but @camerondurham if you want to spend a bit more time looking through existing tests around scripting to see if there are uncovered areas, that'd be grand.

@dblock dblock merged commit 8192488 into opensearch-project:main Jan 10, 2024
30 of 31 checks passed
@dblock dblock added the backport 2.x Backport to 2.x branch label Jan 10, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 10, 2024
* Single line comments can end in newline or EOF. Fixes #11815

Signed-off-by: camerondurham <u64.cam@gmail.com>

* Re-add license to autogen parser files

Signed-off-by: camerondurham <u64.cam@gmail.com>

* Remove noise from changelog

Signed-off-by: Cameron Durham <u64.cam@gmail.com>

* Accept single-line comments until newline char

Signed-off-by: Cameron Durham <u64.cam@gmail.com>

---------

Signed-off-by: camerondurham <u64.cam@gmail.com>
Signed-off-by: Cameron Durham <u64.cam@gmail.com>
(cherry picked from commit 8192488)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@reta reta added v3.0.0 Issues and PRs related to version 3.0.0 v2.12.0 Issues and PRs related to version 2.12.0 labels Jan 10, 2024
reta pushed a commit that referenced this pull request Jan 10, 2024
…#11834)

* Single line comments can end in newline or EOF. Fixes #11815



* Re-add license to autogen parser files



* Remove noise from changelog



* Accept single-line comments until newline char



---------



(cherry picked from commit 8192488)

Signed-off-by: camerondurham <u64.cam@gmail.com>
Signed-off-by: Cameron Durham <u64.cam@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
rayshrey pushed a commit to rayshrey/OpenSearch that referenced this pull request Mar 18, 2024
…ect#11815 (opensearch-project#11816)

* Single line comments can end in newline or EOF. Fixes opensearch-project#11815

Signed-off-by: camerondurham <u64.cam@gmail.com>

* Re-add license to autogen parser files

Signed-off-by: camerondurham <u64.cam@gmail.com>

* Remove noise from changelog

Signed-off-by: Cameron Durham <u64.cam@gmail.com>

* Accept single-line comments until newline char

Signed-off-by: Cameron Durham <u64.cam@gmail.com>

---------

Signed-off-by: camerondurham <u64.cam@gmail.com>
Signed-off-by: Cameron Durham <u64.cam@gmail.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…ect#11815 (opensearch-project#11816)

* Single line comments can end in newline or EOF. Fixes opensearch-project#11815

Signed-off-by: camerondurham <u64.cam@gmail.com>

* Re-add license to autogen parser files

Signed-off-by: camerondurham <u64.cam@gmail.com>

* Remove noise from changelog

Signed-off-by: Cameron Durham <u64.cam@gmail.com>

* Accept single-line comments until newline char

Signed-off-by: Cameron Durham <u64.cam@gmail.com>

---------

Signed-off-by: camerondurham <u64.cam@gmail.com>
Signed-off-by: Cameron Durham <u64.cam@gmail.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch bug Something isn't working Other v2.12.0 Issues and PRs related to version 2.12.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[BUG] Painless Script Single Line Comment at EOF Causes Parsing Error
3 participants