Skip to content

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

Closed

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

Activity

  1. Its-Just-Nans commented on Aug 30, 2026

    @Its-Just-Nans
    Member

    Thanks for the issue and PR

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

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