softprops / serverless-rust

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

File permissions in local build (macOS) #110

Closed StefanNienhuis closed 2 years ago

StefanNienhuis commented 2 years ago

🐛 Bug description

PR #103 changed the file permissions for the ZIP in local builds from 755 to 0x755 << 16, in response to issue #102. Not sure what's going on here, but having 0x755 << 16 actually breaks the permissions (--------- permissions) on my machine (M1 Pro, macOS 12.0.1). Whereas the original, 755, does work. I'm extracting it with the native macOS Archive Utility and I've also tried the Node.js library jszip.

🤔 Expected Behavior

I expected the file permissions to be correct (755) on extraction of the zip file.

👟 Steps to reproduce

  1. Build a Rust function using serverless package
  2. Unzip the resulting package zip file

🌍 Your environment

macOS 12.0.1 M1 Pro (ARM)

serverless version: 2.71.0

rust-plugin version: master branch

StefanNienhuis commented 2 years ago

Actually, using 755 doesn't work, it just resets the permissions to default. Looking at adm-zip issues, it seems to be a mess and their versioning is not using semver properly. I propose replacing adm-zip with another zip library. I'll make a PR soon.

StefanNienhuis commented 2 years ago

Apparently there are no proper synchronous zip libraries, so I started looking into fixing adm-zip. It turns out that the attribute parameter should be an octal number 0o755 instead of hex 0x755. Using octal numbers results in the correct number. I'll create a PR now.