Skip to content

gix-command v0.10.1

Choose a tag to compare

@Byron Byron released this 01 Sep 03:14
· 10 commits to main since this release
888677a

Bug Fixes

  • safely split commands and ignore shebang options

    Command preparation previously rejected every first word containing an equals
    sign, so valid environment prefixes required a shell while executable names
    such as tool=name could be misinterpreted as assignment-only commands. Its UTF-8
    conversion also made the direct-versus-shell decision depend on encoding.

    Git for Windows uses only the interpreter path from a shebang. Parsing the
    suffix as shell words invented incompatible semantics and could let executable
    contents supply additional interpreter options.

    This provides two major fixes:

    • Replace shell-words with a public byte-oriented command-line parser that
      recognizes only valid leading assignment words, applies them to the child
      environment, and preserves non-UTF-8 programs, arguments, and values during safe
      direct execution.
    • Ignore all shebang options like Git for Windows, preventing executable data
      from altering the interpreter invocation.

    Reuse the parser in gix-diff and cover its full byte-input domain with focused
    unit tests and a dedicated fuzz target.

    Store the required command in Outcome::command, reserve Outcome::args for
    actual arguments, and reject command lines that produce no executable. Command
    preparation can now consume the parser result directly without another emptiness
    check or first-element extraction.

    The command-line parser is consumed primarily by process-launch code, yet it
    returned byte strings that every caller had to convert before constructing
    std::process::Command.

    Return OsString for the required command and its arguments so callers can use
    them directly while preserving arbitrary Unix bytes. Reject values that the host
    cannot represent instead of risking a conversion panic; environment assignments
    remain byte-oriented for parsing.

    Manual argument splitting moved leading assignments into the process environment
    and spawned the parsed program directly. On Windows, Rust's lookup can fall
    outside the assigned PATH and cannot launch extensionless scripts through their
    shebang.

    Keep assignment-prefixed commands on the shell path on Windows while retaining
    manual splitting for other commands and platforms.

  • invoke existing absolute paths directly

    Shell detection treated metacharacters in every command as evidence that a
    shell was needed. This caused resolved executable paths, notably Git for Windows
    programs under Program Files, to be parsed as command text and split at spaces.

    Recognize existing absolute files as already-resolved programs and bypass shell
    detection for them.

    Requiring an absolute path avoids promoting a relative path that happens to name
    a file in the repository to a program and accidentally executing it.

Commit Statistics

  • 5 commits contributed to the release over the course of 9 calendar days.
  • 10 days passed between releases.
  • 2 commits were understood as conventional.
  • 0 issues like '(#ID)' were seen in commit messages

Commit Details

view details
  • Uncategorized
    • Merge pull request #2944 from GitoxideLabs/error-conversion-review (e3a6fa1)
    • Safely split commands and ignore shebang options (460d2f1)
    • Merge pull request #2942 from GitoxideLabs/error-conversion-review (a1d5a55)
    • Invoke existing absolute paths directly (7025e80)
    • Merge pull request #2933 from GitoxideLabs/report-august (b8914ff)