dumpfs incorrectly displays ufsid

rank1seeker at gmail.com rank1seeker at gmail.com
Tue May 26 16:27:08 UTC 2015


On Tue, 26 May 2015 13:09:53 +0200 (CEST)
Trond Endrestøl <Trond.Endrestol at fagskolen.gjovik.no> wrote:

> On Tue, 26 May 2015 12:31+0200, rank1seeker at gmail.com wrote:
> 
> > I've reported this at REL 8.2, long ago at May 2011
> >     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=156908
> > 
> > Now at 10.1-RELEASE-p10 #0 r282952   i386
> > 
> > This happens, ONLY when first chars are 0 (zeros) in second pair of
> > 8 chars, in which case dumpfs, ommits them.
> > I.e; For:
> >     /dev/ufsid/3b9aca0000000001
> > 
> > # dumpfs ada0s1h | head -2
> > magic   19540119 (UFS2) time    Sun Sep  9 03:46:40 2001
> > superblock location     65536   id      [ 3b9aca00 1 ]
> > 
> > Problem is in '[ 3b9aca00 1 ]'
> 
> If you apply this patch, then the case for UFS2 is treated similar to 
> the case for UFS1:
> 
> Index: sbin/dumpfs/dumpfs.c
> ===================================================================
> --- sbin/dumpfs/dumpfs.c	(revision 283516)
> +++ sbin/dumpfs/dumpfs.c	(working copy)
> @@ -165,7 +165,7 @@
>  		fstime = afs.fs_time;
>  		printf("magic\t%x (UFS2)\ttime\t%s",
>  		    afs.fs_magic, ctime(&fstime));
> -		printf("superblock location\t%jd\tid\t[ %x %x ]\n",
> +		printf("superblock location\t%jd\tid\t[ %08x %08x
> ]\n", (intmax_t)afs.fs_sblockloc, 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);
> 

Applied patch ...

rm -f dumpfs dumpfs.o dumpfs.8.gz dumpfs.8.cat.gz
/usr/obj/usr/src/sbin/dumpfs created for /usr/src/sbin/dumpfs
rm -f .depend
mkdep -f .depend -a     -std=gnu99   /usr/src/sbin/dumpfs/dumpfs.c
echo dumpfs: /usr/lib/libc.a /usr/lib/libufs.a >> .depend
cc -O2 -pipe -march=prescott  -std=gnu99 -Qunused-arguments  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -c /usr/src/sbin/dumpfs/dumpfs.c
cc -O2 -pipe -march=prescott  -std=gnu99 -Qunused-arguments  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -o dumpfs dumpfs.o -lufs
gzip -cn /usr/src/sbin/dumpfs/dumpfs.8 > dumpfs.8.gz
install -s -o root -g wheel -m 555   dumpfs /sbin/dumpfs
install -o root -g wheel -m 444 dumpfs.8.gz  /usr/share/man/man8
rm -f dumpfs dumpfs.o dumpfs.8.gz dumpfs.8.cat.gz


And ...
# dumpfs ada0s1h | head -2
magic   19540119 (UFS2) time    Sun Sep  9 03:46:40 2001
superblock location     65536   id      [ 3b9aca00 00000001 ]


Ok, it works!
Could you now commit it ASAP?

Thanks.


Domagoj Smolčić



More information about the freebsd-hackers mailing list