-
Notifications
You must be signed in to change notification settings - Fork 9
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
Preventing cutting unicode characters in half #77
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cb92ccb
Repreoducable unicode bug
shiroyasha 7e3ee6a
Preventing cutting unicode characters in half
shiroyasha a869032
Bitshift by 7 places, not by 8 places
shiroyasha 48d8fd4
Green tests for Docker x Unicode support
shiroyasha 9fd9fe6
Run tests on Semaphore
shiroyasha 58691a9
Green tests for Shell x Unicode
shiroyasha 92408dd
Fix multi-byte output code parsing
shiroyasha fd21f92
Handle cases when the unicode chars are broken
shiroyasha 2e81781
Build matrix
shiroyasha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/ruby | ||
|
||
Encoding.default_external = Encoding::UTF_8 | ||
|
||
# rubocop:disable all | ||
|
||
require_relative '../../e2e' | ||
|
||
start_job <<-JSON | ||
{ | ||
"id": "#{$JOB_ID}", | ||
|
||
"executor": "dockercompose", | ||
|
||
"compose": { | ||
"containers": [ | ||
{ | ||
"name": "main", | ||
"image": "ruby:2.6" | ||
} | ||
] | ||
}, | ||
|
||
"env_vars": [], | ||
"files": [], | ||
|
||
"commands": [ | ||
{ "directive": "echo | awk '{ printf(\\\"%c%c%c%c%c\\\", 150, 150, 150, 150, 150) }'"} | ||
], | ||
|
||
"epilogue_always_commands": [], | ||
|
||
"callbacks": { | ||
"finished": "https://httpbin.org/status/200", | ||
"teardown_finished": "https://httpbin.org/status/200" | ||
} | ||
} | ||
JSON | ||
|
||
wait_for_job_to_finish | ||
|
||
assert_job_log <<-LOG | ||
{"event":"job_started", "timestamp":"*"} | ||
|
||
{"event":"cmd_started", "timestamp":"*", "directive":"Pulling docker images..."} | ||
*** LONG_OUTPUT *** | ||
{"event":"cmd_finished", "timestamp":"*", "directive":"Pulling docker images...","event":"cmd_finished","exit_code":0,"finished_at":"*","started_at":"*","timestamp":"*"} | ||
|
||
{"event":"cmd_started", "timestamp":"*", "directive":"Starting the docker image..."} | ||
{"event":"cmd_output", "timestamp":"*", "output":"Starting a new bash session.\\n"} | ||
{"event":"cmd_finished", "timestamp":"*", "directive":"Starting the docker image...","event":"cmd_finished","exit_code":0,"finished_at":"*","started_at":"*","timestamp":"*"} | ||
|
||
{"event":"cmd_started", "timestamp":"*", "directive":"Exporting environment variables"} | ||
{"event":"cmd_finished", "timestamp":"*", "directive":"Exporting environment variables","exit_code":0,"finished_at":"*","started_at":"*"} | ||
{"event":"cmd_started", "timestamp":"*", "directive":"Injecting Files"} | ||
{"event":"cmd_finished", "timestamp":"*", "directive":"Injecting Files","exit_code":0,"finished_at":"*","started_at":"*"} | ||
|
||
{"event":"cmd_started", "timestamp":"*", "directive": "echo | awk '{ printf(\\\"%c%c%c%c%c\\\", 150, 150, 150, 150, 150) }'"} | ||
{"event":"cmd_output", "timestamp":"*", "output":"\ufffd\ufffd\ufffd\ufffd\ufffd"} | ||
{"event":"cmd_finished", "timestamp":"*", "directive": "echo | awk '{ printf(\\\"%c%c%c%c%c\\\", 150, 150, 150, 150, 150) }'","exit_code":0,"finished_at":"*","started_at":"*"} | ||
|
||
{"event":"cmd_started", "timestamp":"*", "directive":"export SEMAPHORE_JOB_RESULT=passed"} | ||
{"event":"cmd_finished", "timestamp":"*", "directive":"export SEMAPHORE_JOB_RESULT=passed","exit_code":0,"finished_at":"*","started_at":"*"} | ||
|
||
{"event":"job_finished", "timestamp":"*", "result":"passed"} | ||
LOG |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image credit: https://en.wikipedia.org/wiki/UTF-8
bug: continuation bytes start with
10xxxxxx
;1xxxxxxx
also include leading bytes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens very frequently when doing box drawing
Box drawing characters are 3 bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's it! Thanks for finding the bug and sharing the solution. 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work on the fix started here #79.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dnozay I started with the implementation of the patch, but unfortunately, I had a hard time replicating the issue in the Agent's tests.
My current assumption is that the root of the problem is not directly in the Agent, but upstream in the log processing service also. We are investigating further.
I'll update as soon as we find something.