From nobody@FreeBSD.org  Thu Sep  6 01:46:52 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id B99C037B403
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  6 Sep 2001 01:46:51 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f868kpG24722;
	Thu, 6 Sep 2001 01:46:51 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200109060846.f868kpG24722@freefall.freebsd.org>
Date: Thu, 6 Sep 2001 01:46:51 -0700 (PDT)
From: SUGIMURA Takashi <sugimura@jp.FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: logger(1) manpage has wrong with default value of -p option
X-Send-Pr-Version: www-1.0

>Number:         30374
>Category:       bin
>Synopsis:       logger(1) manpage has wrong with default value of -p option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 06 01:50:01 PDT 2001
>Closed-Date:    Thu Sep 6 05:58:38 PDT 2001
>Last-Modified:  Thu Sep  6 06:00:01 PDT 2001
>Originator:     SUGIMURA Takashi
>Release:        4.3-STABLE
>Organization:
Infoscience Corporation
>Environment:
FreeBSD kei.infoscience.co.jp 4.3-STABLE FreeBSD 4.3-STABLE #2: Thu Aug  2 13:20:12 JST 2001 root@kei.infoscience.co.jp:/usr/src/sys/compile/NLX  i386
>Description:
In manpage of logger(1),

     -p pri  Enter the message with the specified priority.  The priority may
             be specified numerically or as a ``facility.level'' pair.  For
             example, ``-p local3.info'' logs the message(s) as informational
             level in the local3 facility.  The default is ``user.notice.''

but this default value is wrong.

It seems ``kern.notice.''


>How-To-Repeat:
simply run logger such as following;

% logger hogehoge

getting syslog packet, it has "<5>hogehoge" sequence.
5 is 0x0000 plus 0x0101, so its facility is "kern"
and its priority is "notice".


>Fix:

>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: SUGIMURA Takashi <sugimura@jp.FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of -p option
Date: Thu, 6 Sep 2001 12:24:10 +0300

 On Thu, Sep 06, 2001 at 01:46:51AM -0700, SUGIMURA Takashi wrote:
 > 
 > In manpage of logger(1),
 > 
 >      -p pri  Enter the message with the specified priority.  The priority may
 >              be specified numerically or as a ``facility.level'' pair.  For
 >              example, ``-p local3.info'' logs the message(s) as informational
 >              level in the local3 facility.  The default is ``user.notice.''
 > 
 > but this default value is wrong.
 > 
 > It seems ``kern.notice.''
 > 
 > 
 > >How-To-Repeat:
 > simply run logger such as following;
 > 
 > % logger hogehoge
 > 
 > getting syslog packet, it has "<5>hogehoge" sequence.
 > 5 is 0x0000 plus 0x0101, so its facility is "kern"
 > and its priority is "notice".
 > 
 I see this: ``Sep  6 12:18:32 <1.5> perl ru: hogehoge''
 which means (1<<3) | 5 == LOG_USER | LOG_NOTICE.
 
 This is also the default facility, as per syslog(3):
 
 :  LOG_USER      Messages generated by random user processes.  This is the
 :                default facility identifier if none is specified.
 
 And the logger(1)'s code matches the default.
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

From: SUGIMURA Takashi =?iso-2022-jp?B?GyRCP3lCPBsoQiAbJEI1LjtOGyhC?= <sugimura@YasudaKei.org>
To: ru@freebsd.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of
 -p option
Date: Thu, 06 Sep 2001 20:07:50 +0900

 Hello,
 
 >> getting syslog packet, it has "<5>hogehoge" sequence.
 >> 5 is 0x0000 plus 0x0101, so its facility is "kern"
 >> and its priority is "notice".
 >> 
 >I see this: ``Sep  6 12:18:32 <1.5> perl ru: hogehoge''
 >which means (1<<3) | 5 == LOG_USER | LOG_NOTICE.
 >
 
 No, I tried many other facility and priority, then I know that
 (LOG_USER | LOG_NOTICE) is <13>.
 
 ---
 SUGIMURA Takashi <sugimura@jp.FreeBSD.org> <sugimura@YasudaKei.org>
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Thu Sep 6 05:06:32 PDT 2001 
State-Changed-Why:  
LOG_KERN cannot be generated by a user process. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30374 

From: Ruslan Ermilov <ru@freebsd.org>
To: "SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B" <sugimura@YasudaKei.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of -p option
Date: Thu, 6 Sep 2001 15:05:48 +0300

 On Thu, Sep 06, 2001 at 08:07:50PM +0900, SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B wrote:
 > Hello,
 > 
 > >> getting syslog packet, it has "<5>hogehoge" sequence.
 > >> 5 is 0x0000 plus 0x0101, so its facility is "kern"
 > >> and its priority is "notice".
 > >> 
 > >I see this: ``Sep  6 12:18:32 <1.5> perl ru: hogehoge''
 > >which means (1<<3) | 5 == LOG_USER | LOG_NOTICE.
 > >
 > 
 > No, I tried many other facility and priority, then I know that
 > (LOG_USER | LOG_NOTICE) is <13>.
 > 
 Err.  Is't impossible to generate a LOG_KERN using syslog(3).
 Only kernel can generate these.
 
 LOG_KERN | LOG_NOTICE == LOG_NOTICE, as LOG_KERN is defined as (0<<3).
 And libc/gen/syslog.c defaults facility to LOG_USER:
 
 : static int      LogFacility = LOG_USER; /* default facility code */
 [...]
 :         /* Set default facility if none specified. */
 :         if ((pri & LOG_FACMASK) == 0)
 :                 pri |= LogFacility;
 
 LOG_KERN is defined as follows:
 
 #define LOG_KERN        (0<<3)  /* kernel messages */
 #define LOG_USER        (1<<3)  /* random user-level messages */
 
 So if you call ``logger -p kern.notice'', that becomes as if it
 were ``logger -p user.notice''.  This is also documented in the
 syslog(3) manpage:
 
 : LOG_KERN      Messages generated by the kernel.  These cannot be
 :               generated by any user processes.
 [...]
 : LOG_USER      Messages generated by random user processes.  This
 :               is the default facility identifier if none is specified.
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

From: SUGIMURA Takashi =?iso-2022-jp?B?GyRCP3lCPBsoQiAbJEI1LjtOGyhC?= <sugimura@YasudaKei.org>
To: freebsd-gnats-submit@freebsd.org
Cc: ru@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of
 -p option
Date: Thu, 06 Sep 2001 21:25:45 +0900

 I am very sad you've closed the PR.
 
 >> No, I tried many other facility and priority, then I know that
 >> (LOG_USER | LOG_NOTICE) is <13>.
 >> 
 >Err.  Is't impossible to generate a LOG_KERN using syslog(3).
 >Only kernel can generate these.
 >
 
 I see, but this problem is not concern about syslog(3).
 
 
 >LOG_KERN | LOG_NOTICE == LOG_NOTICE, as LOG_KERN is defined as (0<<3).
 
 Yes, I know, of course.
 LOG_NOTICE is decoded to <5>, so LOG_KERN | LOG_NOTICE is <5>, not <13>.
 13 = (1<<3) | 5.
 
 
 >So if you call ``logger -p kern.notice'', that becomes as if it
 >were ``logger -p user.notice''.  This is also documented in the
 >syslog(3) manpage:
 >
 
 Is it right?
 
 I say that about logger(1).
 Please see main() on /usr/src/usr.bin/logger/logger.c:
 
 ----------------
 int
 main(argc, argv)
         int argc;
         char *argv[];
 {
         int ch, logflags, pri;
         char *tag, *host, buf[1024];
 
         tag = NULL;
         host = NULL;
         pri = LOG_NOTICE;
         logflags = 0;
         unsetenv("TZ");
         while ((ch = getopt(argc, argv, "46Af:h:ip:st:")) != -1)
 (snip)
 ----------------
 
 This shows the default value of variable "pri" is "LOG_NOTICE",
 it is not (LOG_USER | LOG_NOTICE) as you said.
 
 And, logger(1) don't use syslog(3) functions, simply send a UDP packet
 to the port 514.
 
 ---
 SUGIMURA Takashi <sugimura@jp.FreeBSD.org> <sugimura@YasudaKei.org>
 
 

From: Ruslan Ermilov <ru@freebsd.org>
To: "SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B" <sugimura@YasudaKei.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of -p option
Date: Thu, 6 Sep 2001 15:28:39 +0300

 On Thu, Sep 06, 2001 at 09:25:45PM +0900, SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B wrote:
 > I am very sad you've closed the PR.
 > 
 > >> No, I tried many other facility and priority, then I know that
 > >> (LOG_USER | LOG_NOTICE) is <13>.
 > >> 
 > >Err.  Is't impossible to generate a LOG_KERN using syslog(3).
 > >Only kernel can generate these.
 > >
 > 
 > I see, but this problem is not concern about syslog(3).
 > 
 > 
 > >LOG_KERN | LOG_NOTICE == LOG_NOTICE, as LOG_KERN is defined as (0<<3).
 > 
 > Yes, I know, of course.
 > LOG_NOTICE is decoded to <5>, so LOG_KERN | LOG_NOTICE is <5>, not <13>.
 > 13 = (1<<3) | 5.
 > 
 > 
 > >So if you call ``logger -p kern.notice'', that becomes as if it
 > >were ``logger -p user.notice''.  This is also documented in the
 > >syslog(3) manpage:
 > >
 > 
 > Is it right?
 > 
 > I say that about logger(1).
 > Please see main() on /usr/src/usr.bin/logger/logger.c:
 > 
 > ----------------
 > int
 > main(argc, argv)
 >         int argc;
 >         char *argv[];
 > {
 >         int ch, logflags, pri;
 >         char *tag, *host, buf[1024];
 > 
 >         tag = NULL;
 >         host = NULL;
 >         pri = LOG_NOTICE;
 >         logflags = 0;
 >         unsetenv("TZ");
 >         while ((ch = getopt(argc, argv, "46Af:h:ip:st:")) != -1)
 > (snip)
 > ----------------
 > 
 > This shows the default value of variable "pri" is "LOG_NOTICE",
 > it is not (LOG_USER | LOG_NOTICE) as you said.
 > 
 > And, logger(1) don't use syslog(3) functions, simply send a UDP packet
 > to the port 514.
 > 
 Are you sure?
 
 :         if (host == NULL) {
 :                 syslog(pri, "%s", buf);
 :                 return;
 :         }
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

From: SUGIMURA Takashi =?iso-2022-jp?B?GyRCP3lCPBsoQiAbJEI1LjtOGyhC?= <sugimura@YasudaKei.org>
To: ru@freebsd.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of
 -p option
Date: Thu, 06 Sep 2001 21:35:39 +0900

 >> And, logger(1) don't use syslog(3) functions, simply send a UDP packet
 >> to the port 514.
 >> 
 >Are you sure?
 >
 >:         if (host == NULL) {
 >:                 syslog(pri, "%s", buf);
 >:                 return;
 >:         }
 >
 
 If -h option is specified and -p is not, then?
 
 ---
 SUGIMURA Takashi <sugimura@jp.FreeBSD.org> <sugimura@YasudaKei.org>
 
 

From: Ruslan Ermilov <ru@freebsd.org>
To: "SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B" <sugimura@YasudaKei.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of -p option
Date: Thu, 6 Sep 2001 15:35:29 +0300

 On Thu, Sep 06, 2001 at 09:35:39PM +0900, SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B wrote:
 > >> And, logger(1) don't use syslog(3) functions, simply send a UDP packet
 > >> to the port 514.
 > >> 
 > >Are you sure?
 > >
 > >:         if (host == NULL) {
 > >:                 syslog(pri, "%s", buf);
 > >:                 return;
 > >:         }
 > >
 > 
 > If -h option is specified and -p is not, then?
 > 
 You didn't mention it, do you?
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

From: SUGIMURA Takashi =?iso-2022-jp?B?GyRCP3lCPBsoQiAbJEI1LjtOGyhC?= <sugimura@YasudaKei.org>
To: ru@freebsd.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of
 -p option
Date: Thu, 06 Sep 2001 21:41:00 +0900

 >> If -h option is specified and -p is not, then?
 >> 
 >You didn't mention it, do you?
 >
 
 I have been saying about -p option default value.
 
      -p pri  Enter the message with the specified priority.  The priority may
              be specified numerically or as a ``facility.level'' pair.  For
              example, ``-p local3.info'' logs the message(s) as informational
              level in the local3 facility.  The default is ``user.notice.''
 
 ---
 SUGIMURA Takashi <sugimura@jp.FreeBSD.org>

From: SUGIMURA Takashi =?iso-2022-jp?B?GyRCP3lCPBsoQiAbJEI1LjtOGyhC?= <sugimura@YasudaKei.org>
To: ru@freebsd.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of
 -p option
Date: Thu, 06 Sep 2001 21:45:14 +0900

 >> If -h option is specified and -p is not, then?
 >> 
 >You didn't mention it, do you?
 >
 
 Oh, I read my send-pr again, "How-To-Repeat" is not right.
 I am sorry..
 
 I called logger command to send syslog packet to other host,
 then I received it and decode original facility and priority.
 
 Would you check this again?
 
 ---
 SUGIMURA Takashi <sugimura@jp.FreeBSD.org>

From: Ruslan Ermilov <ru@freebsd.org>
To: "SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B" <sugimura@YasudaKei.org>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of -p option
Date: Thu, 6 Sep 2001 15:44:45 +0300

 On Thu, Sep 06, 2001 at 09:41:00PM +0900, SUGIMURA Takashi ?$B?yB<?(B ?$B5.;N?(B wrote:
 > >> If -h option is specified and -p is not, then?
 > >> 
 > >You didn't mention it, do you?
 > >
 > 
 > I have been saying about -p option default value.
 > 
 >      -p pri  Enter the message with the specified priority.  The priority may
 >              be specified numerically or as a ``facility.level'' pair.  For
 >              example, ``-p local3.info'' logs the message(s) as informational
 >              level in the local3 facility.  The default is ``user.notice.''
 > 
 The default value for -p in the local transport case was user.notice.
 The default value for -p in the network transport case was kern.notice.
 I've fixed logger.c so that in both cases it is user.notice.
 
 
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
State-Changed-From-To: closed->open 
State-Changed-By: ru 
State-Changed-When: Thu Sep 6 05:57:47 PDT 2001 
State-Changed-Why:  
Uhh, the default is really ``kern.notice'' with -h. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30374 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Thu Sep 6 05:58:38 PDT 2001 
State-Changed-Why:  
Fixed in logger.c,v 1.8. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30374 

From: SUGIMURA Takashi =?iso-2022-jp?B?GyRCP3lCPBsoQiAbJEI1LjtOGyhC?= <sugimura@YasudaKei.org>
To: ru@freebsd.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: docs/30374: logger(1) manpage has wrong with default value of
 -p option
Date: Thu, 06 Sep 2001 21:55:49 +0900

 >The default value for -p in the local transport case was user.notice.
 >The default value for -p in the network transport case was kern.notice.
 >I've fixed logger.c so that in both cases it is user.notice.
 >
 
 Sure. Thank you very much.
 
 ---
 SUGIMURA Takashi <sugimura@jp.FreeBSD.org>
>Unformatted:
