Repository navigation
fix(worker-shell): stop double-encoding non-ASCII bytes in redirected output - #287
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Fixes #286 Gardener-Operation: op_76514dadb79ba4e92db823cd9e0b8e5c8ac9482ac492a6bd31f06eae26e993a5:d97657717d579f3ff754f537d5cf85ad47258678bdcdf82478509989615e2b02
🦋 Changeset detectedLatest commit: 3d76f6a The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Fixes #286
Cause
just-bash passes redirected output from
cat, heredocs andteetowriteFile/appendFileas a byte string (one char per byte) with encoding"binary".WorkspaceFsAdapter.writeFileandappendFileignored that argument (packages/computer/src/backends/worker-shell/adapter.ts:153-179), so the store UTF-8-encoded the string again and every byte >= 0x80 became two bytes (éstored asc3 83 c2 a9).Change
A small
binaryContenthelper converts strings tagged"binary"or"latin1"(string or{encoding}option) into bytes, one byte per char. Both methods use it. Untagged andutf8strings behave as before. Adds two tests toadapter.test.tsand a patch changeset.Why this option
It fixes the problem at the one place that misreads the encoding, adds no public API, and leaves text writes (
printf,echo) untouched.Alternatives considered
"binary"contract is correct.appendFile: leaveswriteFilebroken.Checks
mainand pass with the change.adapter.test.ts: 34 tests pass.npm run typecheckinpackages/computerpasses.Commits pushed by this task don't start CI. A maintainer can mention @ask-gardener on this pull request to switch to an alternative or ask for changes.