rsyslog/tests/diskqueue-non-unique-prefix.sh
Rainer Gerhards e22fb205a3
config processing: check disk queue file is unique
If the same name is specified for multiple queues, the queue files
will become corrupted. This commit adds a check during config parsing.
If duplicate names are detected the config parser errors out and the
related object is not created.

Note: this may look to a change-of-behaviour to some users. However,
this never worked and it was pure luck that these users did not run
into big problems (e.g. DA queues were never going to disk at the
same time). So it is acceptable to error out in this hard error case.

closes https://github.com/rsyslog/rsyslog/issues/1385
2019-05-02 11:36:49 +02:00

30 lines
990 B
Bash
Executable File

#!/bin/bash
# Test for config parser to check that disk queue file names are
# unique.
# added 2019-05-02 by Rgerhards
# This file is part of the rsyslog project, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
global(workDirectory="'${RSYSLOG_DYNNAME}'.spool")
if 0 then {
action(type="omfile" file="'$RSYSLOG_DYNNAME'.notused"
queue.filename="qf1" queue.type="linkedList")
action(type="omfile" file="'$RSYSLOG_DYNNAME'.notused"
queue.filename="qf1" queue.type="linkedList")
action(type="omfile" file="'$RSYSLOG_DYNNAME'.notused"
queue.filename="qf2" queue.type="linkedList")
action(type="omfile" file="'$RSYSLOG_DYNNAME'.notused"
queue.spooldirectory="'$RSYSLOG_DYNNAME'.spool2"
queue.filename="qf2" queue.type="linkedList")
}
action(type="omfile" file="'$RSYSLOG_OUT_LOG'")
'
startup
shutdown_when_empty
wait_shutdown
content_check "and file name prefix 'qf1' already used"
check_not_present "and file name prefix 'qf2' already used"
exit_test