mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-04-23 13:48:12 +02:00
Why: Enabling imfile coverage on ARM exposed two arm64 follow-up problems. The impstats crash in imfile-statistics was caused by a generic stringbuf off-by-one when a finalized cstr lands exactly on the allocation boundary, and the rename-while-stopped test could shut rsyslog down before startup processing had made the renamed-file backlog observable. Impact: The ARM CI change remains in place, while the newly exposed arm64 failures are addressed instead of being masked off. Before: - ARM CI enabled imfile coverage, but arm64 could crash in stats reporting when cstrFinalize() wrote the trailing NUL past the end of a just-filled buffer. - The rename-while-stopped test could rely on a timing race between imfile's startup scan and the testbench queue-empty shutdown helper. After: - rsCStrAppendStrWithLen() keeps one spare byte for cstrFinalize(), preventing the impstats JSON formatting overflow seen in imfile-statistics on arm64. - imfile-rename-while-stopped.sh waits for the expected backlog to be emitted before calling shutdown_when_empty in each phase. - The armhf/arm64 imfile coverage enablement in CI is preserved. Technical Overview: - Keep the existing ARM workflow enablement from this PR. - Fix the stringbuf append/finalize contract so appended payloads reserve space for the trailing NUL written during finalization. - Make the rename-while-stopped test wait for the expected output count before invoking the queue-empty shutdown helper, so the test checks rename/persist behavior instead of a startup/shutdown timing race. See also https://github.com/rsyslog/rsyslog/issues/6576 With the help of AI-Agents: Codex
73 lines
1.8 KiB
Bash
Executable File
73 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# This is part of the rsyslog testbench, licensed under GPLv3
|
|
export TESTMESSAGES=10000
|
|
export RETRIES=10
|
|
export TESTMESSAGESFULL=19999
|
|
echo [imfile-rename.sh]
|
|
. $srcdir/diag.sh check-inotify-only
|
|
. ${srcdir:=.}/diag.sh init
|
|
generate_conf
|
|
add_conf '
|
|
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
|
|
|
|
/* Filter out busy debug output */
|
|
global(
|
|
debug.whitelist="off"
|
|
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"]
|
|
)
|
|
|
|
module( load="../plugins/imfile/.libs/imfile"
|
|
mode="inotify"
|
|
PollingInterval="1")
|
|
|
|
input(type="imfile"
|
|
File="./'$RSYSLOG_DYNNAME'.input.*.log"
|
|
Tag="file:"
|
|
Severity="error"
|
|
Facility="local7"
|
|
addMetadata="on"
|
|
)
|
|
input(type="imfile"
|
|
File="/does/not/exist/*.log"
|
|
Tag="file:"
|
|
Severity="error"
|
|
Facility="local7"
|
|
addMetadata="on"
|
|
)
|
|
|
|
$template outfmt,"%msg:F,58:2%\n"
|
|
if $msg contains "msgnum:" then
|
|
action(
|
|
type="omfile"
|
|
file=`echo $RSYSLOG_OUT_LOG`
|
|
template="outfmt"
|
|
)
|
|
'
|
|
|
|
# generate input file first.
|
|
./inputfilegen -m $TESTMESSAGES > $RSYSLOG_DYNNAME.input.1.log
|
|
ls -li $RSYSLOG_DYNNAME.input*
|
|
|
|
startup
|
|
wait_file_lines "$RSYSLOG_OUT_LOG" "$TESTMESSAGES"
|
|
shutdown_when_empty # shut down rsyslogd when done processing messages
|
|
wait_shutdown # we need to wait until rsyslogd is finished!
|
|
|
|
# Move to another filename
|
|
mv $RSYSLOG_DYNNAME.input.1.log rsyslog.input.2.log
|
|
|
|
# generate some more input into moved file
|
|
./inputfilegen -m $TESTMESSAGES -i $TESTMESSAGES >> $RSYSLOG_DYNNAME.input.2.log
|
|
ls -li $RSYSLOG_DYNNAME.input*
|
|
echo ls ${RSYSLOG_DYNNAME}.spool:
|
|
ls -l ${RSYSLOG_DYNNAME}.spool
|
|
|
|
startup
|
|
wait_file_lines "$RSYSLOG_OUT_LOG" "$((TESTMESSAGES + TESTMESSAGES))"
|
|
shutdown_when_empty # shut down rsyslogd when done processing messages
|
|
wait_shutdown # we need to wait until rsyslogd is finished!
|
|
|
|
seq_check 0 $TESTMESSAGESFULL
|
|
wc $RSYSLOG_OUT_LOG
|
|
exit_test
|