amd64/97566: compilation of /usr/src/tools/tools/recoverdisk fails on amd64.

Roland Smith rsmith at xs4all.nl
Sun May 21 11:01:01 PDT 2006


>Number:         97566
>Category:       amd64
>Synopsis:       compilation of /usr/src/tools/tools/recoverdisk fails on amd64.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-amd64
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 21 18:00:47 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Roland Smith
>Release:        FreeBSD 6.1-STABLE amd64
>Organization:
>Environment:
System: FreeBSD slackbox.xs4all.nl 6.1-STABLE FreeBSD 6.1-STABLE #0: Tue May 9 22:46:51 CEST 2006 rsmith at slackbox.xs4all.nl:/usr/obj/usr/src/sys/RFS amd64

>Description:

Compilation of the recoverdisk tool fails on amd64:

slackbox# make
cc -O2 -fno-strict-aliasing -pipe  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -c recoverdisk.c
recoverdisk.c: In function `main':
recoverdisk.c:231: warning: comparison between signed and unsigned
recoverdisk.c:231: warning: signed and unsigned type in conditional expression
recoverdisk.c:233: warning: comparison between signed and unsigned
recoverdisk.c:233: warning: signed and unsigned type in conditional expression
recoverdisk.c:235: warning: comparison between signed and unsigned
recoverdisk.c:235: warning: signed and unsigned type in conditional expression
recoverdisk.c:237: warning: comparison between signed and unsigned
*** Error code 1

Stop in /usr/src/tools/tools/recoverdisk.

This is due to the -W flag and the difference between size_t and off_t on
amd64 (and possibly other 64-bit platforms). On i386 size_t and off_t
totally overlap, while on amd64 they only partially overlap.

>How-To-Repeat:

cd /usr/src/tools/tools/recoverdisk
make

>Fix:

Apply the following patch, tested on i386 and amd64:

-------- recoverdisk.c patch --------
--- recoverdisk.c.orig	Sun May 21 19:33:38 2006
+++ recoverdisk.c	Sun May 21 19:41:45 2006
@@ -228,13 +228,13 @@
 		if (lp == NULL)
 			break;
 		while (lp->len > 0 && !aborting) {
-			i = MIN(lp->len, bigsize);
+			i = MIN(lp->len, (off_t)bigsize);
 			if (lp->state == 1)
-				i = MIN(lp->len, medsize);
+				i = MIN(lp->len, (off_t)medsize);
 			if (lp->state > 1)
-				i = MIN(lp->len, minsize);
+				i = MIN(lp->len, (off_t)minsize);
 			time(&t2);
-			if (t1 != t2 || lp->len < bigsize) {
+			if (t1 != t2 || lp->len < (off_t)bigsize) {
 				printf("\r%13jd %7zu %13jd %5d %13jd %13jd %.7f",
 				    (intmax_t)lp->start,
 				    i, 

-------- recoverdisk.c patch --------


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-amd64 mailing list