Skip to content

Spike: the newest vendor Linux build's gedit clipboard_write fails every sample at 10.2 s (defect or harness?) #268

Closed

Description

@SSFSKIM

Problem & intent

The newest vendor Linux build (88ce5e0a…2991) fails gedit clipboard_write in every sample: 99 of 99 across the M3 gate runs, and again in m3-gate-musl. Each fails at the 10.2 s mark, like the pinned build's failed paste. cua's series passes as a declared operation. Nobody has checked whether this is the newest build's defect or another harness condition. The pinned build's "Copy nearly always fails" turned out to be the harness's emptied buffer.

Intent: know before M4's gates lean on that series whether its vendor bar is real.

Seams: the M3 harness's gedit clipboard_write case, and the newest vendor lane.

Constraints

Success criteria

  • A findings comment: what the newest build sent, what gedit and the clipboard did, and whether the scene's state (buffer, selection, ownership) explains it. If it is the harness, a fix and the series rerun.

Decision log

Sources

Activity

  1. added
    status:ready-for-implementer
    priority:P3
    spike
    on Nov 2, 2026
  2. added 5 commits that reference this issue on Nov 2, 2026
  3. SSFSKIM commented on Nov 2, 2026

    @SSFSKIM
    OwnerAuthor

    Findings (M4 T2)

    This is the vendor builds' own route, not a harness condition. Both vendor builds (pinned 7ac3c2ae… and newest 88ce5e0a…) take CLIPBOARD themselves and then call AT-SPI EditableText.PasteText on gedit's text view. In GTK 3, that method passes a pointer to a variable on its own stack to an asynchronous clipboard request. When another process owns CLIPBOARD, the request completes after PasteText has returned, and the callback reads freed stack. The vendor builds always make their own process the owner first, so this happens every time. GTK's type checks then reject the stale buffer pointer and nothing is inserted (on arm64 the same read crashed gedit). The build polls CharacterCount until its 10 s deadline and answers editable Paste did not insert text, about 10.2 s after the request.

    Mechanism (GTK 3.24.41; unchanged on the gtk-3-24 head)

    gtk/a11y/gtktextviewaccessible.c:1796–1820:

    PasteData paste;                 /* on the stack */
    ...
    gtk_clipboard_request_text (clipboard, paste_received, &paste);
    • When the callback runs. gtk_selection_convert answers synchronously only when this process owns the selection (gtk/gtkselection.c:1157–1187). With any other owner, paste_received (:1780–1794) runs from the main loop after paste_text has returned. It calls gtk_text_buffer_get_iter_at_offset, gtk_text_buffer_insert and g_object_unref on the stale paste->buffer, and each fails its type check. Those are gedit's three criticals.
    • The sibling widgets are not affected. GTK 3's entry accessible was fixed to use the heap (gtkentryaccessible.c:1365, g_new0 (PasteData, 1)), and so is GTK 4's (gtkatspieditabletext.c:165, :328). Only GTK 3's text view still has the bug.

    What the records show

    Gate records. Every newest-build gedit clipboard_write sample with a valid handle failed with this error, at 10,202–10,205 ms. That covers m2/diff and m3's diff, gate, gate-final, gate-verdict, gate-t25 and gate-musl (40 of 40 in gate-musl). In gate-musl, each failing sample also had:

    • a clean preparation: a valid handle from the build's own Copy, and 0 text restores in its lane;
    • a clean witness and audit;
    • exactly one PasteText in the bus pass;
    • the snapshot cua171 left on CLIPBOARD afterwards.

    Since task 24 repaired the buffer, the pinned build fails identically (40 of 40). cua pastes with the family's chord, 40 of 40, median 179 ms.

    M0's traces of the same builds on this VM (newest-trace-clipboard):

    • The vendor build takes CLIPBOARD and calls PasteText(54), which returns true.
    • gedit asks the vendor build's owner for text/plain;charset=utf-8, and the owner serves it in full.
    • gedit logs the three criticals 2 ms after PasteText.

    The pinned build's clipboard_write and type_text traces show the same sequence.

    The probe

    On harness gedit windows opened the way the gate opens them, each one's stderr kept. Evidence: m4/clipboard-write-268/.

    case answer text gedit's stderr
    newest build's clipboard_write, prepared as the gate prepares it (3 samples) editable Paste did not insert text, 10,203–10,204 ms unchanged the three criticals, 302 / 316 / 458 ms into each request
    control A: gedit's own CopyText(0,6) (gedit owns CLIPBOARD), then a direct PasteText true cua171 inserted nothing
    control B: the same, but a separate process owns CLIPBOARD true unchanged the three criticals, 8 ms after PasteText

    The outcome follows which process owns CLIPBOARD. A vendor clipboard_write always makes it a process other than gedit, so no harness preparation can change the result.

    What changes

    • No harness fix. Neither vendor build reaches 20 usable samples, so the series has no vendor bar, and cua's series passes as a declared deviation.
    • The deviation's reason now states the mechanism (scripts/linux-engine-diff/deviations.mjs, 7fc17bd).
    • The harness keeps every scene application's stderr, under <out>/apps/<label>.stderr (c474844). Toolkit criticals are now evidence in every run.

    cua cannot reach this bug

    The engine's only EditableText call is CopyText, for clipboard_read's Copy (native/linux-engine/src/copy.rs:242–248). CopyText copies synchronously, with heap-owned data, in every toolkit checked:

    • GTK 3 text view: gtktextviewaccessible.c:1695–1717, through gtk_clipboard_set_text, which keeps its own g_strndup (gtkclipboard.c:850–876).
    • GTK 3 entry: gtkentryaccessible.c:1255–1276.
    • GTK 4 (4.14.5 and main): gtkatspieditabletext.c:107–118 and :258–272, through gdk_clipboard_set_text.
    • Qt 5.15.13, 6.4.2 and dev: QGuiApplication::clipboard()->setText(...) in the AT-SPI adaptor (atspiadaptor.cpp:2163, :2117, :2649).

    The engine's other text-related accessibility calls:

    • The focusing-click restore uses Text.AddSelection or Text.SetCaretOffset (field.rs:108, :110). In GTK 3 these are synchronous buffer calls.
    • Text itself always arrives as a key chord. In GTK 3 that runs the widget's own paste, which keeps its request on the heap (gtktextbuffer.c:3845).

    (GTK 3's text-view CopyText never frees its copied string. That is a small leak inside the application, logged in tech-debt-tracker.md.)

    The static guard

    native/linux-engine/tests/no_text_mutators.rs (88877e2) fails cargo test, and so the engine-linux gate, when any string literal in the engine's src/ names PasteText, CutText, InsertText, DeleteText or SetTextContents. Comments are skipped, including the ones that say these are never called. I checked it failing first: a temporary PasteText call in copy.rs failed it, and it passed once the call was removed.

    Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

  4. added
    status:in-progress
    and removed
    status:ready-for-implementer
    on Nov 2, 2026
  5. SSFSKIM commented on Nov 2, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-progress: M4 T2 took the spike (linux171).

  6. added
    status:in-review
    and removed
    status:in-progress
    on Nov 2, 2026
  7. SSFSKIM commented on Nov 2, 2026

    @SSFSKIM
    OwnerAuthor

    [board] in-review: Findings posted: #268 (comment)

  8. removed
    status:in-review
    on Nov 2, 2026
  9. SSFSKIM commented on Nov 2, 2026

    @SSFSKIM
    OwnerAuthor

    [board] done: Spike answered: the newest build's gedit clipboard_write failures come from the vendor's own route (GTK 3's PasteText stack bug when another process owns CLIPBOARD), not a harness condition. Probe 3/3 with both controls (m4/clipboard-write-268/). cua cannot reach it: its only EditableText call is CopyText, and native/linux-engine/tests/no_text_mutators.rs guards that (lands with M4).

  10. added 3 commits that reference this issue on Nov 2, 2026
  11. SSFSKIM commented on Nov 2, 2026

    @SSFSKIM
    OwnerAuthor

    Follow-up: what changed after the findings comment

    1. Control B rerun with control A's payload. The first run's control B served its own text, so the clipboard's contents changed along with its owner. In the rerun, the separate owner serves the same cua171 that gedit copied, which leaves the owning process as the only difference (21:47 PST; evidence; the first run is kept in run-1/).

    case answer text gedit's stderr
    newest build's clipboard_write ×3 editable Paste did not insert text, 10,203 / 10,204 / 10,204 ms unchanged the three criticals, 312 / 325 / 322 ms into each request
    control A: gedit owns CLIPBOARD (cua171), direct PasteText true cua171 inserted nothing
    control B: a separate process owns CLIPBOARD, serving the same cua171, direct PasteText true unchanged the three criticals, 6 ms after PasteText

    2. The guarantee is now the engine's send boundary. Bus::send (native/linux-engine/src/dbus.rs) refuses org.a11y.atspi.EditableText's PasteText, CutText, InsertText, DeleteText and SetTextContents before anything is sent, with an internal error naming the member. CopyText still goes through. call goes through send, and a calls_until batch that contains a refused call sends none of its calls. Hermetic tests over a socket pair show that nothing reaches the peer.

    Two things keep that boundary the only way out to the bus:

    • Module privacy. The marshalling (encode_call), the call's type code, and the connection's socket and output buffer are private to dbus.
    • tests/send_boundary.rs asserts what privacy cannot express:
      • Inside dbus.rs, every socket write stays in connect (authentication) or flush (what send queued), and nothing hands the socket's descriptor out.
      • No other file in src/ opens or adopts a socket or raw descriptor: std, rustix or libc sockets, descriptor adoption, raw syscalls, or x11rb adopting a stream. The two allowances, each with its stated reason, are process spawning in named files and the DISPLAY X connection.
      • Each rule has a negative control, including a public raw_send inside dbus.rs and a rustix::net::socket opened in another module.

    The literal scanner (tests/no_text_mutators.rs) only gives early warning: it catches literal spellings, and concat!, stringify! and escapes get past it. It now skips doc attributes.

    3. Commits on feat/171-m4:

    • f66725d: the send boundary and its tests, encode_call made private, the scanner's #[doc] fix
    • 67a3494: control B rerun with control A's payload
    • cf6d82f: the source assertion extended to writes inside dbus.rs and to every socket and descriptor route elsewhere

    ci-gate --gates engine-linux,test is GREEN on cf6d82f (https://github.com/SSFSKIM/cua/actions/runs/41398642642).

    Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

  12. added a commit that references this issue on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P3spike

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions