Skip to content

raw_copy_file changes external file attributes of directory to regular file #954

Description

@Forist2034

Describe the bug
Using raw_copy_file on directory or symbol link make external file attributes changed to regular file

To Reproduce

fn raw_copy_dir() {
    let mut input = {
        let mut b = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
        b.add_directory("dir", zip::write::FileOptions::DEFAULT)
            .unwrap();
        b.finish_into_readable().unwrap()
    };
    let mut copied = {
        let mut b = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
        b.raw_copy_file(input.by_index(0).unwrap()).unwrap();
        b.finish_into_readable().unwrap()
    };

    {
        let f = copied.by_index(0).unwrap();
        println!("{:o}", f.unix_mode().unwrap()); // changes to 0o100755
    }
}

Expected behavior
External file attributes should be preserved by raw_copy_file

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions