[Bug 202190] newsyslog include processing tries to parse directories as files

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Aug 9 01:13:26 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202190

            Bug ID: 202190
           Summary: newsyslog include processing tries to parse
                    directories as files
           Product: Base System
           Version: 10.2-STABLE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: gshapiro at FreeBSD.org

Created attachment 159681
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=159681&action=edit
newsyslog.c patch to skip directories for includes

If a directory exists under /etc/newsyslog.conf.d/ or
/usr/local/etc/newsyslog.conf.d/, newsyslog tries to parse the directory as a
file:

# grep include /etc/newsyslog.conf
# rotated, then the entry for that file should include the 'N' flag.
<include> /etc/newsyslog.conf.d/*
<include> /usr/local/etc/newsyslog.conf.d/*
# ls -al /etc/newsyslog.conf.d/
total 10
drwxr-xr-x   3 root  wheel   512 Aug  8 18:05 .
drwxr-xr-x  25 root  wheel  2560 Aug  8 10:42 ..
drwxr-xr-x   2 root  wheel   512 Aug  7 23:44 CVS
-rw-r--r--   1 root  wheel   190 Aug  7 20:01 local.conf
# /usr/sbin/newsyslog
newsyslog: malformed line (missing fields):
��

The attached patch skips directories when including files.

If for some reason, this change isn't desirable, a workaround is to change the
default /etc/newsyslog.conf to only include configuration files instead of all
files by replacing:

<include> /etc/newsyslog.conf.d/*
<include> /usr/local/etc/newsyslog.conf.d/*

with:

<include> /etc/newsyslog.conf.d/*.conf
<include> /usr/local/etc/newsyslog.conf.d/*.conf

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list