Skip to content

_last_synced is updated before the clipboard/file write succeeds #25

Description

@offbyonebit

Severity: high
Type: bug
Location: clipsync/clipboard.pyClipboardSync._on_text_file_changed() (~line 1130), _on_image_file_changed() (~line 1155), _out_tick() (~line 1015)

Problem: In all three places _last_synced is set inside the lock before the actual I/O happens. If the subsequent pyperclip.copy(), xclip write, or file replace fails, the local state already records the value as synced. The next time the same remote or local value appears, it is silently ignored, so the user never receives that clipboard update.

Suggested fix: Update _last_synced only after the write succeeds, or wrap the write and state update in a try/except that reverts _last_synced to its previous value on failure.


Filed from a full-source audit of the repo (2026-07-29). Reported by the audit but not independently confirmed - verify the cited code before acting on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditFound in the 2026-07 code auditbugSomething isn't workingseverity:highWrong behaviour users will hit

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions