Fixed: Fix session cleanup, terminal emulator resize, OSC 104, DECCARA, ESC F, tokenizer and shebang bugs - #5247
Open
BuildWithAni wants to merge 4 commits into
Conversation
…ux-shared - Fixed: Send SIGKILL to process in AppShell.killIfExecuting() unconditionally since setStateFailed() sets state to FAILED and isExecuting() will always be false after that, so SIGKILL was never sent - Fixed: Return early in AmSocketServer.processAmClient() after sending error result to client so that a bogus success result frame is not sent afterwards - Fixed: Use client socket fd instead of server socket fd in LocalClientSocket.available() to check for available data
… bound - Fixed: Implement onSessionFinished() in TermuxTerminalSessionServiceClient to remove finished sessions when the TermuxActivity is not bound to the TermuxService, since TermuxTerminalSessionActivityClient was the only client that processed finished sessions. Sessions that finished while the activity was unbound were never removed, plugin results were never sent back and the notification was never updated, so the service would not stop - Fixed: Remove the global layout listener of FullScreenWorkAround when activity is destroyed and deduplicate instances on re-apply so that the listener does not keep running and hold activity references after the activity has been destroyed
- Fixed: Remove stale resize style indexing bug comment and guard against unpaired high surrogate at end of row in TerminalBuffer.resize() so that rows ending with an unpaired high surrogate do not read mText out of bounds - Fixed: Validate OSC 104 color index before resetting it and restructure the parameter loop so that malformed input does not crash with ArrayIndexOutOfBoundsException or StringIndexOutOfBoundsException - Fixed: Clamp DECCARA and DECRARA rectangle coordinates to effective margins so that bottom and right bounds never exceed the screen dimensions and the last row and column are not excluded - Fixed: Move cursor to lower-left corner of screen instead of top row in ESC F handler
…shebang interpreter arguments - Fixed: Guard against reading past the end of the string in ArgumentTokenizer when a double quoted argument ends with a backslash so that a StringIndexOutOfBoundsException is not thrown - Fixed: Preserve shebang interpreter arguments like the -e flag of #!/bin/bash -e and the interpreter name of #!/usr/bin/env bash in TermuxShellUtils.setupShellCommandArguments() instead of dropping everything after the first whitespace
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 several bugs found while reviewing the codebase, across
app,terminal-emulatorandtermux-sharedmodules.Finished sessions never removed when activity is not bound (
TermuxTerminalSessionServiceClient.java).onSessionFinished()was left empty, so sessions that finished while the activity was not bound were never removed, their results never sent and their notifications never updated. Now it mirrorsTermuxTerminalSessionActivityClient.onSessionFinished()minus the UI side effects. Also removed the full-screen work-aroundOnTouchListenerleak by removing it inTermuxActivity.onDestroy()and deduplicating listener creation inFullScreenWorkAround.java.TerminalBuffer.resize()crash on unpaired high surrogate (TerminalBuffer.java). When resizing, an unpaired high surrogate at the end oflastNonSpaceIndexcausedString.codePointAt()to throwIndexOutOfBoundsException. The surrogate is now replaced withUNICODE_REPLACEMENT_CHARbefore copying. Also removed the stale "NEWLY INTRODUCED BUG" comment.OSC 104 color index out of bounds (
TerminalEmulator.java).indexOfoutside0..NUM_INDEXED_COLORS-1(259) causedArrayIndexOutOfBoundsExceptionwhen resetting color index palette entries. The range is now bounds-checked and the loop restructured.DECCARA/DECRARA coordinates not clamped to effective margins (
TerminalEmulator.java). Parameters are 1-based and top/left are inclusive while bottom/right are exclusive; the effective margins under origin mode were not respected, so rectangles could extend into the wrong region. Coordinates are now clamped to the effective margins.ESC F moved cursor to wrong position (
TerminalEmulator.java). It moved to the top row but not the bottom-left corner of the screen. Now moves to(mBottomMargin - 1, ...)with origin-mode column handling.ArgumentTokenizercrash on trailing backslash (ArgumentTokenizer.java). A trailing\threwStringIndexOutOfBoundsException; it is now kept as a literal.Shebang interpreter arguments dropped (
TermuxShellUtils.java).setupShellCommandArguments()now preserves#!/bin/bash -e(keeps-e) and#!/usr/bin/env bash(passesbashas the executable) so the interpreter is executed correctly.All modules compile successfully:
Unit tests for
terminal-emulatorandapppass: