Bug 1410630

Summary: rsyslogd -N doesn't set return status to non-zero value
Product: Red Hat Enterprise Linux 7 Reporter: SHAURYA <sshaurya>
Component: rsyslogAssignee: Jiří Vymazal <jvymazal>
Status: CLOSED ERRATA QA Contact: Stefan Dordevic <sdordevi>
Severity: low Docs Contact:
Priority: medium    
Version: 7.2CC: dapospis, jvymazal, rsroka, sdordevi, sshaurya
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rsyslog-8.24.0-6.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 09:56:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1313490    
Bug Blocks:    

Description SHAURYA 2017-01-05 23:26:59 UTC
Description of problem:

I'm using the form rsyslogd -N to verify a config file.  However I see that it doesn't set the return status to some non-zero value if an error is found in said file  (to be sure, the manpage doesn't advertise such a thing anyway, so it's not a bug).  It makes taking automatic action a bit problematic.


Version-Release number of selected component (if applicable):

KEDDESADM01:/usr/local/sbin/des_checkout # rsyslogd -v
rsyslogd 7.4.7, compiled with:
     FEATURE_REGEXP:      Yes
     FEATURE_LARGEFILE:   No
     GSSAPI Kerberos 5 support:      Yes
     FEATURE_DEBUG (debug build, slow code):    No
     32bit Atomic operations supported: Yes
     64bit Atomic operations supported: Yes
     Runtime Instrumentation (slow code):   No
     uuid support:        Yes

How reproducible:

Always

Steps to Reproduce:


Starting with the out-of-the-box /etc/rsyslog.conf, I have installed a customized config. in /etc/rsyslog.d/DCS.conf:

:msg, eregex, "^(Starting|Stopping) user-[0-9]+\.slice"           stop

Clearly the designator "eregex" is erroneous and is indeed detected via -N, yet $? is not set non-zero as perhaps it should be:

KEDDESADM01:/usr/local/src/functions/utils # rsyslogd -N 1
rsyslogd: version 7.4.7, config validation run (level 1), master config /etc/rsyslog.conf
rsyslogd: error: invalid compare operation 'eregex' - ignoring selector
rsyslogd: End of config validation run. Bye.
KEDDESADM01:/usr/local/src/functions/utils # echo $?
0

Actual results:

Set as 0

Expected results:

Should be set as non-zero

Additional info:

https://github.com/rsyslog/rsyslog/issues/79

Comment 2 Radovan Sroka 2017-01-09 12:17:28 UTC
Does your config file contain such option like "$AbortOnUncleanConfig on" ?

Comment 11 errata-xmlrpc 2017-08-01 09:56:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2306