NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/41035: sysctl -xx format failure
>Number: 41035
>Category: bin
>Synopsis: sysctl -xx output is incorrect
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 17 23:35:00 +0000 2009
>Originator: Paul Goyette
>Release: NetBSD 5.99.8
>Organization:
-------------------------------------------------------------------------
| Paul Goyette | PGP DSS Key fingerprint: | E-mail addresses: |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer | | pgoyette at netbsd.org |
-------------------------------------------------------------------------
>Environment:
System: NetBSD quicky.whooppee.com 5.99.8 NetBSD 5.99.8 (QUICKY (ASUS M2N32 WS)
2009-03-15 23:01:39) #0: Sun Mar 15 17:48:07 PDT 2009
paul%speedy.whooppee.com@localhost:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/QUICKY
amd64
Architecture: x86_64
Machine: amd64
>Description:
sysctl -xx is supposed to produce output similar to hexdump -c
However, the address/offset values, although printed with
leading zeroes, are actually decimal values!
quicky:DECODE {207} sysctl -xx hw.spdmem0.spd_data
hw.spdmem0.spd_data =
0000000 80 08 08 0e 0a 61 40 00 05 25 40 00 82 08 00 00 | .....a@..%@..... |
0000016 0c 08 30 03 02 00 03 37 50 00 00 32 1e 32 2d 01 | ..0....7P..2.2-. |
0000032 18 25 05 13 3c 1e 1e 00 00 37 69 80 14 1e 00 56 | .%..<....7i....V |
0000048 78 6f 3f 26 31 50 2e 65 30 3e 00 00 00 00 12 15 | xo?&1P.e0>...... |
0000064 7f 7f 9e 00 00 00 00 00 01 43 4d 32 58 32 30 34 | .........CM2X204 |
0000080 38 2d 36 34 30 30 43 35 44 48 58 20 20 ff ff ff | 8-6400C5DHX ... |
0000096 ff ff ff 00 00 00 00 00 00 00 00 1f ff ff ff ff | ................ |
0000112 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff | ................ |
0000128 bytes
quicky:DECODE {208}
>How-To-Repeat:
See above
>Fix:
Apply the following patch:
Index: sysctl.c
===================================================================
RCS file: /cvsroot/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.126
diff -u -p -r1.126 sysctl.c
--- sysctl.c 5 Mar 2009 15:35:59 -0000 1.126
+++ sysctl.c 17 Mar 2009 23:33:51 -0000
@@ -1927,7 +1927,7 @@ hex_dump(const unsigned char *buf, size_
line[58] = '|';
line[77] = '|';
line[78] = 0;
- snprintf(tmp, sizeof(tmp), "%07d", i);
+ snprintf(tmp, sizeof(tmp), "%07x", i);
memcpy(&line[0], tmp, 7);
}
/* copy out hex version of byte */
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index