Skip to content

Paths: RelativeFilePath applies Windows-only character and length rules on POSIX #330

Description

@matt-edmondson

Problem

ktsu.Semantics.Paths validates paths against Windows rules regardless of the host OS. On Linux and macOS, RelativeFilePath.TryCreate:

  • rejects <, > and |, which are the only characters in ASCII 1–127 it refuses, and all three are legal in POSIX file names;
  • rejects any path of 257 or more characters (256: True, 257: False), although Linux PATH_MAX is 4096.

A consumer that wraps paths reported by the file system or by git therefore cannot represent real files. Git reports x|y.txt or a deep path on Linux, and the semantic type refuses it.

Ask

Apply the Windows reserved-character and MAX_PATH rules only when running on Windows. On POSIX, reject only what the platform rejects (NUL, and / inside a single segment).

Downstream

Once this ships, GitIntegration will add tests that send x|y.txt, a<b>.txt and a path over 260 characters through Status(), Diff() and Patch().

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions