Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meaning of level when reading #125

Closed
reynir opened this issue Apr 20, 2023 · 2 comments
Closed

Meaning of level when reading #125

reynir opened this issue Apr 20, 2023 · 2 comments

Comments

@reynir
Copy link
Member

reynir commented Apr 20, 2023

To me the meaning of the compatibility level argument when reading is unclear. It seems to only affect how the link indicator is deserialized:

ocaml-tar/lib/tar.ml

Lines 280 to 293 in fa05f16

let of_char ?level =
let level = get_level level in function
| '1' -> Hard
| '2' -> Symbolic
| 'g' -> GlobalExtendedHeader
| 'x' -> PerFileExtendedHeader
| 'L' -> LongLink
(* All other types returned as Normal in V7 for compatibility with older versions of ocaml-tar *)
| _ when level = V7 -> Normal (* if value is malformed, treat as a normal file *)
| '3' -> Character
| '4' -> Block
| '5' -> Directory
| '6' -> FIFO
| _ -> Normal (* if value is malformed, treat as a normal file *)

A few lines above that function a comment says V7 strictly speaking only supports Normal and Hard only.

ocaml-tar/lib/tar.ml

Lines 266 to 267 in fa05f16

(* Strictly speaking, v7 supports Normal (as \0) and Hard only *)
let to_char ?level =

To me, it seems that at least V7 and Ustar should not support GlobalExtendedHeader or PerFileExtendedHeader as they require Posix.

Since the reader is not very good at enforcing the compatibility level when reading perhaps this option should just be removed?

@reynir
Copy link
Member Author

reynir commented Apr 27, 2023

I discovered it is also used when deciding how to deal with link indicator types K and L (LongName and LongLink).

@reynir reynir mentioned this issue May 17, 2023
3 tasks
@hannesm
Copy link
Member

hannesm commented Jan 10, 2024

This has been removed in #127

@hannesm hannesm closed this as completed Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants