Giter VIP home page Giter VIP logo

Comments (4)

RyanGreenup avatar RyanGreenup commented on June 11, 2024

These are all the functions I could find under Archive:: with the set_ prefix:

There's also a set_mode which might be the --acls

from ouch.

RyanGreenup avatar RyanGreenup commented on June 11, 2024

Tar.rs logic

It seems like the work flow of tar is:

Compress

  1. Make a
    builder
    objectwith a
    Header::newgnu(),
  2. Use builder.append to add files

Decompress

  1. Create an archive and set
  2. Unpack the archive

Examples

  1. Compressing

    For Compressing the example in the
    documentation

    is something like:

    use tar::{Builder, Header};
    
    let mut header = Header::new_gnu();
    
    let mut data: &[u8] = &[1, 2, 3, 4];
    
    let mut builder = Builder::new(Vec::new());
    builder.append(&header, data).unwrap();
    let data = builder.into_inner().unwrap();

    We just need to ensure acls are pulled in.

  2. Decompressing

    This could then be decompressed with unpack_archive like so:

    pub fn unpack_archive(reader: Box<dyn Read>, output_folder: &Path, quiet: bool) -> crate::Result<usize> {
        assert!(output_folder.read_dir().expect("dir exists").count() == 0);
        let mut archive = tar::Archive::new(reader);
    
        // --xattrs
        archive.set_unpack_xattrs(true);
        // --preserver-permissions
        archive.set_preserve_permissions();
        // --numeric-ownership
        archive.set_preserve_ownerships();
    
        // --acls
        // TODO
    
        let mut files_unpacked = 0;
        for file in archive.entries()? {
            let mut file = file?;
    
            file.unpack_in(output_folder)?;
        }
    
        Ok(files_unpacked)
    }

    Does that seem right?

from ouch.

RyanGreenup avatar RyanGreenup commented on June 11, 2024

I created an issue with tar-rs asking about acls:

Further resources:

from ouch.

marcospb19 avatar marcospb19 commented on June 11, 2024

If you could offer some guidance, I can try and put together a PR if you'd like?

Sorry for the late response. Unfortunately, I don't think I have the time to give guidance on how to approach this, but we could iterate on the solution in the PR review process.

You're right, Ouch doesn't support --xattrs atm.


I like your idea of having a -P/--preserve-all-permissions flag that covers it all.

In the --help message we also have to explain that these permissions apply for Tar but not for Zip archives 🤔, and state that CLS is not supported yet.

In conclusion, I approve this feature request and a PR (from you or someone else) would be welcomed for reviewing 👍.

from ouch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.