Problem with built-in path normalization
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with tar-rs/src/header.rs around the linked normalization code and the Builder::append_dir_all entry point. Determine whether the current API can preserve a root . component, then verify that the generated archive contains ./, ./manifest, and ./control in the requested structure.
Written by the indexing model from the issue text.
Description
I have a use case where I need to create a debian-like package format.
In a nutshell, I have to create a tar file with the following entries structure:
/./
- /./manifest
- /./control
where the root entry is indeed named .
Is there a way to create this (valid) tar file with tar-rs?
I tried different ways but failed.
What I expected to work was the following:
fn create_tar_gz(filepath: &Path, dir: &Path) -> io::Result<()> {
let archive = std::fs::File::create(filepath)?;
let enc = GzEncoder::new(archive, Compression::default());
let mut tar = tar::Builder::new(enc);
tar.append_dir_all("./.", dir)?;
tar.finish()?;
Ok(())
However, it creates a tar file with the following structure:
manifest
control
/./
- empty entry directory
... because the current dir component gets stripped away here:
Just changing this line to:
(Component::CurDir, false) => {},
fixes the problem.
I have the following questions:
- Is there a way to create the desired tar file with the current API provided by
tar-rs? - If no, would a contribution be accepted for making it work and if so, what would the requirements for that be/how should that look like?
Thanks!
- Dominant language
- Rust
- Stars
- 739
- Forks
- 245
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from composefs/tar-rs
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Dependency Dashboard Open
Difficulty 4/5 3-5 days Newbie friendliness 15/100
-
Road map? Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 75/100
All issues in composefs/tar-rs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100