If this parameter is ommitted, rsyslog will use default,
which is /dev/log. After rsyslog stop/restart, this node gets
deleted. This breaks further syslog() calls on distros
using systemd-journald when test performs cleanup, because
rsyslog doesn't re-create /dev/log. Default distro rsyslog
config is "/run/systemd/journal/syslog", so system ends
up with missing /dev/log.

For example:
  cp -f /etc/rsyslog.conf /etc/rsyslog.conf.backup
  echo '$ModLoad imuxsock.so'  > /etc/rsyslog.conf
  echo "*.crit            /var/log/messages"  >> /etc/rsyslog.conf
  systemctl restart rsyslog
  cp /etc/rsyslog.conf.backup /etc/rsyslog.conf
  systemctl restart rsyslog # --> PROBLEM: /dev/log is now gone

This patch will include "$SystemLogSocketName" line from
rsyslog configuration to rsyslog.conf defined by syslog* tests.

Signed-off-by: Jan Stancek <[email protected]>
---
 testcases/kernel/syscalls/syslog/syslog-lib.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/syslog/syslog-lib.sh 
b/testcases/kernel/syscalls/syslog/syslog-lib.sh
index b67a8f2..ef33517 100755
--- a/testcases/kernel/syscalls/syslog/syslog-lib.sh
+++ b/testcases/kernel/syscalls/syslog/syslog-lib.sh
@@ -71,7 +71,12 @@ setup()
                CONFIG_FILE="/etc/syslog-ng/syslog-ng.conf"
        elif [ "$SYSLOG_DAEMON" = "rsyslog" ]; then
                CONFIG_FILE="/etc/rsyslog.conf"
-               RSYSLOG_CONFIG='$ModLoad imuxsock.so'
+               log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r 
/etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
+               RSYSLOG_CONFIG=$(cat <<EOF
+\$ModLoad imuxsock.so
+$log_socket
+EOF
+)
        else
                tst_resm TBROK "Couldn't find syslogd, syslog-ng or rsyslogd"
                cleanup 1
-- 
1.7.1


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to