Skip to content
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

Make generated release scripts safer #5654

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

reisub
Copy link
Contributor

@reisub reisub commented Dec 1, 2023

Shell script defaults are not great.
By default a script will keep executing even if a command fails or if it tries to expand a variable which isn't set.

It's unlikely the commands generated here would fail, but people might be making changes to these scripts and expanding them later.
It's better to generate a safer starting point.

-e will make the shell exit with an error if a command fails.
-u will make the shell exit if it tries to expand an unset variable.

I also wanted to set -o pipefail which would cause a pipeline to fail if any of the commands in the pipeline fail (rather than just the last one, as is the default).
However, that option is not part of the POSIX standard so it won't be there in all shells.

See manual for more details.

I also considered changing the shell from sh to bash, but I know alpine linux doesn't ship with bash.

@Gazler Gazler merged commit a66e7c3 into phoenixframework:main Dec 6, 2023
@Gazler
Copy link
Member

Gazler commented Dec 6, 2023

Thanks <3

@reisub reisub deleted the safer-scripts branch December 6, 2023 22:11
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

Successfully merging this pull request may close these issues.

2 participants