Azure / Azure/azure-functions-core-tools

`publish` should preserve executable bits on files

Open
#4,753 0 comments 0 reactions 0 assignees View on GitHub
area: custom-handler area: publish enhancement Needs: Team Attention
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

### Description

Currently, `func azure functionapp publish --custom` will check the `defaultExecutablePath` in host.json and only set the executable permission on that file (if it exists). There are some issues with this:

* It's possible to override any host.json setting, including the `defaultExecutablePath` using app settings. One example is if local development and prod deployment use different binaries; one can configure host.json with the local executable path, and configure an app setting in the cloud to override that value in production. In this case, the executable permission isn't set on the production binary.
* It's possible that multiple files need executable permissions. Looks like this isn't possible today.

It would be great if the logic can be updated such that:

* On posix file systems, the zip file retains the original permissions in the files.
* On Windows file systems, enable read and execute permission on every file in the zip. There's a precendent for this in Docker, where all files copied from Windows into the image have `755` permissions by default.

Also consider printing a warning if the detected default executable is missing (although this might cause confusion where the default executable is expected to be in the PATH, such as `python` or `dotnet`).

Contributor guide

Open the contributing guide

Research direction

Start at the `func azure functionapp publish --custom` publish flow and inspect how `host.json`'s `defaultExecutablePath` currently controls permissions. Done means POSIX zip entries retain original executable bits, Windows zip files grant read and execute permissions to every file, and any missing-executable warning behavior is considered without assuming a warning is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.