Skip to content

fix: abort when (jaq) curl fails#3853

Merged
casperklein merged 4 commits intodocker-mailserver:masterfrom
casperklein:fix
Jan 30, 2024
Merged

fix: abort when (jaq) curl fails#3853
casperklein merged 4 commits intodocker-mailserver:masterfrom
casperklein:fix

Conversation

@casperklein
Copy link
Copy Markdown
Member

@casperklein casperklein commented Jan 29, 2024

Description

#3852 (comment)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have added information about changes made in this PR to CHANGELOG.md

@casperklein casperklein changed the title fix: err exit on curl failure fix: abort when (jaq) curl fails Jan 29, 2024
@casperklein casperklein self-assigned this Jan 29, 2024
polarathene
polarathene previously approved these changes Jan 29, 2024
if [[ ${DOVECOT_COMMUNITY_REPO} -eq 1 ]] && [[ "$(uname --machine)" == "x86_64" ]]; then
_log 'trace' 'Using Dovecot community repository'
curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import
curl -sSfL https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a pipe operator won't cause the problem, only && / ||?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

Pipes are no problem as we use set -o pipefail. This setting prevents errors in a pipeline from being masked. If any command in a pipeline fails, that return code will be used as the return code of the whole pipeline. By default, the pipeline's return code is that of the last command even if it succeeds.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: Using && the way it was used, makes no sense (no benefit) when set -e is already in place.

@polarathene polarathene added area/scripts kind/improvement Improve an existing feature, configuration file or the documentation kind/bug/fix A fix (PR) for a confirmed bug labels Jan 29, 2024
@polarathene polarathene added this to the v14.0.0 milestone Jan 29, 2024
@casperklein casperklein marked this pull request as ready for review January 29, 2024 22:44
@casperklein casperklein merged commit 23705e6 into docker-mailserver:master Jan 30, 2024
@casperklein casperklein deleted the fix branch January 30, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scripts kind/bug/fix A fix (PR) for a confirmed bug kind/improvement Improve an existing feature, configuration file or the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants