On 2025-05-24 08:39, DK via dovecot wrote:
Any clues what could be the cause of such problem?
Ok, I was wrong. In 2.4 vnd.dovecot.environment does not work at all. It looks like a bug. Could some dev look into it, please? Sieve script to reproduce problem printed below. You can reproduce it on build-in varialbes. No need to set custom config variables. So should be easy.
I loaded: environment variables vnd.dovecot.debug vnd.dovecot.environment. - environment variables vnd.dovecot.debug - works, I can access environment "version" variable, I can debug log, I can set variables. - vnd.dovecot.environment - does not work for some reason, I can not access build-in nor config variables
Sometimes on logs I see such error, but it shows up randomly: - dovecot0: lmtp(test.user@domain.com)<66724><ZAM4IH6TNWikBAEAXAnA5A>: Error: sieve: 0000.test: line X: referring to variable in unknown namespace 'vnd'
More logs and sieve trace below.
Dovecot config:
sieve_extensions = environment variables vnd.dovecot.debug vnd.dovecot.environment
Sieve script:
require "environment"; require "variables"; require "vnd.dovecot.debug"; require "vnd.dovecot.environment";
if environment :matches "version" "*" { set "environment_version" "${0}"; } if string :matches "${vnd.dovecot.username}" "*" { set "dovecot_username" "${0}"; } if string :matches "${env.vnd.dovecot.config.fs_group}" "*" { set "dovecot_config_fs_group" "${0}"; }
debug_log "environment_version= '${environment_version}'"; debug_log "dovecot_username= '${dovecot_username}'"; debug_log "dovecot_config_fs_group= '${dovecot_config_fs_group}'"; debug_log "vnd.dovecot.username= '${vnd.dovecot.username}'"; debug_log "env.vnd.dovecot.config.fs_group= '${env.vnd.dovecot.config.fs_group}'";
Logs:
2025-05-27T13:27:08.298554+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: Debug: sieve: Executing script from '/etc/dovecot/sieve/before.d/0000.test.svbin' 2025-05-27T13:27:08.298758+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: Debug: sieve: multi-script: Run script '/etc/dovecot/sieve/before.d/0000.test.svbin' 2025-05-27T13:27:08.299101+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: Debug: sieve: Started running script '/etc/dovecot/sieve/before.d/0000.test.svbin' 2025-05-27T13:27:08.299662+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: sieve: DEBUG: environment_version= '2.4.1-4' 2025-05-27T13:27:08.299893+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: sieve: DEBUG: dovecot_username= '' 2025-05-27T13:27:08.300125+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: sieve: DEBUG: dovecot_config_fs_group= '' 2025-05-27T13:27:08.300365+02:00 h04f9 dovecot0: lmtp(test.user@domain.com)<72184><ISQiCoyhNWj4GQEAXAnA5A>: sieve: DEBUG: vnd.dovecot.username= ''
Trace:
00000000: ## Started executing script '0000.test' 0000004f: 7: environment test 0000004f: 7: starting ':matches' match with 'i;ascii-casemap' comparator: 0000004f: 7: matching value '2.4.1-4' 0000004f: 7: with key '*' => 1 0000004f: 7: finishing match with result: matched 00000063: 7: jump if result is false 00000063: 7: not jumping 00000068: 7: set command 00000072: 8: assign 'environment_version' [0] = "2.4.1-4" 00000072: 8: string test 00000072: 8: starting ':matches' match with 'i;ascii-casemap' comparator: 00000072: 8: matching value '' 00000072: 8: with key '*' => 1 00000072: 8: finishing match with result: matched 0000007f: 8: jump if result is false 0000007f: 8: not jumping 00000084: 8: set command 0000008e: 9: assign 'dovecot_username' [1] = "" 0000008e: 9: string test 0000008e: 9: starting ':matches' match with 'i;ascii-casemap' comparator: 0000008e: 9: matching value '' 0000008e: 9: with key '*' => 1 0000008e: 9: finishing match with result: matched 000000b9: 9: jump if result is false 000000b9: 9: not jumping 000000be: 9: set command 000000c8: 11: assign 'dovecot_config_fs_group' [2] = "" 000000c8: 11: debug_log "environment_version= '2.4.1-4'" 000000fb: 12: debug_log "dovecot_username= ''" 0000012e: 13: debug_log "dovecot_config_fs_group= ''" 00000161: 14: debug_log "vnd.dovecot.username= ''" 00000190: 15: debug_log "env.vnd.dovecot.config.fs_group= ''" 000001df: ## Finished executing script '0000.test'
Greets. DK