Skip to content

logfmt: legacy values containing literal escape sequences (\\n, \\t, \\\\) re-decode on read — pick an explicit policy #14

Closed

Description

@abogartz

Problem

#9 (logfmt escaping) documents a one-time data-fidelity edge: pre-#9 files stored backslashes unescaped inside quoted values, and unquote now decodes known escape sequences on read. Old values that contain a literal two-character sequence \n, \t, \r, or \\ in prose are silently transformed:

  • content="copy the UNC path \\nas\share" → the \\ collapses to \ (value shifts one character).
  • old text mentioning a literal "\n" (e.g. documenting escape behavior) → reads back as a real newline.

Not a security hole (values stay within their own record), but it corrupts data on read, and the corruption is invisible: the file on disk still shows the old form until some write path rewrites that row.

Options

  1. Accept + note in CHANGELOG/README upgrade section (lowest effort; the PR already flags it).
  2. One-time migration: scan memory/evidence files, re-escape legacy values, snapshot-first via the existing snapshotFiles machinery, and only touch rows that actually contain \\, \n, \t, \r sequences.
  3. A format=2 marker field written on new lines so the reader knows which decode rules apply.

Decide and implement one; today it is option 1-by-silence, which is the worst of the three.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. abogartz-opencode-self-improvement commented on Oct 21, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.3.5 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions