Skip to content

Commit 6a61661

Browse files
committed
archive: do not let on-disk mode leak to zip archives
When the "--add-file" option is used to add the contents from an untracked file to the archive, the permission mode bits for these files are sent to the archive-backend specific "write_entry()" method as-is. We normalize the mode bits for tracked files way before we pass them to the write_entry() method; we should do the same here. This is not strictly needed for "tar" archive-backend, as it has its own code to further clean them up, but "zip" archive-backend is not so well prepared. Signed-off-by: Junio C Hamano <[email protected]>
1 parent e54793a commit 6a61661

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ int write_archive_entries(struct archiver_args *args,
342342
else
343343
err = write_entry(args, &fake_oid, path_in_archive.buf,
344344
path_in_archive.len,
345-
info->stat.st_mode,
345+
canon_mode(info->stat.st_mode),
346346
content.buf, content.len);
347347
if (err)
348348
break;

0 commit comments

Comments
 (0)