softprops / serverless-rust

⚡ 🦀 a serverless framework plugin for rustlang applications
https://www.npmjs.com/package/serverless-rust
MIT License
548 stars 82 forks source link

Fixed permissions for local build #115

Open SerheyDolgushev opened 2 years ago

SerheyDolgushev commented 2 years ago

This PR is about changing permissions for the built bootstrap file.

In the last released tag (https://github.com/softprops/serverless-rust/releases/tag/v0.3.8) integer 755 value is used https://github.com/softprops/serverless-rust/blob/c17cb6c380ee6ca5cbf441ac9df718a7325be13c/index.js#L152 Which is incorrect.

In the latest master octal 0o755 value is used: https://github.com/softprops/serverless-rust/blob/master/index.js#L172

But this also causes some issues. Ways to reproduce:

  1. Clone https://github.com/SerheyDolgushev/serverless-rust-example
  2. Run hello rust lambda function:
    npx serverless invoke local -f hello
  3. Try to unzip target/lambda/release/lambda.zip using unzip command:
    unzip target/lambda/release/lambda.zip 
    Archive:  target/lambda/release/lambda.zip
       skipping: bootstrap               volume label
  4. It is still possible to unzip target/lambda/release/lambda.zip just by double-clicking on it. But extracted bootstrap will have wrong permissions in this case (-r--r--r-- so execute permission is missing):
    ls -l target/lambda/release/bootstrap 
    -r--r--r--  1 sdolgushev  72107521  6765776 Mar 25 09:32 target/lambda/release/bootstrap

The issue is fixed with this PR.