Skip to content

Commit 5e42853

Browse files
authored
Set entry type when adding to the tar file (#2859)
We need to explicitly set this because the header initializes with all null bytes. When this is not set, the python `tarfile` module can fail to process the file properly due to treating an entry of type `AREGTYPE` that also ends in a trailing slash as a directory instead of a regular file under some very specific circumstances. See python/cpython#141707 for more details Fixes #2855
1 parent a2d38e1 commit 5e42853

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/module_writer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ impl ModuleWriter for SDistWriter {
388388
}
389389

390390
let mut header = tar::Header::new_gnu();
391+
header.set_entry_type(tar::EntryType::Regular);
391392
header.set_size(bytes.len() as u64);
392393
header.set_mode(permissions);
393394
header.set_mtime(self.mtime);

0 commit comments

Comments
 (0)