# 'dumpfs' incorrectly displays ufsid



## Seeker (May 9, 2011)

```
# ll /dev/ufsid | grep 5f7a09e
crw-r-----  1 root  operator  -   0, 154 May  9 14:33:03 2011 4dc7deff[B][color="Red"]0[/color][/B]5f7a09e

# glabel status | grep 5f7a09e
 ufsid/4dc7deff[B][color="Red"]0[/color][/B]5f7a09e     N/A  md0f
```


```
# dumpfs md0f | grep superblock
superblock location     65536   id      [ 4dc7deff 5f7a09e ]
```
It should be:

```
[ 4dc7deff [B][color="Red"]0[/color][/B]5f7a09e ]
```
Looking at other ufsid's, I can say that this happens, ONLY when first char is 0 (zero) in second part of 8 chars, in which case dumpfs, ommits it.


----------



## SirDice (May 9, 2011)

Should be easily fixed:

```
case 2:
		fssize = afs.fs_size;
		fstime = afs.fs_time;
		printf("magic\t%x (UFS2)\ttime\t%s",
		    afs.fs_magic, ctime(&fstime));
		[b]printf("superblock location\t%jd\tid\t[ %x %x ]\n",
		    (intmax_t)afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]);[/b]
		printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n",
		    afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize);
		break;
	case 1:
		fssize = afs.fs_old_size;
		fstime = afs.fs_old_time;
		printf("magic\t%x (UFS1)\ttime\t%s",
		    afs.fs_magic, ctime(&fstime));
		[b]printf("id\t[ %08x %08x ]\n", afs.fs_id[0], afs.fs_id[1]);[/b]
		printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n",
		    afs.fs_ncg, (intmax_t)fssize, (intmax_t)afs.fs_dsize);
		break;
```

Note the differences in the printf format string. In order to print the leading zeroes correctly the first bolded line should be:

```
printf("superblock location\t%jd\tid\t[ %08x %08x ]\n",
		    (intmax_t)afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]);
```


----------



## Seeker (May 9, 2011)

So ...
What now?

Should I fill the PR, or you have already done so?


----------



## SirDice (May 9, 2011)

I haven't done so. It's not really an error, it's just a different way of presenting the same information.


----------



## Seeker (May 9, 2011)

No, *it is* a bug, because in form it declared it present information, it violates it. Thus confusing user (which gets data on terminal) and script that parses its output.

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


----------

