From nobody@FreeBSD.org  Sun Jan 15 12:57:55 2012
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 CC88A106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jan 2012 12:57:55 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id BBF188FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jan 2012 12:57:55 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q0FCvtGV005189
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jan 2012 12:57:55 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q0FCvtIE005188;
	Sun, 15 Jan 2012 12:57:55 GMT
	(envelope-from nobody)
Message-Id: <201201151257.q0FCvtIE005188@red.freebsd.org>
Date: Sun, 15 Jan 2012 12:57:55 GMT
From: "Dr. Andreas Haakh" <bugReporter@ib-haakh.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: tunefs: issues inappropriate error-message
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         164137
>Category:       bin
>Synopsis:       tunefs(8): issues inappropriate error-message
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 15 13:00:23 UTC 2012
>Closed-Date:    
>Last-Modified:  Mon Dec 10 22:00:00 UTC 2012
>Originator:     Dr. Andreas Haakh
>Release:        FreeBSD 9.0-STABLE i386
>Organization:
Ingenieurbro Dr.-Ing. A. Haakh
>Environment:
FreeBSD abaton.Haakh.de 9.0-STABLE FreeBSD 9.0-STABLE #0: Fri Jan 13 17:07:42 CET 2012     toor@abaton.Haakh.de:/usr/obj/usr/src/sys/ABATON  i386
>Description:
inappropriate error-message when using tunefs
tunefs allways issues
Can't stat <devicename>: No such file or directory
but works as expected. You can display or set fs-parameters.


>How-To-Repeat:
root@abaton:~# tunefs -p ada2p1
tunefs: Can't stat ada2p1: No such file or directory
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   enabled
tunefs: MAC multilabel: (-l)                               enabled
tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       enabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 datM
root@abaton:~# 

>Fix:


>Release-Note:
>Audit-Trail:

From: Andy Kosela <akosela@andykosela.com>
To: bugReporter@ib-haakh.de, bug-followup@freebsd.org
Cc:  
Subject: Re: bin/164137: tunefs(8): issues inappropriate error-message
Date: Mon, 10 Dec 2012 15:59:23 -0600

 This is a multi-part message in MIME format.
 
 --=_50c65b3b.kudbgI0IVANaBd69u4co6wOfsqyZknQVRcRey7bXMvkWrS54
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 It seems that regression was introduced in r207421.  The following patch
 should get rid of that and also fix some extra spaces in tunefs.c.
 
 --Andy
 
 --=_50c65b3b.kudbgI0IVANaBd69u4co6wOfsqyZknQVRcRey7bXMvkWrS54
 Content-Type: text/plain;
  charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="patch.txt"
 
 Index: tunefs.c
 ===================================================================
 --- tunefs.c	(revision 244052)
 +++ tunefs.c	(working copy)
 @@ -297,9 +297,8 @@
  	if (ufs_disk_fillout(&disk, special) == -1)
  		goto err;
  	if (disk.d_name != special) {
 -		if (statfs(special, &stfs) != 0)
 -			warn("Can't stat %s", special);
 -		if (strcmp(special, stfs.f_mntonname) == 0)
 +		if (statfs(special, &stfs) == 0 &&
 +		    strcmp(special, stfs.f_mntonname) == 0)
  			active = 1;
  	}
  
 @@ -865,7 +864,7 @@
  			if (ncnt <= 0)
  				return (-1);
  			cnt += ncnt;
 -		} else 
 +		} else
  			(*resid)--;
  	}
  	if (bwrite(&disk, fsbtodb(&sblock, blk), indirbuf,
 @@ -1064,7 +1063,7 @@
  {
  	fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
  "usage: tunefs [-A] [-a enable | disable] [-e maxbpg] [-f avgfilesize]",
 -"              [-J enable | disable] [-j enable | disable]", 
 +"              [-J enable | disable] [-j enable | disable]",
  "              [-L volname] [-l enable | disable] [-m minfree]",
  "              [-N enable | disable] [-n enable | disable]",
  "              [-o space | time] [-p] [-s avgfpdir] [-t enable | disable]",
 @@ -1081,13 +1080,13 @@
  		(sblock.fs_flags & FS_NFS4ACLS)? "enabled" : "disabled");
  	warnx("MAC multilabel: (-l)                               %s",
  		(sblock.fs_flags & FS_MULTILABEL)? "enabled" : "disabled");
 -	warnx("soft updates: (-n)                                 %s", 
 +	warnx("soft updates: (-n)                                 %s",
  		(sblock.fs_flags & FS_DOSOFTDEP)? "enabled" : "disabled");
 -	warnx("soft update journaling: (-j)                       %s", 
 +	warnx("soft update journaling: (-j)                       %s",
  		(sblock.fs_flags & FS_SUJ)? "enabled" : "disabled");
  	warnx("gjournal: (-J)                                     %s",
  		(sblock.fs_flags & FS_GJOURNAL)? "enabled" : "disabled");
 -	warnx("trim: (-t)                                         %s", 
 +	warnx("trim: (-t)                                         %s",
  		(sblock.fs_flags & FS_TRIM)? "enabled" : "disabled");
  	warnx("maximum blocks per file in a cylinder group: (-e)  %d",
  	      sblock.fs_maxbpg);
 
 --=_50c65b3b.kudbgI0IVANaBd69u4co6wOfsqyZknQVRcRey7bXMvkWrS54--
>Unformatted:
