Skip to content

File Permissions are not preserved #233

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

Closed
hunterclarke opened this issue Sep 7, 2018 · 5 comments
Closed

File Permissions are not preserved #233

hunterclarke opened this issue Sep 7, 2018 · 5 comments

Comments

@hunterclarke
Copy link

I'm running a python function that calls a binary that ships within an individually packaged module. However, when packaged, the file's permissions as an executable are not transferred (they are preserved without this plugin). Any ideas as to how to debug this? I'd be happy to submit a PR but I can't figure out where in the process these permissions would be getting stripped.

@bsamuel-ui
Copy link
Contributor

We ran into this before, #178 fixed #166.

@bsamuel-ui
Copy link
Contributor

In a nutshell, the permissions were getting stripped because an older zip library didn't save them, and JSZip 3.x solved the issue.

@dschep
Copy link
Contributor

dschep commented Sep 7, 2018

Could you share your package.json and serverless.yml? or at least the versions of the framework & plugin and what options you're setting for the plugin.

@hunterclarke
Copy link
Author

Here is a bit more context (sorry for the bare comment before, I didn't know if this had an easy fix):

Versions:
serverless: 1.30.3
serverless-python-requirements: 4.1.1

serverless.yml contains:

package:
  individually: true

plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
    dockerizePip: true

The function in particular has a requirements.txt file with:

requests==2.18.1
urllib3==1.22

And the function contains a directory structure:

pdf2htmlex
├-- README.md
├-- main.py
├-- preview.min.css
├-- src
  ├-- bin
    ├-- pdf2htmlEX

pdf2htmlEX is the executable.

In the project this has the permissions:

-rwxrwxrwx  1 503  20  548200 Sep  7 07:20 pdf2htmlEX

However, I noticed on running sls package and extracting the results from the zip, the file has the permissions:

-rw-rw-r--  1 503  20  548200 Dec 31  2097 pdf2htmlEX

dschep added a commit that referenced this issue Sep 8, 2018
dschep added a commit that referenced this issue Sep 8, 2018
@bspink
Copy link
Contributor

bspink commented Mar 15, 2019

I'm seeing this issue when trying to run awscli (to use the s3 sync command) inside of a lambda.

The permissions for the aws binary have the executable bit set locally after installing with pip into my virtualenv, and inside of .serverless/requirements/bin after the plugin builds them using pip, but inside of the package zip file created by serverless the executable bits have been stripped.

I tested by running ls -alh on the /var/task/bin dir inside the lambda, and the same permissions are there as well.

local permissions:

➜  ls -alh ./.serverless/requirements/bin/
total 208
drwxr-xr-x  29 bspink  staff   928B 15 Mar 11:20 .
drwxr-xr-x  31 bspink  staff   992B 15 Mar 11:20 ..
-rwxr-xr-x   1 bspink  staff   822B 15 Mar 11:20 aws
-rwxr-xr-x   1 bspink  staff   1.4K 15 Mar 11:20 aws.cmd
-rwxr-xr-x   1 bspink  staff   204B 15 Mar 11:20 aws_bash_completer
-rwxr-xr-x   1 bspink  staff   1.1K 15 Mar 11:20 aws_completer
-rwxr-xr-x   1 bspink  staff   1.8K 15 Mar 11:20 aws_zsh_completer.sh

lambda permissions:

drwxrwxr-x 3 root root 573 Mar 15 00:03 .
drwxr-xr-x 23 root root 740 Mar 15 00:04 ..
-rw-rw-r-- 1 root root 822 Jan 1 2098 aws
-rw-rw-r-- 1 root root 204 Jan 1 2098 aws_bash_completer
-rw-rw-r-- 1 root root 1.4K Jan 1 2098 aws.cmd
-rw-rw-r-- 1 root root 1.2K Jan 1 2098 aws_completer
-rw-rw-r-- 1 root root 1.8K Jan 1 2098 aws_zsh_completer.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants