Skip to content

v3.2.0

Choose a tag to compare

@github-actions github-actions released this 11 Oct 13:55
· 70 commits to main since this release
v3.2.0

ssh-config v3.2.0

Version 3.2.0 is a bug-fix release. It closes the paths that dropped, renamed,
or rewrote configuration without saying so, and it removes two ways a run could
stall or fail outright. Every change is a fix; the minor bump is there for one
additive Go API change, described below.

There are no schema changes, and nothing was removed or given a new meaning, so
existing code, configuration, YAML, and JSON keep working. One input is an
exception: legacy JSON whose global entries set the same keyword to conflicting
values is now refused by -to-yaml, described under Behavior changes.

Configuration is no longer lost silently

  • An empty standard input is refused instead of replacing the destination.
    Reading from a pipe treated an empty stream as an empty configuration and
    atomically replaced -dest, so a failed upstream command in a pipeline
    truncated the destination file, frequently ~/.ssh/config. ssh-config now
    reports the empty input and exits non-zero, leaving the destination alone.
  • A NUL byte no longer ends the scan. The lexer used 0 to signal end of
    input, so the first NUL byte in a source file was read as the end of the
    file and every directive after it was dropped without a diagnostic. End of
    input is now a separate sentinel that cannot collide with an input byte.
  • The implicit ~/.ssh scan reads only conventional configuration paths. With
    -legacy and no -src, the scan considers config and config.d/*. An
    unrelated file kept in ~/.ssh is no longer read in full, and its comments
    are no longer reproduced as Notes in the output. A directory named
    explicitly with -src is the caller's own choice and is still scanned in
    full, whatever its files are named.

Conversions round-trip correctly

  • -to-json keeps the group prefix. The JSON schema is a flat host list with
    no group concept, so a group prefix has to be folded into the name the way
    -to-ssh does it. Emitting the bare name silently renamed every host in a
    prefixed group.
  • The legacy YAML view no longer contradicts the configuration ssh applies.
    ssh_config(5) uses the first value obtained for each keyword, but the
    global mapping was built with last-wins, so two * entries setting the
    same keyword made -to-yaml report the value ssh would not use. Entries
    are now merged first-obtained-value, and -to-yaml refuses input whose
    globals that single mapping cannot represent at all instead of picking one
    of two conflicting values. This reaches legacy JSON input and direct Go
    callers; SSH text carrying two Host * blocks was already refused as a
    duplicate block for every output format. -to-ssh and -to-json represent
    the entries separately and keep working on the same input.
  • The schema keeps a directive's original indentation when it re-renders a
    line, instead of flattening an indented directive to the left margin.
  • QuoteArgument renders every argument so that reparsing returns it
    unchanged. An argument beginning with = is quoted, because the parser
    consumes one = directly after the keyword as a separator and would
    otherwise return the value with the = stripped. Quoting now walks bytes
    rather than runes, so an argument holding arbitrary bytes survives a
    reparse; the previous renderer decoded invalid UTF-8 as utf8.RuneError
    and wrote U+FFFD in its place, which also affected arguments containing a
    space, a quote, or a backslash.

Runs no longer stall or fail on input OpenSSH accepts

  • Legacy YAML duplicate validation no longer re-walks shared aliases. A
    document using YAML anchors re-validated the same nodes once per reference,
    so the work grew with alias depth rather than document size; a 513-byte
    document did not finish in twenty minutes. Validation results are memoized
    per node and the same document now completes in milliseconds.
  • Include skips glob matches that cannot be configuration files. A pattern
    matching a subdirectory or a dangling symbolic link failed the whole
    resolution, although OpenSSH ignores such matches. Skipped matches are
    recorded on the resolved document graph so a caller can still see them.

Command line

  • -h is an alias for -help. Only help was registered, so -h fell
    through to the flag package's built-in handling and printed a generated
    option listing on standard error, while -help printed the documented usage
    on standard output. Both spellings now print the same text on standard
    output.

Go API

  • sshconfig.SkippedInclude and DocumentGraph.Skipped are new, so a caller
    can see which glob matches the Include resolver passed over and why.
    Nothing was removed and no existing declaration changed, so code built
    against v3.1.0 compiles unchanged. This addition is the whole reason the
    version is a minor rather than a patch.

Behavior changes

These are deliberate and user-visible. Each replaces a silent wrong answer
with a correct one or with a refusal.

  • Empty standard input is an error; it previously wrote an empty destination.
  • -legacy without -src no longer reads arbitrary files in ~/.ssh. Pass
    the directory explicitly with -src ~/.ssh to keep the previous scan.
  • -to-yaml fails on legacy JSON input whose global entries set one keyword
    to conflicting values; it previously emitted one of them. -to-ssh and
    -to-json are unaffected.
  • -h writes the documented usage to standard output rather than a generated
    listing to standard error.

Verification

The release candidate must pass unit tests, the race detector, vet,
govulncheck, OpenSSH integration tests, a GoReleaser snapshot, and container
smoke checks before the final tag is created. The tagged Go module consumer
test is not part of that gate: it runs afterwards, in the publishing workflow,
because it installs the module at a tag that does not exist until the candidate
has passed. See the release process for the order in
which the candidate gate and the tag are created.

This document is also used as the curated GitHub Release body. The full commit
comparison remains available through the link appended by GoReleaser.

Full Changelog: v3.1.0...v3.2.0