Skip to content

setup-stack: fix error when RSPAMD_DMS_DKIM_D is not set#3827

Merged
georglauterbach merged 3 commits intodocker-mailserver:masterfrom
ap-wtioit:master-fix_setup_stack
Jan 26, 2024
Merged

setup-stack: fix error when RSPAMD_DMS_DKIM_D is not set#3827
georglauterbach merged 3 commits intodocker-mailserver:masterfrom
ap-wtioit:master-fix_setup_stack

Conversation

@ap-wtioit
Copy link
Copy Markdown
Contributor

@ap-wtioit ap-wtioit commented Jan 25, 2024

Description

In our tests i got various:

chown: cannot access '': No such file or directory

and tracked it down to this line causing those messages when RSPAMD_DMS_DKIM_D had no value

Fixes #

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

@ap-wtioit ap-wtioit force-pushed the master-fix_setup_stack branch from 439da31 to c7d79fd Compare January 25, 2024 10:10
prevent messages like this
  chown: cannot access '': No such file or directory
when RSPAMD_DMS_DKIM_D has no value
@ap-wtioit ap-wtioit force-pushed the master-fix_setup_stack branch from c7d79fd to b36842c Compare January 25, 2024 10:14
@polarathene
Copy link
Copy Markdown
Member

polarathene commented Jan 25, 2024

This would be my fault I think with #3813

I assumed that the helper was imported by this point bringing that variable into scope?

readonly RSPAMD_DMS_D='/tmp/docker-mailserver/rspamd'
readonly RSPAMD_DMS_DKIM_D="${RSPAMD_DMS_D}/dkim"

# shellcheck source=./helpers/index.sh
source /usr/local/bin/helpers/index.sh

# This file serves as a single import for all helpers
function _import_scripts() {
local PATH_TO_SCRIPTS='/usr/local/bin/helpers'

source "${PATH_TO_SCRIPTS}/rspamd.sh"

So a little curious why that is not the case 🤔


Ah, wrapped in a function that needs to be called to initialize:

# Calling this function brings common Rspamd-related environment variables
# into the current context. The environment variables are `readonly`, i.e.
# they cannot be modified. Use this function when you require common directory
# names, file names, etc.
function _rspamd_get_envs() {

@georglauterbach
Copy link
Copy Markdown
Member

I will need to look into this..

@georglauterbach
Copy link
Copy Markdown
Member

Indeed, _rspamd_get_envs seems to be required. I went over it and I thought the variables should are ins scope, but I guess scoping in Bash is all over the place. This seems to imply that the fix in v13.3.1 does not actually work?

Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

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

Comment thread target/scripts/startup/setup-stack.sh Outdated
@georglauterbach georglauterbach added the pr/waiting for other PR to get merged This PR is waiting for another / other PR(s) to get merged label Jan 26, 2024
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 pr/waiting for other PR to get merged This PR is waiting for another / other PR(s) to get merged service/security/dkim-dmarc-spf service/security/rspamd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants