Repository navigation
fix: six v0.11.12 runtime issues (record, frames, XTGETTCAP, Drop) - #886
Merged
Merged
Conversation
The asciicast header filled three fields from constants or from the clock at export: env.TERM was always xterm-256color, a recording with no frame claimed 80x24, and timestamp was the export time. - env.TERM is the TERM the child was given, the value XTGETTCAP's TN already reports, so the header no longer gives a third answer. - A recording with no frame takes the terminal's size at record(). - timestamp is the second record() was called in. The asciicast v2 spec defines it as the "Unix timestamp of the beginning of the recording session"; #309 chose the export time, which is later by the recording's length, and made two exports of one recording differ (#555). The export-time test now pins the start instead, and the file-equals-string comparison is exact again. Closes #850 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
An application stalled inside a synchronized update, on a read or on a query's reply, did emit one. wait_frame's timeout said it never had, or that it had not repainted in response to the input, and pointed at wait_until; Recorder::stop said "never emitted" too. wait_idle on the same terminal named the open update, so the diagnosis depended on which wait timed out. Both now check for an open update first and say the application began one and has not ended it. "Never emitted" stays for a terminal that has seen no Begin. A timeout whose frames were rejected by the predicate says the next one is open, too. Closes #837 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
XTGETTCAP answered each key capability with its normal-mode bytes, whatever mode the application had set, so one that set DECCKM, as ncurses does through smkx for keypad(), learned \e[A for Up and then received \eOA from send. xterm answers "the string that xterm would send" by running the keysym through its own key input, which picks SS3 under DECCKM. The answers now come from Key::encode_modal with the mode as of the query. The keys were known only by their terminfo names, while Co and TN were answered by their termcap names. The termcap names Vim asks by (kb, ku, kd, kr, kl, kh, @7, kD, kP, kN) are answered now too. Closes #831 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
resize moved the frame cursor to the count of completed frames, and an update open at that moment was not counted yet. When the application ended it after the resize, its frame, drawn at the old size, was the first one wait_frame offered, so a predicate the old layout satisfied passed on it: the stale-frame trap the cursor was moved to close. An application with a spinner or a clock is often painting when the resize lands, and finishes that frame before it handles SIGWINCH. resize now notes an update open at the resize. The reader marks the frame that ends it, and wait_frame steps past that frame while no frame has been returned since the resize. The sketch's cursor + 1 would have skipped a real frame when the update never ends: a hard reset closes it without one, so the reader drops the note then and the next frame is offered. A timeout while that update is still open names it as begun before the resize, so the "since the resize" wording stays true. Closes #836 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Every recorded frame is a whole Screen, and every Screen holds an Arc of the graphics log as it stood, with each image's data. RecordingState charged a frame for its cells only, so a running recorder kept every image the application sent while the terminal kept capture_graphics of them: 400 repaints of a 1 MiB image held 400 MiB against a 4 MiB bound. The recording now counts the image data its frames hold, each payload once by the address of its shared data, and drops its oldest frames, reported in dropped(), while that passes capture_graphics, as it does for cells past record_budget. The newest frame is always kept; its images are within the bound already, since the terminal's log is. The test records twenty 1 KiB images against a 4 KiB budget rather than the issue's 200 MiB, so the test of the bound stays bounded itself. Closes #855 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Drop stopped the process group the child leads. A shell with job control, every interactive one and sh after set -m, starts each job in a process group of its own in the child's session, and the kernel's hang-up as the session leader exits reaches the foreground group only, so a job that ignored SIGHUP ran on after the drop, on a PTY nobody held. #714's group kill never reached it. On Linux the session's other groups are read from /proc/<pid>/stat before the hang-up and again before the kill, and are hung up and killed with the child's. The session's id is the child's pid, which no process can take while the child is unreaped or a member lives. A scan costs about 2 ms with 500 processes, so the second is skipped when the first found no other group. macOS would list the session through sysctl with KERN_PROC_SESSION. That is not done: it could not be run and checked here, so LIMITATIONS says that off Linux such a job outlives the drop, and the two new tests are ignored there. Closes #835 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com> # Conflicts: # CHANGELOG.md
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.
Six runtime issues from the v0.11.12 milestone, one commit each, each with tests that fail without the fix.
TERM=xterm-256color, gives an empty recording 80x24, and dates the export #850: the asciicast header takes the child'sTERM, the terminal's size andrecord()'s time from the recording. The timestamp follows the v2 spec ("beginning of the recording session") rather than The asciicast header omits timestamp and title, so a recording has no date in any player #309's export time, so two exports are now the same document. This is a Changed entry, with a migration sentence.wait_frameandRecorder::stopsay an application stalled inside a DEC 2026 update never emitted one #837: await_frametimeout andRecorder::stopname a DEC 2026 update left open ("Begin with no End"). "Never emitted" is kept for a terminal that never saw a Begin. DESIGN §2 and the SKILL error table are updated.Key::encode_modal), and the termcap nameskb ku kd kr kl kh @7 kD kP kNare answered.wait_framereturns #836:wait_frameno longer offers the frame that completes an update open at the resize. This deviates from the issue's "+1" sketch:resizerecords the open update and the reader marks the frame that closes it. That way a reset that abandons the update (RIS) does not make the next real frame skipped, and a test covers that case.Recorderkeeps every frame's images alive, socapture_graphicsno longer bounds image memory #855: a recording counts each image's data once, againstcapture_graphics, and drops its oldest frames past it (reported indropped()), as it does for cells.Dropleaves a SIGHUP-ignoring job of a job-control shell running: the job has a process group of its own #835: on Linux,Dropalso hangs up and then kills the other process groups of the child's session, read from/proc/*/stat. Those are a job-control shell's jobs; the child's pid is the session id, and it is not reused while the child is unreaped. A scan costs about 2 ms with 500 processes, and the second scan is skipped when the first found no job. macOS is not done:KERN_PROC_SESSIONcould not be verified here. LIMITATIONS says so, and the two new tests are Linux-only.Local:
cargo test --workspace --all-featurespassed 1003 tests, with 0 failed. frames.rs passed 12 runs at 1, 9 and 17 threads. Stress is dispatched on this branch, since #836 changes wait semantics.Closes #850
Closes #837
Closes #831
Closes #836
Closes #855
Closes #835