-
Notifications
You must be signed in to change notification settings - Fork 176
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
pkg_zip drops execute attribute when zipping executable file #96
Comments
Signed-off-by: Elliot Murphy <statik@users.noreply.github.com>
Ouch, that's unfortunate. It looks like ZipInfo.external_attrs might be the ticket. See 4.4.2 and 4.4.15 of this document, maybe, for some more details. |
Ah you beat me to it :) Thanks. |
Solutions that look at the file system mode (like kindlyops@4a8c3e7) do not work in general for Bazel, especially when remote build and caching are involved. Modes we want in the .tar (or .zip, .rpm, .msi, ...) have to be specified in BUILD files in some way. |
Thanks! I will give adding a mode attribute a try. Note that pkg_tar attempts to look at the mode of the source file as well, I wonder if that is a bug? Lines 69 to 71 in b8d6ea0
|
I've redone #97 to use a mode attribute in the BUILD rule as suggested, it seems to work well. Thanks! |
Hope it's resolved (and available to use ofc) I'm facing some trouble while migrating to Bazel build. :) |
Hi @scorsi sorry you are hitting this. I don't know why #97 hasn't been merged yet. I've had to stop using rules_pkg because of this and #104. As an alternative, this genrule works for zipping up a binary to deploy to AWS lambda
|
@statik It looks like this zip rule is completely broken haha :) |
Thanks @statik, it works fine with the |
* Preserve unix attributes on zip inputs (#96) Signed-off-by: Elliot Murphy <statik@users.noreply.github.com> * Handle modes in pkg_zip similar to pkg_tar Signed-off-by: Elliot Murphy <statik@users.noreply.github.com> * Update BUILD Fix a merge Co-authored-by: aiuto <aiuto@google.com>
I think I can now address this in a reasonable way, and it will tie together with support for adding runfiles. |
- mostly fix bazelbuild#96 by finding executables and setting mode==755 on them This new feature can not detect all executables. Bazel does not have the right capability to make that easy. This seems to get most binaries, except shell. You will have to wrap those in pkg_files to set the mode bits.
* Support for setting executable bits. - mostly fix #96 by finding executables and setting mode==755 on them This new feature can not detect all executables. Bazel does not have the right capability to make that easy. This seems to get most binaries, except shell. You will have to wrap those in pkg_files to set the mode bits.
Hey, I'm currently running into this issue for go binaries that I want to deploy as AWS Lambda's. It seems like there's been some progress, is there an accepted best way to get pkg_zip to retain exectuable attribute. |
Do you have a reproduction? This says fixed from 9 moths ago? |
I am using
pkg_zip
to zip up ago_binary
generated using bazel_rules_go. The go_binary has the execute bit set, but when I unpack the contents of the generated zip file, the program does not have the execute bit set.The goal I'm trying to accomplish is to deliver an artifact that can run in AWS Lambda, and the lambda environment is expecting the execute bit to be set.
I'm happy to try and contribute a fix for this, figured opening an issue was a good first step.
The text was updated successfully, but these errors were encountered: