Skip to content

ZipDirectory on Linux/macOS produces zip with invalid file permissions on zip entries #3924

Open
@natemcmaster

Description

@natemcmaster

The ZipDirectory task, when run on Linux or MacOS, produces an invalid .zip which cannot be used on Linux or macOS. The Unix file permissions on the zip entries contain permissions set to "0000", which means the files cannot be read, deleted, or executed.

Steps to reproduce

Project file

<Project>
  <Target Name="Build">
    <ZipDirectory SourceDirectory="$(MSBuildThisFileDirectory)input/" DestinationFile="stuff.zip" />
  </Target>
</Project>

Directory contents:

$ ls -l input/
total 0
-rwxr-xr-x  1 namc  wheel  0 Nov 12 11:22 test.sh
-rw-r--r--  1 namc  wheel  0 Nov 12 11:22 test.txt

Command line

dotnet msbuild zip.proj
unzip stuff.zip -d extracted
ls -l extracted/

Expected behavior

<ZipDirectory> preserves Unix file permissions, or at the very least, set's a usable file permission like rw-r--r--

Actual behavior

No permissions are preserved. The default, 0000, is used instead.

$ ls -l extracted/
total 0
----------  1 namc  wheel  0 Nov 12 11:22 test.sh
----------  1 namc  wheel  0 Nov 12 11:22 test.txt

Environment data

dotnet msbuild -version output:

Microsoft (R) Build Engine version 15.9.19+g938f3292a0 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

15.9.19.36755

OS info: macOS Mojave

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: TasksIssues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll.bugtriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions