-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always use .NET Zip library by setting read-write permissions for zip entries on non-windows OS #62
Conversation
Thanks for the PR. We have a rework of this code in the package-custom-runtimes. The effort in that branch was to switch to a go executable to create the zip file on Windows so we could set a custom runtime bootstrap to be executable on Linux. We hadn't found a way to do that on Windows using the .NET ZIP api because ExternalAttributes is ignored when set on Windows. Our first priority is to get this branch out which is going to cause conflicts with this merge request. |
The problem with setting the Unfortunately, Just for context, here's a working example using |
It occurred to me, you may actual care more about how I used it than seeing it in action! :) Here's the beginning of the code: https://github.com/LambdaSharp/LambdaSharpTool/blob/master/src/LambdaSharp.Tool/Cli/Build/ModelFilesPackager.cs#L145 I chose the zipping library based on the need to have executable permissions or not. Then, when zipping with Hope that helps! |
@normj So you bundled an executable, because you didn't want to set the proper flags using the native zip library? That seems just a tad overkill, no? Or am I missing something? Unless I'm confused, the following lines are literally all you were missing to make the native library work on all operating systems and not have to shell out:
|
The problem we were trying to solve was on Windows we do need to set the linux file permissions but the native zip library doesn't allow it. If you set The bundled executable is only used on Windows and currently we still rely on the |
IIRC, you don't need the executable bit for the assemblies. I'm pretty sure I ran a lambda deployment with the proposed change to confirm it worked. However, you do need the executable bit if you ship an actual executable that you want to shell out to--or if you supply a custom runtime, I assume. |
It was the recent release of custom runtime support in the tooling that prompted this change since we need to make the bootstrap executable. |
Problem:
Zip file entries created on non-Windows operating systems, must provide their permissions flags in the
ExternalAttributes
property.Description of changes:
This pull-request sets the
ExternalAttributes
property to give Read/Write permissions to the current user, and Read-only to group and world.Furthermore, the code used to shell out to the native
zip
utility has been removed as it is no longer required to create a working zip archive for AWS Lambda.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.