Skip to content

Link.of_char: treatment of unknown link indicators #138

@reynir

Description

@reynir

Since it was first introduced unknown-to-us link indicators are treated as normal files:

| _ -> Normal (* if value is malformed, treat as a normal file *)

Now this affects reading headers since #129 where we synthesize directory link indicators for "normal" files whose file name end with a slash - this should really only be done for headers using '0' or '\000' as link indicator.

The question is what should we do about unknown-to-us link indicators? Options that come to mind are:

  • Keep the status quo and pretend they are normal files (IMO undesirable),
  • Add a Unknown of char constructor. This allows users to handle link indicators that are unknown to ocaml-tar. On the other hand it is a headache for writing as the user can construct e.g. Unknown '\000' which is not actually unknown to us (legacy Normal link indicator).
  • Error out on unknown-to-us link indicators. This may mean we aren't able to read some archives (incorrectly or not). I'm not sure how widespread these archives are. I am unsure how likely it is to work to pretend an unknown link indicator is a normal file. I think I prefer this option although it is a breaking change.

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