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

Uncompressing 7z archives with more than one file fails #53

Closed
muttleyxd opened this issue Mar 7, 2021 · 1 comment
Closed

Uncompressing 7z archives with more than one file fails #53

muttleyxd opened this issue Mar 7, 2021 · 1 comment

Comments

@muttleyxd
Copy link

Looks similar to #46 - this code will fail with 7z archive that contains two or more files

use compress_tools::*;
use std::fs::File;
use std::path::Path;

fn main() -> Result<()> {
    let args: Vec<String> = std::env::args().collect();
    if args.len() != 2 {
        panic!("Usage: {} <7z archive>", args[0]);
    }

    let mut source = File::open(&args[1])?;
    let dest = Path::new("/tmp/dest");
    uncompress_archive(&mut source, &dest, Ownership::Ignore)?;

    Ok(())
}

I prepared a repository which allows to easily reproduce the issue
https://github.com/muttleyxd/compress-tools-rs-7z-unpack-failure

This happens on Arch Linux, 7z version 17.03, libarchive version 3.5.1-1.

./create-7z-with-two-files.sh
+ rm two_files.7z 1 2
+ touch 1 2
+ 7z a two_files.7z 1 2

7-Zip [64] 17.03 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.03 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,32 CPUs x64)

Scanning the drive:
2 files, 0 bytes

Creating archive: two_files.7z

Items to compress: 2

    
Files read from disk: 0
Archive size: 118 bytes (1 KiB)
Everything is Ok
+ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
+ cargo run -- ./two_files.7z
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/rust_7z_unpack_investigation ./two_files.7z`
Error: Extraction("Current client reader does not support seeking a device")
otavio added a commit that referenced this issue Mar 8, 2021
The rework the code from `run_with_archive` to use a seekable read and
fix the 7zip uncompression with `uncompress_archive` method.

Fixes: #53.
Signed-off-by: Otavio Salvador <[email protected]>
otavio added a commit that referenced this issue Mar 8, 2021
The rework the code from `run_with_archive` to use a seekable read and
fix the 7zip uncompression with `uncompress_archive` method.

Fixes: #53.
Signed-off-by: Otavio Salvador <[email protected]>
@otavio otavio closed this as completed in 2eadebd Mar 8, 2021
@muttleyxd
Copy link
Author

Now it works fine, thank you for very quick fix 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant