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

Fix: Correctly use test conditions in .docker/setup-mta.sh #2286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

moschlar
Copy link

@moschlar moschlar commented Aug 26, 2024

What

Added dollar signs to have the tests actually look at variable values and not
for the plain strings which leads to them being always true!

Why

shellcheck setup-mta.sh:


In setup-mta.sh line 4:
if [ -n MTA_HOST ]; then
        ^------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 8:
    [ -n MTA_PORT ] && echo "port $MTA_PORT" >> $CONFIG
         ^------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 9:
    [ -n MTA_TLS ] && echo "tls $MTA_TLS" >> $CONFIG
         ^-----^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 10:
    [ -n MTA_STARTTLS ] && echo "tls_starttls $MTA_STARTTLS" >> $CONFIG
         ^----------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 11:
    [ -n MTA_TLS_CERTCHECK ] && echo "tls_certcheck $MTA_TLS_CERTCHECK" >> $CONFIG
         ^---------------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 12:
    [ -n MTA_AUTH ] && echo "auth $MTA_AUTH" >> $CONFIG
         ^------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 13:
    [ -n MTA_USER ] && echo "user $MTA_USER" >> $CONFIG
         ^------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 14:
    [ -n MTA_FROM ] && echo "from $MTA_FROM" >> $CONFIG
         ^------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 15:
    [ -n MTA_PASSWORD ] && echo "password $MTA_PASSWORD" >> $CONFIG
         ^----------^ SC2157 (error): Argument to -n is always true due to literal strings.


In setup-mta.sh line 16:
    [ -n MTA_LOGFILE ] && echo "logfile $MTA_LOGFILE" >> $CONFIG
         ^---------^ SC2157 (error): Argument to -n is always true due to literal strings.

For more information:
  https://www.shellcheck.net/wiki/SC2157 -- Argument to -n is always true due...

@moschlar moschlar requested review from a team as code owners August 26, 2024 13:54
Copy link

github-actions bot commented Aug 26, 2024

Conventional Commits Report

Type Number
Bug Fixes 1

🚀 Conventional commits found.

Added dollar signs to have the tests actually look at variable values and not
for the plain strings which leads to them being always true!
@moschlar moschlar changed the title Update setup-mta.sh Fix: Correctly use test conditions in .docker/setup-mta.sh Aug 26, 2024
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