From nobody@FreeBSD.org  Wed Jul  1 07:09:51 2009
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 2D42C1065672
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Jul 2009 07:09:51 +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 1B6538FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Jul 2009 07:09:51 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n6179oIK082303
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 1 Jul 2009 07:09:50 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n6179oM7082280;
	Wed, 1 Jul 2009 07:09:50 GMT
	(envelope-from nobody)
Message-Id: <200907010709.n6179oM7082280@www.freebsd.org>
Date: Wed, 1 Jul 2009 07:09:50 GMT
From: Takeshi Taguchi <taguchi@iij.ad.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: fix bug: sysutils/fusefs-kmod
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: amistry@am-productions.biz

>Number:         136211
>Category:       ports
>Synopsis:       fix bug: sysutils/fusefs-kmod
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    wxs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 01 07:10:02 UTC 2009
>Closed-Date:    Mon Jul 13 13:54:28 UTC 2009
>Last-Modified:  Mon Jul 13 13:54:28 UTC 2009
>Originator:     Takeshi Taguchi
>Release:        7.2-RELEASE-p2
>Organization:
IIJ
>Environment:
FreeBSD fbsd-amd64-72 7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2 #0: Tru Jun 30 14:54:41 JST 2009    root#fbsd-amd64-72:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
fusefs-kmod has a bug.
This bug is described in:
 http://fuse4bsd.creo.hu/darcsweb/darcsweb.cgi?r=fuse4bsd;a=commit;h=20090226212158-29619-f5fbe1f545c85669c0e8e9047b76756a82960803.gz

but FreeBSD port one does not fix yet.

>How-To-Repeat:

>Fix:
would you like to check and commit this patch.

thanks.


Patch attached with submission follows:

diff -ur fusefs-kmod.orig/Makefile fusefs-kmod/Makefile
--- fusefs-kmod.orig/Makefile	2009-07-01 15:58:09.000000000 +0900
+++ fusefs-kmod/Makefile	2009-07-01 15:58:40.000000000 +0900
@@ -7,7 +7,7 @@
 
 PORTNAME=	fusefs
 DISTVERSION=	0.3.9-pre1.20080208
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	sysutils kld
 MASTER_SITES=	http://mercurial.creo.hu/repos/fuse4bsd-hg/index.cgi/archive/
 PKGNAMESUFFIX=	-kmod
diff -ur fusefs-kmod.orig/files/patch-fuse_module__fuse_io.c fusefs-kmod/files/patch-fuse_module__fuse_io.c
--- fusefs-kmod.orig/files/patch-fuse_module__fuse_io.c	2009-07-01 15:58:09.000000000 +0900
+++ fusefs-kmod/files/patch-fuse_module__fuse_io.c	2009-07-01 15:58:25.000000000 +0900
@@ -1,5 +1,5 @@
---- fuse_module/fuse_io.c.orig	2008-02-05 00:25:57.000000000 -0500
-+++ fuse_module/fuse_io.c	2008-09-26 13:15:56.000000000 -0400
+--- fuse_module/fuse_io.c.orig	2008-02-05 14:25:57.000000000 +0900
++++ fuse_module/fuse_io.c	2009-07-01 15:45:23.000000000 +0900
 @@ -157,7 +157,11 @@
  		goto out;
  
@@ -13,6 +13,71 @@
  			goto out;
  		uio->uio_offset = va.va_size;
  	} else if ((flags & FOF_OFFSET) == 0)
+@@ -227,7 +231,7 @@
+ 		return (0);
+ 
+ 	biosize = vp->v_mount->mnt_stat.f_iosize;
+-	bcount = min(MAXBSIZE, biosize);
++	bcount = MIN(MAXBSIZE, biosize);
+ 
+ 	DEBUG2G("entering loop\n");
+ 	do {
+@@ -352,7 +356,7 @@
+ 		fri = fdi.indata;
+ 		fri->fh = fufh->fh_id;
+ 		fri->offset = uio->uio_offset;
+-		fri->size = min(uio->uio_resid,
++		fri->size = MIN(uio->uio_resid,
+ 		                fusefs_get_data(vp->v_mount)->max_read);
+ 	
+ 		DEBUG2G("fri->fh %llu, fri->offset %d, fri->size %d\n",
+@@ -399,7 +403,7 @@
+ 	while (uio->uio_resid > 0) {
+ 		int transfersize;
+ 
+-		chunksize = min(iov->iov_len, nmax);
++		chunksize = MIN(iov->iov_len, nmax);
+ 
+ 		if (uio->uio_rw == UIO_READ) {
+ 			struct fuse_read_in *fri;
+@@ -464,7 +468,7 @@
+ {
+ 		int err;
+ 
+-		if ((err = uiomove(buf, min(reqsize, bufsize), uio)))
++		if ((err = uiomove(buf, MIN(reqsize, bufsize), uio)))
+ 			return (err);
+ 
+ 		if (bufsize < reqsize)
+@@ -502,7 +506,7 @@
+ 	}
+ 
+ 	while (uio->uio_resid > 0) {
+-		chunksize = min(uio->uio_resid,
++		chunksize = MIN(uio->uio_resid,
+ 		                fusefs_get_data(vp->v_mount)->max_write);
+ 
+ 		fdi.iosize = sizeof(*fwi) + chunksize;
+@@ -569,7 +573,7 @@
+ 	do {
+ 		lbn = uio->uio_offset / biosize;
+ 		on = uio->uio_offset & (biosize-1);
+-		n = min((unsigned)(biosize - on), uio->uio_resid);
++		n = MIN((unsigned)(biosize - on), uio->uio_resid);
+ 		
+ 		DEBUG2G("lbn %d, on %d, n %d, uio offset %d, uio resid %d\n",
+ 		        (int)lbn, on, n, (int)uio->uio_offset, uio->uio_resid);
+@@ -739,8 +743,8 @@
+ 		 */
+ 		if (n) {
+ 			if (bp->b_dirtyend > 0) {
+-				bp->b_dirtyoff = min(on, bp->b_dirtyoff);
+-				bp->b_dirtyend = max((on + n), bp->b_dirtyend);
++				bp->b_dirtyoff = MIN(on, bp->b_dirtyoff);
++				bp->b_dirtyend = MAX((on + n), bp->b_dirtyend);
+ 			} else {
+ 				bp->b_dirtyoff = on;
+ 				bp->b_dirtyend = on + n;
 @@ -823,7 +827,11 @@
  #if FUSELIB_CONFORM_BIOREAD
  		struct vattr va;
@@ -26,3 +91,32 @@
  			goto out;
  #endif
  
+@@ -831,7 +839,7 @@
+ 		bp->b_resid = bp->b_bcount;
+ 		while (bp->b_resid > 0) {
+ 			DEBUG2G("starting bio with resid %ld\n", bp->b_resid);	
+-			chunksize = min(bp->b_resid,
++			chunksize = MIN(bp->b_resid,
+ 			                fusefs_get_data(vp->v_mount)->max_read);
+ 			fdi.iosize = sizeof(*fri);
+ 			if (! op)
+@@ -842,8 +850,8 @@
+ 			fri->fh = fufh->fh_id;
+ 			fri->offset = ((off_t)bp->b_blkno) * biosize + ioff;
+ #if FUSELIB_CONFORM_BIOREAD
+-			chunksize = min(chunksize,
+-			                min(fri->offset + bp->b_resid,
++			chunksize = MIN(chunksize,
++			                MIN(fri->offset + bp->b_resid,
+ 			                    va.va_size) - fri->offset);
+ 			if (chunksize == 0) {
+ 				respsize = -1;
+@@ -901,7 +909,7 @@
+ 
+ 		bufdat = bp->b_data + bp->b_dirtyoff;
+ 		while (bp->b_dirtyend > bp->b_dirtyoff) {
+-			chunksize = min(bp->b_dirtyend - bp->b_dirtyoff,
++			chunksize = MIN(bp->b_dirtyend - bp->b_dirtyoff,
+ 			                fusefs_get_data(vp->v_mount)->max_write);
+ 	
+ 			fdi.iosize = sizeof(*fwi);


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Wed Jul 1 07:10:12 UTC 2009 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

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

From: Edwin Groothuis <edwin@FreeBSD.org>
To: amistry@am-productions.biz
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/136211: fix bug: sysutils/fusefs-kmod
Date: Wed, 1 Jul 2009 07:10:10 UT

 Maintainer of sysutils/fusefs-kmod,
 
 Please note that PR ports/136211 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/136211
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org
Responsible-Changed-From-To: freebsd-ports-bugs->wxs 
Responsible-Changed-By: wxs 
Responsible-Changed-When: Thu Jul 2 18:42:06 UTC 2009 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=136211 
State-Changed-From-To: feedback->closed 
State-Changed-By: wxs 
State-Changed-When: Mon Jul 13 13:54:27 UTC 2009 
State-Changed-Why:  
Closed with the commit of a modified patch from ports/135285. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=136211 
>Unformatted:
