fsspec / fsspec/filesystem_spec

TarFileSystem cannot open files with .zstd extension

Open
#1,589 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

I have a script called fsspec:

#!/usr/bin/env python3
import sys
if '-f' in sys.argv:
    del sys.argv[sys.argv.index("-f")]
from fsspec.implementations.tar import TarFileSystem as tafs
fs = tafs(sys.argv[1])
print(f"Mount {sys.argv[1]} at {sys.argv[2]}")
import fsspec.fuse
fsspec.fuse.run(fs, "./", sys.argv[2])

I'm using it with: ./fsspec foo.tar.zstd mounted and I'm getting tarfile.ReadError: truncated header.

However, when I rename the file to end with .zst and mount it with: ./fsspec foo.tar.zst mounted, then it works fine.

I think, in general, a file detection based on the file header / magic bytes would be advisable.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at fsspec.implementations.tar.TarFileSystem and reproduce the failure with foo.tar.zstd, then compare it with the working .tar.zst case. Trace how the archive compression is detected; done means TarFileSystem can open the .zstd archive without the truncated-header error, with the existing script serving as the verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.