From nobody@FreeBSD.org  Thu Sep 23 08:28:27 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11F2E106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Sep 2010 08:28:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 023A88FC1F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Sep 2010 08:28:27 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o8N8SQLO038228
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Sep 2010 08:28:26 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o8N8SQFX038227;
	Thu, 23 Sep 2010 08:28:26 GMT
	(envelope-from nobody)
Message-Id: <201009230828.o8N8SQFX038227@www.freebsd.org>
Date: Thu, 23 Sep 2010 08:28:26 GMT
From: Joshua Isom <jrisom@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: newsyslog and zfs with compression on
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         150877
>Category:       docs
>Synopsis:       ambiguity in newsyslog(8) man page about zfs with compression on
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bdrewery
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 23 08:30:01 UTC 2010
>Closed-Date:    Sun Feb 02 08:11:47 CST 2014
>Last-Modified:  Sun Feb  2 14:20:00 UTC 2014
>Originator:     Joshua Isom
>Release:        8.1-STABLE
>Organization:
>Environment:
FreeBSD jri.homeunix.com 8.1-STABLE FreeBSD 8.1-STABLE #1: Mon Aug 16 13:02:46 CDT 2010     root@jri.homeunix.com:/usr/obj/usr/src/sys/CUSTOM  amd64
>Description:
The man page for newsyslog only states that it checks file size and not
disk usage for whether or not to move a log file.  When newsyslog runs
it looks at the number of blocks used and not the file size.  Given that
the intent could be different for different sysadmins, I am not sure if
it would be a software bug or a documentation error.
>How-To-Repeat:
Use zfs for /var/log with compression enabled, run ls -lh and see file
sizes larger than configured in /etc/newsyslog.conf.
>Fix:
It's either a coding error and documentation ambiguity.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-doc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Sep 26 21:11:18 UTC 2010 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150877 
Responsible-Changed-From-To: freebsd-doc->bdrewery 
Responsible-Changed-By: bdrewery 
Responsible-Changed-When: Fri Jan 31 20:21:19 CST 2014 
Responsible-Changed-Why:  
I am working on actually fixing the code. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150877 
State-Changed-From-To: open->closed 
State-Changed-By: bdrewery 
State-Changed-When: Sun Feb 2 08:11:47 CST 2014 
State-Changed-Why:  
Fix committed to head 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150877 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/150877: commit references a PR
Date: Sun,  2 Feb 2014 14:11:42 +0000 (UTC)

 Author: bdrewery
 Date: Sun Feb  2 14:11:34 2014
 New Revision: 261401
 URL: http://svnweb.freebsd.org/changeset/base/261401
 
 Log:
   Fix newsyslog(8) to use the size of the file instead of the blocks it
   takes on disk, as advertised in newsyslog.conf(5).
   
   This fixes newsyslog(8) on ZFS with compression enabled to not have
   large files compared to the expected rotation size.
   
     # grep remotes/messages /etc/newsyslog.conf
     /var/log/remote/messages       root:info       640  5     500  *     JC
     # ls -alh /var/log/remote/messages
     -rw-r-----  1 root  info    3.2M Jan 31 20:02 /var/log/remote/messages
     # newsyslog -vN|grep remote/messages
     /var/log/remote/messages <5J>: size (Kb): 464 [500] --> skipping
     # stat -f "st_size: %z st_blocks: %b" /var/log/remote/messages
     st_size: 3372627 st_blocks: 928
     # zfs get -H compressratio zroot/syslogs
     zroot/syslogs    compressratio   3.77x   -
   
   With fix:
   
     # newsyslog -v | grep remote/messages
     /var/log/remote/messages <5J>: size (Kb): 3338 [500] --> trimming log....
   
   Approved by:	bapt (mentor)
   PR:		docs/150877
   Reported by:	Joshua Isom <jrisom@gmail.com>
   MFC after:	2 weeks
 
 Modified:
   head/usr.sbin/newsyslog/newsyslog.c
 
 Modified: head/usr.sbin/newsyslog/newsyslog.c
 ==============================================================================
 --- head/usr.sbin/newsyslog/newsyslog.c	Sun Feb  2 07:28:04 2014	(r261400)
 +++ head/usr.sbin/newsyslog/newsyslog.c	Sun Feb  2 14:11:34 2014	(r261401)
 @@ -2284,7 +2284,7 @@ sizefile(const char *file)
  
  	if (stat(file, &sb) < 0)
  		return (-1);
 -	return (kbytes(dbtob(sb.st_blocks)));
 +	return (kbytes(sb.st_size));
  }
  
  /*
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
