Skip to contentSkip to conversation

xfsprogs: fix various incorrect printf formats

PATCH Superseded Christoph Hellwig 2 participants 5 messages Oct 25, 2011 – Nov 5, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: fix various incorrect printf formats

libxfs/freebsd.c +2 -4
Index: xfsprogs/libxfs/freebsd.c
===================================================================
@@ -126,15 +126,13 @@ platform_findsizes(char *path, int fd, l
 	}
 
 	if ((st.st_mode & S_IFMT) != S_IFCHR) {
-		fprintf(stderr, _("%s: "
-			"Not a device or file: \"%s\"n"),
+		fprintf(stderr, _("%s: Not a device or file: \"%s\"\n"),
 			progname, path);
 		exit(1);
 	}
 
 	if (ioctl(fd, DIOCGMEDIASIZE, &size) != 0) {
-		fprintf(stderr, _("%s: "
-			"DIOCGMEDIASIZE failed on \"%s\": %s\n"),
+		fprintf(stderr, _("%s: DIOCGMEDIASIZE failed on \"%s\": %s\n"),
 			progname, path, strerror(errno));
 		exit(1);
 	}
repair/dinode.c +1 -1
Index: xfsprogs/repair/dinode.c
===================================================================
@@ -1439,7 +1439,7 @@ _("mismatch between format (%d) and size
 	}
 	if (dino->di_format == XFS_DINODE_FMT_LOCAL) {
 		do_warn(
-_("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu64 "n"),
+_("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu64 "\n"),
 			dino->di_format,
 			(__int64_t)be64_to_cpu(dino->di_size), lino);
 		return 1;
repair/dir2.c +1 -1
Index: xfsprogs/repair/dir2.c
===================================================================
@@ -1174,7 +1174,7 @@ _("would have corrected entry count in d
 				ino, sfp->hdr.count, i);
 		} else {
 			do_warn(
-_("corrected entry count in directory %" PRIu64 "u, was %d, now %d\n"),
+_("corrected entry count in directory %" PRIu64 ", was %d, now %d\n"),
 				ino, sfp->hdr.count, i);
 			sfp->hdr.count = i;
 			*dino_dirty = 1;
repair/phase6.c +1 -1
Index: xfsprogs/repair/phase6.c
===================================================================
@@ -2071,7 +2071,7 @@ longform_dir2_entry_check_data(
 		if (is_inode_free(irec, ino_offset))  {
 			nbad++;
 			if (entry_junked(
-	_("entry \"%s\" in directory inode %" PRIu64 " points to free inode " PRIu64),
+	_("entry \"%s\" in directory inode %" PRIu64 " points to free inode %" PRIu64),
 					fname, ip->i_ino, inum)) {
 				dep->name[0] = '/';
 				libxfs_dir2_data_log_entry(tp, bp, dep);
repair/scan.c +4 -4
Index: xfsprogs/repair/scan.c
===================================================================
@@ -289,14 +289,14 @@ _("bad back (left) sibling pointer (saw
 			 */
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 "bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 "bmap block %" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			break;
 		case XR_E_MULT:
 		case XR_E_INUSE_FS:
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 " bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 " bmap block %" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			/*
 			 * if we made it to here, this is probably a bmap block
@@ -311,7 +311,7 @@ _("inode 0x%" PRIu64 " bmap block 0x%" P
 		case XR_E_BAD_STATE:
 		default:
 			do_warn(
-_("bad state %d, inode 0x%" PRIu64 " bmap block 0x%" PRIu64 "\n"),
+_("bad state %d, inode 0x%" PRIu64 " bmap block %" PRIx64 "\n"),
 				state, ino, bno);
 			break;
 		}
@@ -338,7 +338,7 @@ _("bad state %d, inode 0x%" PRIu64 " bma
 		if (numrecs > mp->m_bmap_dmxr[0] || (isroot == 0 && numrecs <
 							mp->m_bmap_dmnr[0])) {
 				do_warn(
-_("inode 0x%" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
+_("inode %" PRIx64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
 					ino, numrecs, mp->m_bmap_dmnr[0],
 					mp->m_bmap_dmxr[0]);
 			return(1);

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 2 lines · Christoph Hellwig

[...]

Quoted 31 lines

Index: xfsprogs/repair/scan.c
===================================================================

repair/scan.c +3 -3
@@ -289,14 +289,14 @@ _("bad back (left) sibling pointer (saw
 			 */
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 "bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 "bmap block %" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			break;
 		case XR_E_MULT:
 		case XR_E_INUSE_FS:
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 " bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 " bmap block %" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			/*
 			 * if we made it to here, this is probably a bmap block
@@ -311,7 +311,7 @@ _("inode 0x%" PRIu64 " bmap block 0x%" P
 		case XR_E_BAD_STATE:
 		default:
 			do_warn(
-_("bad state %d, inode 0x%" PRIu64 " bmap block 0x%" PRIu64 "\n"),
+_("bad state %d, inode 0x%" PRIu64 " bmap block %" PRIx64 "\n"),
 				state, ino, bno);
 			break;
 		}

repair/scan.c _("bad state %d, inode 0x%" PRIu64 " bma · line 344

Quoted 8 lines
repair/scan.c +1 -1
@@ -338,7 +338,7 @@ _("bad state %d, inode 0x%" PRIu64 " bma
 		if (numrecs > mp->m_bmap_dmxr[0] || (isroot == 0 && numrecs <
 							mp->m_bmap_dmnr[0])) {
 				do_warn(
-_("inode 0x%" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
+_("inode %" PRIx64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
 					ino, numrecs, mp->m_bmap_dmnr[0],
 					mp->m_bmap_dmxr[0]);
 			return(1);

Erm... the above part of changes is inconsistent.

PRIxnn itself doesn't append "0x" - so either remove "0x" prefix and keep PRIu64 (thus printing value in decimal) _or_ (xor in terms of computer logic ;)) keep "0x" prefix and use PRIx64 (thus printing value in hex).
I'd use decimal at least for inodes (in other places they are printed in such way).

Also please note that in first 3 messages there were two uses "0x"+PRIu64...

Regards,

Signature · 6 lines
Jakub Bogusz    http://qboosh.pl/

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

PATCH v2 1/1 xfsprogs: fix various incorrect printf formats

libxfs/freebsd.c +2 -4
Index: xfsprogs/libxfs/freebsd.c
===================================================================
@@ -126,15 +126,13 @@ platform_findsizes(char *path, int fd, l
 	}
 
 	if ((st.st_mode & S_IFMT) != S_IFCHR) {
-		fprintf(stderr, _("%s: "
-			"Not a device or file: \"%s\"n"),
+		fprintf(stderr, _("%s: Not a device or file: \"%s\"\n"),
 			progname, path);
 		exit(1);
 	}
 
 	if (ioctl(fd, DIOCGMEDIASIZE, &size) != 0) {
-		fprintf(stderr, _("%s: "
-			"DIOCGMEDIASIZE failed on \"%s\": %s\n"),
+		fprintf(stderr, _("%s: DIOCGMEDIASIZE failed on \"%s\": %s\n"),
 			progname, path, strerror(errno));
 		exit(1);
 	}
repair/dinode.c +1 -1
Index: xfsprogs/repair/dinode.c
===================================================================
@@ -1439,7 +1439,7 @@ _("mismatch between format (%d) and size
 	}
 	if (dino->di_format == XFS_DINODE_FMT_LOCAL) {
 		do_warn(
-_("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu64 "n"),
+_("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu64 "\n"),
 			dino->di_format,
 			(__int64_t)be64_to_cpu(dino->di_size), lino);
 		return 1;
repair/dir2.c +1 -1
Index: xfsprogs/repair/dir2.c
===================================================================
@@ -1174,7 +1174,7 @@ _("would have corrected entry count in d
 				ino, sfp->hdr.count, i);
 		} else {
 			do_warn(
-_("corrected entry count in directory %" PRIu64 "u, was %d, now %d\n"),
+_("corrected entry count in directory %" PRIu64 ", was %d, now %d\n"),
 				ino, sfp->hdr.count, i);
 			sfp->hdr.count = i;
 			*dino_dirty = 1;
repair/phase6.c +1 -1
Index: xfsprogs/repair/phase6.c
===================================================================
@@ -2071,7 +2071,7 @@ longform_dir2_entry_check_data(
 		if (is_inode_free(irec, ino_offset))  {
 			nbad++;
 			if (entry_junked(
-	_("entry \"%s\" in directory inode %" PRIu64 " points to free inode " PRIu64),
+	_("entry \"%s\" in directory inode %" PRIu64 " points to free inode %" PRIu64),
 					fname, ip->i_ino, inum)) {
 				dep->name[0] = '/';
 				libxfs_dir2_data_log_entry(tp, bp, dep);
repair/scan.c +4 -4
Index: xfsprogs/repair/scan.c
===================================================================
@@ -289,14 +289,14 @@ _("bad back (left) sibling pointer (saw
 			 */
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 "bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 "bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			break;
 		case XR_E_MULT:
 		case XR_E_INUSE_FS:
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 " bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 " bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			/*
 			 * if we made it to here, this is probably a bmap block
@@ -311,7 +311,7 @@ _("inode 0x%" PRIu64 " bmap block 0x%" P
 		case XR_E_BAD_STATE:
 		default:
 			do_warn(
-_("bad state %d, inode 0x%" PRIu64 " bmap block 0x%" PRIu64 "\n"),
+_("bad state %d, inode 0x%" PRIu64 " bmap block 0x%" PRIx64 "\n"),
 				state, ino, bno);
 			break;
 		}
@@ -338,7 +338,7 @@ _("bad state %d, inode 0x%" PRIu64 " bma
 		if (numrecs > mp->m_bmap_dmxr[0] || (isroot == 0 && numrecs <
 							mp->m_bmap_dmnr[0])) {
 				do_warn(
-_("inode 0x%" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
+_("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
 					ino, numrecs, mp->m_bmap_dmnr[0],
 					mp->m_bmap_dmxr[0]);
 			return(1);

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 11 lines · Christoph Hellwig

Index: xfsprogs/repair/scan.c
===================================================================

repair/scan.c +1 -1
@@ -289,14 +289,14 @@ _("bad back (left) sibling pointer (saw
 			 */
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 "bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 "bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);

repair/scan.c _("bad back (left) sibling pointer (saw · line 302

Quoted 10 lines
repair/scan.c +1 -1
 			break;
 		case XR_E_MULT:
 		case XR_E_INUSE_FS:
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 " bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 " bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			/*
 			 * if we made it to here, this is probably a bmap block

These two entries still need fix in the first format strings of both msgids...

I'm attaching my version of the whole patch.

Signature · 1 line
Jakub Bogusz    http://qboosh.pl/
libxfs/freebsd.c +2 -4
Index: xfsprogs/libxfs/freebsd.c
===================================================================
@@ -126,15 +126,13 @@ platform_findsizes(char *path, int fd, l
 	}
 
 	if ((st.st_mode & S_IFMT) != S_IFCHR) {
-		fprintf(stderr, _("%s: "
-			"Not a device or file: \"%s\"n"),
+		fprintf(stderr, _("%s: Not a device or file: \"%s\"\n"),
 			progname, path);
 		exit(1);
 	}
 
 	if (ioctl(fd, DIOCGMEDIASIZE, &size) != 0) {
-		fprintf(stderr, _("%s: "
-			"DIOCGMEDIASIZE failed on \"%s\": %s\n"),
+		fprintf(stderr, _("%s: DIOCGMEDIASIZE failed on \"%s\": %s\n"),
 			progname, path, strerror(errno));
 		exit(1);
 	}
repair/dinode.c +1 -1
Index: xfsprogs/repair/dinode.c
===================================================================
@@ -1439,7 +1439,7 @@ _("mismatch between format (%d) and size
 	}
 	if (dino->di_format == XFS_DINODE_FMT_LOCAL) {
 		do_warn(
-_("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu64 "n"),
+_("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu64 "\n"),
 			dino->di_format,
 			(__int64_t)be64_to_cpu(dino->di_size), lino);
 		return 1;
repair/dir2.c +1 -1
Index: xfsprogs/repair/dir2.c
===================================================================
@@ -1174,7 +1174,7 @@ _("would have corrected entry count in d
 				ino, sfp->hdr.count, i);
 		} else {
 			do_warn(
-_("corrected entry count in directory %" PRIu64 "u, was %d, now %d\n"),
+_("corrected entry count in directory %" PRIu64 ", was %d, now %d\n"),
 				ino, sfp->hdr.count, i);
 			sfp->hdr.count = i;
 			*dino_dirty = 1;
repair/phase6.c +1 -1
Index: xfsprogs/repair/phase6.c
===================================================================
@@ -2071,7 +2071,7 @@ longform_dir2_entry_check_data(
 		if (is_inode_free(irec, ino_offset))  {
 			nbad++;
 			if (entry_junked(
-	_("entry \"%s\" in directory inode %" PRIu64 " points to free inode " PRIu64),
+	_("entry \"%s\" in directory inode %" PRIu64 " points to free inode %" PRIu64),
 					fname, ip->i_ino, inum)) {
 				dep->name[0] = '/';
 				libxfs_dir2_data_log_entry(tp, bp, dep);
repair/scan.c +4 -4
Index: xfsprogs/repair/scan.c
===================================================================
@@ -289,14 +289,14 @@ _("bad back (left) sibling pointer (saw
 			 */
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 "bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode %" PRIu64 "bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			break;
 		case XR_E_MULT:
 		case XR_E_INUSE_FS:
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 " bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode %" PRIu64 " bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			/*
 			 * if we made it to here, this is probably a bmap block
@@ -311,7 +311,7 @@ _("inode 0x%" PRIu64 " bmap block 0x%" P
 		case XR_E_BAD_STATE:
 		default:
 			do_warn(
-_("bad state %d, inode 0x%" PRIu64 " bmap block 0x%" PRIu64 "\n"),
+_("bad state %d, inode 0x%" PRIu64 " bmap block 0x%" PRIx64 "\n"),
 				state, ino, bno);
 			break;
 		}
@@ -338,7 +338,7 @@ _("bad state %d, inode 0x%" PRIu64 " bma
 		if (numrecs > mp->m_bmap_dmxr[0] || (isroot == 0 && numrecs <
 							mp->m_bmap_dmnr[0])) {
 				do_warn(
-_("inode 0x%" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
+_("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
 					ino, numrecs, mp->m_bmap_dmnr[0],
 					mp->m_bmap_dmxr[0]);
 			return(1);

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 18 lines
Quoted 4 lines
repair/scan.c +1 -1
 			do_warn(
-_("inode 0x%" PRIu64 "bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 "bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);

repair/scan.c _("bad back (left) sibling pointer (saw · line 302

Quoted 10 lines
repair/scan.c +1 -1
 			break;
 		case XR_E_MULT:
 		case XR_E_INUSE_FS:
 			set_bmap(agno, agbno, XR_E_MULT);
 			do_warn(
-_("inode 0x%" PRIu64 " bmap block 0x%" PRIu64 " claimed, state is %d\n"),
+_("inode 0x%" PRIu64 " bmap block 0x%" PRIx64 " claimed, state is %d\n"),
 				ino, bno, state);
 			/*
 			 * if we made it to here, this is probably a bmap block

These two entries still need fix in the first format strings of both msgids...

Quoted 1 line

I'm attaching my version of the whole patch.

I've already put the previous version in. I'll commit the updates attributed to you.

Sorry for the mess, and thanks a lot for looking over this.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs