From dan@obluda.cz  Tue Jun 25 18:20:45 2002
Return-Path: <dan@obluda.cz>
Received: from xkulesh.vol.cz (xkulesh.vol.cz [195.250.154.106])
	by hub.freebsd.org (Postfix) with ESMTP id B7AE337B406
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Jun 2002 18:20:33 -0700 (PDT)
Received: from obluda.cz (localhost [127.0.0.1])
	by xkulesh.vol.cz (8.12.3/8.12.3) with ESMTP id g5Q1KUU1057822
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 26 Jun 2002 03:20:31 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by obluda.cz (8.12.4/8.12.4/Submit) id g5PN5fOC055526;
	Wed, 26 Jun 2002 01:05:41 +0200 (CEST)
Message-Id: <200206252305.g5PN5fOC055526@obluda.cz>
Date: Wed, 26 Jun 2002 01:05:41 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: cleaning sbin/dump code from warnings
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         39868
>Category:       bin
>Synopsis:       cleaning sbin/dump code from warnings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    johan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 25 18:30:01 PDT 2002
>Closed-Date:    Mon Apr 14 13:13:37 PDT 2003
>Last-Modified:  Mon Apr 14 13:13:37 PDT 2003
>Originator:     Dan Lukes
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD xkulesh.vol.cz 4.6-STABLE FreeBSD
src/sbin/dump/main.c,v 1.20.2.7 2002/02/23 22:32:51
src/sbin/dump/tape.c,v 1.12.2.3 2002/02/23 22:32:51
src/sbin/dump/traverse.c,v 1.10.2.4 2001/07/14 13:51:37

>Description:

sbin/dump/main.c: In function `main':
343: warning: int format, long int arg (arg 2)
   dev_bsize is declared as long
476: warning: long int format, daddr_t arg (arg 2)
   spcl.c_tapea is ddaddr_t e.g. int32_t e.g. int
480: warning: long int format, daddr_t arg (arg 2)
   spcl.c_tapea is ddaddr_t e.g. int32_t e.g. int
488: warning: int format, time_t arg (arg 2)
488: warning: int format, long int arg (arg 3)
  time_t is long

sbin/dump/tape.c: In function `tperror':
224: warning: int format, long int arg (arg 2)
  blocksthisvol is declared as long

sbin/dump/traverse.c: In function `bread':
629: warning: int format, pointer arg (arg 3)
  disk is (char *)
648: warning: int format, long int arg (arg 5)
   dev_bsize is declared as long
652: warning: int format, long int arg (arg 4)
   dev_bsize is declared as long


>How-To-Repeat:
        N/A
>Fix:

--- sbin/dump/main.c.ORIG Wed Jun 26 00:08:31 2002
+++ sbin/dump/main.c      Wed Jun 26 00:19:29 2002
@@ -340,7 +340,7 @@
        dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1);
        dev_bshift = ffs(dev_bsize) - 1;
        if (dev_bsize != (1 << dev_bshift))
-               quit("dev_bsize (%d) is not a power of 2", dev_bsize);
+               quit("dev_bsize (%ld) is not a power of 2", dev_bsize);
        tp_bshift = ffs(TP_BSIZE) - 1;
        if (TP_BSIZE != (1 << tp_bshift))
                quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE);
@@ -473,9 +473,9 @@
        for (i = 0; i < ntrec; i++)
                writeheader(maxino - 1);
        if (pipeout)
-               msg("DUMP: %ld tape blocks\n", spcl.c_tapea);
+               msg("DUMP: %d tape blocks\n", spcl.c_tapea);
        else
-               msg("DUMP: %ld tape blocks on %d volume%s\n",
+               msg("DUMP: %d tape blocks on %d volume%s\n",
                    spcl.c_tapea, spcl.c_volume,
                    (spcl.c_volume == 1) ? "" : "s");
@@ -483,7 +483,7 @@
        if (tend_writing - tstart_writing == 0)
                msg("finished in less than a second\n");
        else
-               msg("finished in %d seconds, throughput %d KBytes/sec\n",
+               msg("finished in %ld seconds, throughput %ld KBytes/sec\n",
                    tend_writing - tstart_writing,
                    spcl.c_tapea / (tend_writing - tstart_writing));
--- sbin/dump/tape.c.ORIG Sat Mar  2 14:43:00 2002
+++ sbin/dump/tape.c      Wed Jun 26 00:49:20 2002
@@ -221,7 +221,7 @@
                quit("Cannot recover\n");
                /* NOTREACHED */
        }
-       msg("write error %d blocks into volume %d\n", blocksthisvol, tapeno);
+       msg("write error %ld blocks into volume %d\n", blocksthisvol, tapeno);
        broadcast("DUMP WRITE ERROR!\n");
        if (!query("Do you want to restart?"))
                dumpabort(0);
--- sbin/dump/traverse.c.ORIG     Sun Jul 15 21:10:05 2001
+++ sbin/dump/traverse.c  Wed Jun 26 01:01:11 2002
@@ -625,7 +625,7 @@
                msg("short read error from %s: [block %d]: count=%d, got=%d\n",
                        disk, blkno, size, cnt);
        if (++breaderrors > BREADEMAX) {
-               msg("More than %d block read errors from %d\n",
+               msg("More than %d block read errors from %s\n",
                        BREADEMAX, disk);
                broadcast("DUMP IS AILING!\n");
                msg("This is an unrecoverable error.\n");
@@ -644,11 +644,11 @@
                    ((off_t)blkno << dev_bshift))) == dev_bsize)
                        continue;
                if (cnt == -1) {
-                       msg("read error from %s: %s: [sector %d]: count=%d\n",
+                       msg("read error from %s: %s: [sector %d]: count=%ld\n",
                                disk, strerror(errno), blkno, dev_bsize);
                        continue;
                }
-               msg("short read error from %s: [sector %d]: count=%d, got=%d\n",
+               msg("short read error from %s: [sector %d]: count=%ld, got=%d\n",
                        disk, blkno, dev_bsize, cnt);
        }
 }
>Release-Note:
>Audit-Trail:

From: Brooks Davis <brooks@one-eyed-alien.net>
To: Dan Lukes <dan@obluda.cz>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/39868: cleaning sbin/dump code from warnings
Date: Wed, 26 Jun 2002 18:00:34 -0700

 On Wed, Jun 26, 2002 at 01:05:41AM +0200, Dan Lukes wrote:
 > 
 > >Synopsis:       cleaning sbin/dump code from warnings
 
 Thank you for submitting patches to address the warnings in this code.
 
 Unfortunatly, you had really bad timing and the code in -current has
 changed significantly due to the changes required for UFS2 support.
 This means it is unlikely these patches will apply to -current.  They
 will apply to -stable, but I'm not sure what we want to do about that
 given that there won't be significantly development of file system
 changes in -stable.
 
 -- Brooks

From: Dan Lukes <dan@obluda.cz>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/39868: cleaning sbin/dump code from warnings
Date: Thu, 27 Jun 2002 12:48:22 +0200

 Well - as long as sizeof(int)==sizeof(long) the bugs has no real impact, 
 so it may remain unfixed in stable safelly.
 
 
 But the
 sbin/dump/traverse.c: In function `bread':
 629: warning: int format, pointer arg (arg 3)
    disk is (char *)
 
 is the only error with real impact as the error message
 
 ----------------
 msg("More than %d block read errors from %d\n",
                          BREADEMAX, disk);
 ----------------
 
 may be confusing (because disk is (char *)) for user.
 
 	It should be fixed in -stable too, IMHO ...
 
 					Dan
 
 
 -- 
 Dan Lukes      tel: +420 2 21914205, fax: +420 2 21914206
 root  of FIONet,  KolejNET,  webmaster  of www.freebsd.cz
 AKA: dan@obluda.cz, dan@freebsd.cz, dan@kolej.mff.cuni.cz
 
Responsible-Changed-From-To: freebsd-bugs->johan 
Responsible-Changed-By: johan 
Responsible-Changed-When: Sun Apr 13 09:22:43 PDT 2003 
Responsible-Changed-Why:  
I'll take a look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=39868 
State-Changed-From-To: open->closed 
State-Changed-By: johan 
State-Changed-When: Mon Apr 14 13:11:26 PDT 2003 
State-Changed-Why:  
I have MFCed the part that you identified. 
Thanks for the submission. 

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