From nobody@FreeBSD.org  Wed Dec 30 03:34:04 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 7C6F0106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 Dec 2009 03:34:04 +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 6B08B8FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 Dec 2009 03:34:04 +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 nBU3Y4Do030745
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 Dec 2009 03:34:04 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id nBU3Y3Kd030744;
	Wed, 30 Dec 2009 03:34:03 GMT
	(envelope-from nobody)
Message-Id: <200912300334.nBU3Y3Kd030744@www.freebsd.org>
Date: Wed, 30 Dec 2009 03:34:03 GMT
From: Tigger <tigger@lvlworld.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dumpfs drops leading 0 (zero) from superblock id
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         142155
>Category:       bin
>Synopsis:       dumpfs(8) drops leading 0 (zero) from superblock id
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gavin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 30 03:40:01 UTC 2009
>Closed-Date:    Sun Jan 24 15:08:00 UTC 2010
>Last-Modified:  Sun Jan 24 15:08:00 UTC 2010
>Originator:     Tigger
>Release:        FreeBSD 8.0
>Organization:
n/a
>Environment:
FreeBSD eeeor.goo 8.0-RELEASE-p1 FreeBSD 8.0-RELEASE-p1 #8: Mon Dec 28 20:31:32 EST 2009     tigger@eeeor.goo:/usr/obj/usr/src/sys/EEEOR  i386
>Description:
dumpfs will drop a leading 0 (zero) from the reported id in the superblock location.

I'm using dumpfs to get the ufsid of drives (is there are better way?) in order to add the ids to /etc/fstab - to prevent drive lost when moving drives around or adding new ones, Something I've been hit with twice in the last month, once one a remote box!


>How-To-Repeat:
As you can see below, the id should be '[ 4ae2d4ec 06f7fec5 ]', not '[ 4ae2d4ec 6f7fec5 ]'

root@eeeor:/home/tigger# dumpfs / | head -18
magic   19540119 (UFS2) time    Wed Dec 30 14:16:57 2009
superblock location     65536   id      [ 4ae2d4ec 6f7fec5 ]
ncg     6       size    524288  blocks  506487
bsize   16384   shift   14      mask    0xffffc000
fsize   2048    shift   11      mask    0xfffff800
frag    8       shift   3       fsbtodb 2
minfree 8%      optim   time    symlinklen 120
maxbsize 16384  maxbpg  2048    maxcontig 8     contigsumsize 8
nbfree  41427   ndir    865     nifree  129262  nffree  17862
bpg     11761   fpg     94088   ipg     23552   unrefs  0
nindir  2048    inopb   64      maxfilesize     140806241583103
sbsize  2048    cgsize  16384   csaddr  3000    cssize  2048
sblkno  40      cblkno  48      iblkno  56      dblkno  3000
cgrotor 0       fmod    0       ronly   0       clean   0
avgfpdir 64     avgfilesize 16384
flags   none
fsmnt   /
volname         swuid   0

root@eeeor:/home/tigger# df -hc /
Filesystem                     Size    Used   Avail Capacity  Mounted on
/dev/ufsid/4ae2d4ec06f7fec5    989M    307M    603M    34%    /
total                          989M    307M    603M    34%


>Fix:
No idea, sorry.

>Release-Note:
>Audit-Trail:

From: Efstratios Karatzas <gpf.kira@gmail.com>
To: bug-followup@FreeBSD.org, tigger@lvlworld.com
Cc:  
Subject: Re: bin/142155: dumpfs(8) drops leading 0 (zero) from superblock id
Date: Mon, 4 Jan 2010 17:51:17 +0200

 --0016e6d9a0e81b15e7047c58b1cd
 Content-Type: text/plain; charset=ISO-8859-1
 
 Hi.
 
 Not sure if this qualifies as a bug, but it's certainly a little
 misleading if you want to manipulate ufsids.
 The only issue here is that ufsid is the result of concatenating two
 fs ids, in your example the hex numbers "4ae2d4ec" and "6f7fec5"
 Each id number has a max length of 8 digits so when concatenating the
 two ids to create the ufsid, a 0 is added in front of "6f7fec5" to
 maintain a length of 16 characters total and actually keep the
 original numbers in the ufsid. Two possible fixes:
 
 1) Change the way you interpret the output of dumpfs(8) in a way
 similar to the one described in the following link
 
 http://www.mail-archive.com/freebsd-stable@freebsd.org/msg106566.html
 
 Notice the "printf %0x $((0x\1 << 32 | 0x\2))/p" part, simple bitwise operations
 
 2) Apply my patch and recompile dumpfs so that if one of the ids has
 fewer than 8 digits, leading zeros are always printed. That way your
 script doesn't have to do anything "special"
 
 Elaboration:
 
 In dumpfs.c, line 153
 
 printf("superblock location\t%jd\tid\t[ %x %x ]\n",
 (intmax_t)afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]);
 
 You can see it's printing two variables in hex (%x = unsigned hex number)
 The fs_id array is of type int32_t so the maximum value has 8 digits.
 
 Hope this helps, reply if somehow you still have a problem.
 
 -- 
 
 Efstratios "GPF" Karatzas
 
 --0016e6d9a0e81b15e7047c58b1cd
 Content-Type: application/octet-stream; name="dumpfs_patch.diff"
 Content-Disposition: attachment; filename="dumpfs_patch.diff"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_g41fb7k30
 
 KioqIGR1bXBmcy5vcmlnLmMJTW9uIEphbiAgNCAxNzowNToxNCAyMDEwCi0tLSBkdW1wZnMuYwlN
 b24gSmFuICA0IDE3OjA3OjA1IDIwMTAKKioqKioqKioqKioqKioqCioqKiAxNTAsMTU2ICoqKioK
 ICAJCWZzdGltZSA9IGFmcy5mc190aW1lOwogIAkJcHJpbnRmKCJtYWdpY1x0JXggKFVGUzIpXHR0
 aW1lXHQlcyIsCiAgCQkgICAgYWZzLmZzX21hZ2ljLCBjdGltZSgmZnN0aW1lKSk7CiEgCQlwcmlu
 dGYoInN1cGVyYmxvY2sgbG9jYXRpb25cdCVqZFx0aWRcdFsgJXggJXggXVxuIiwKICAJCSAgICAo
 aW50bWF4X3QpYWZzLmZzX3NibG9ja2xvYywgYWZzLmZzX2lkWzBdLCBhZnMuZnNfaWRbMV0pOwog
 IAkJcHJpbnRmKCJuY2dcdCVkXHRzaXplXHQlamRcdGJsb2Nrc1x0JWpkXG4iLAogIAkJICAgIGFm
 cy5mc19uY2csIChpbnRtYXhfdClmc3NpemUsIChpbnRtYXhfdClhZnMuZnNfZHNpemUpOwotLS0g
 MTUwLDE1NiAtLS0tCiAgCQlmc3RpbWUgPSBhZnMuZnNfdGltZTsKICAJCXByaW50ZigibWFnaWNc
 dCV4IChVRlMyKVx0dGltZVx0JXMiLAogIAkJICAgIGFmcy5mc19tYWdpYywgY3RpbWUoJmZzdGlt
 ZSkpOwohIAkJcHJpbnRmKCJzdXBlcmJsb2NrIGxvY2F0aW9uXHQlamRcdGlkXHRbICUwOHggJTA4
 eCBdXG4iLAogIAkJICAgIChpbnRtYXhfdClhZnMuZnNfc2Jsb2NrbG9jLCBhZnMuZnNfaWRbMF0s
 IGFmcy5mc19pZFsxXSk7CiAgCQlwcmludGYoIm5jZ1x0JWRcdHNpemVcdCVqZFx0YmxvY2tzXHQl
 amRcbiIsCiAgCQkgICAgYWZzLmZzX25jZywgKGludG1heF90KWZzc2l6ZSwgKGludG1heF90KWFm
 cy5mc19kc2l6ZSk7Cg==
 --0016e6d9a0e81b15e7047c58b1cd--
Responsible-Changed-From-To: freebsd-bugs->gavin 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Wed Jan 6 12:08:34 UTC 2010 
Responsible-Changed-Why:  
Take 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/142155: commit references a PR
Date: Wed,  6 Jan 2010 14:01:41 +0000 (UTC)

 Author: gavin
 Date: Wed Jan  6 14:01:28 2010
 New Revision: 201647
 URL: http://svn.freebsd.org/changeset/base/201647
 
 Log:
   Print leading zeros in the UFS2 FSID.
   
   PR:		bin/142155
   Submitted by:	Efstratios Karatzas  gpf.kira gmail.com
   Approved by:	ed (mentor)
   MFC after:	2 weeks
 
 Modified:
   head/sbin/dumpfs/dumpfs.c
 
 Modified: head/sbin/dumpfs/dumpfs.c
 ==============================================================================
 --- head/sbin/dumpfs/dumpfs.c	Wed Jan  6 13:56:49 2010	(r201646)
 +++ head/sbin/dumpfs/dumpfs.c	Wed Jan  6 14:01:28 2010	(r201647)
 @@ -160,7 +160,7 @@ dumpfs(const char *name)
  		fstime = afs.fs_old_time;
  		printf("magic\t%x (UFS1)\ttime\t%s",
  		    afs.fs_magic, ctime(&fstime));
 -		printf("id\t[ %x %x ]\n", afs.fs_id[0], afs.fs_id[1]);
 +		printf("id\t[ %08x %08x ]\n", afs.fs_id[0], afs.fs_id[1]);
  		printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n",
  		    afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize);
  		break;
 _______________________________________________
 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"
 
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Wed Jan 6 15:04:05 UTC 2010 
State-Changed-Why:  
Fixed in HEAD, MFC in 2 weeks 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/142155: commit references a PR
Date: Fri, 22 Jan 2010 20:02:32 +0000 (UTC)

 Author: gavin
 Date: Fri Jan 22 20:02:22 2010
 New Revision: 202824
 URL: http://svn.freebsd.org/changeset/base/202824
 
 Log:
   Merge r201647 from head:
     Print leading zeros in the UFS2 FSID.
   
   PR:		bin/142155
   Submitted by:	Efstratios Karatzas  gpf.kira gmail.com
   Approved by:	ed (mentor, implicit)
 
 Modified:
   stable/8/sbin/dumpfs/dumpfs.c
 Directory Properties:
   stable/8/sbin/dumpfs/   (props changed)
 
 Modified: stable/8/sbin/dumpfs/dumpfs.c
 ==============================================================================
 --- stable/8/sbin/dumpfs/dumpfs.c	Fri Jan 22 19:51:34 2010	(r202823)
 +++ stable/8/sbin/dumpfs/dumpfs.c	Fri Jan 22 20:02:22 2010	(r202824)
 @@ -160,7 +160,7 @@ dumpfs(const char *name)
  		fstime = afs.fs_old_time;
  		printf("magic\t%x (UFS1)\ttime\t%s",
  		    afs.fs_magic, ctime(&fstime));
 -		printf("id\t[ %x %x ]\n", afs.fs_id[0], afs.fs_id[1]);
 +		printf("id\t[ %08x %08x ]\n", afs.fs_id[0], afs.fs_id[1]);
  		printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n",
  		    afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize);
  		break;
 _______________________________________________
 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"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/142155: commit references a PR
Date: Fri, 22 Jan 2010 20:07:07 +0000 (UTC)

 Author: gavin
 Date: Fri Jan 22 20:06:57 2010
 New Revision: 202825
 URL: http://svn.freebsd.org/changeset/base/202825
 
 Log:
   Merge r201647 from head:
     Print leading zeros in the UFS2 FSID.
   
   PR:		bin/142155
   Submitted by:	Efstratios Karatzas  gpf.kira gmail.com
   Approved by:	ed (mentor, implicit)
 
 Modified:
   stable/7/sbin/dumpfs/dumpfs.c
 Directory Properties:
   stable/7/sbin/dumpfs/   (props changed)
 
 Modified: stable/7/sbin/dumpfs/dumpfs.c
 ==============================================================================
 --- stable/7/sbin/dumpfs/dumpfs.c	Fri Jan 22 20:02:22 2010	(r202824)
 +++ stable/7/sbin/dumpfs/dumpfs.c	Fri Jan 22 20:06:57 2010	(r202825)
 @@ -160,7 +160,7 @@ dumpfs(const char *name)
  		fstime = afs.fs_old_time;
  		printf("magic\t%x (UFS1)\ttime\t%s",
  		    afs.fs_magic, ctime(&fstime));
 -		printf("id\t[ %x %x ]\n", afs.fs_id[0], afs.fs_id[1]);
 +		printf("id\t[ %08x %08x ]\n", afs.fs_id[0], afs.fs_id[1]);
  		printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n",
  		    afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize);
  		break;
 _______________________________________________
 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"
 
State-Changed-From-To: patched->closed 
State-Changed-By: gavin 
State-Changed-When: Sun Jan 24 15:07:35 UTC 2010 
State-Changed-Why:  
Fixed in HEAD, 7.x and 8.x.  Thanks for your submission! 

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