Subject: kern/34459: Unconsistant behaviour in the %X flag for printf kernel function
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <degroote@enseirb.fr>
List: netbsd-bugs
Date: 09/03/2006 16:25:00
>Number: 34459
>Category: kern
>Synopsis: Unconsistant behaviour in the %X flag for printf kernel function
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Sep 03 16:25:00 +0000 2006
>Originator: Arnaud Degroote
>Release: current
>Organization:
>Environment:
NetBSD Hermes.at.home 4.99.1 NetBSD 4.99.1 (HERMES) #1: Wed Aug 16 21:26:29 CEST 2006 root@Hermes.at.home:/usr/build/objdir/sys/arch/i386/compile/HERMES i386
>Description:
When we try to port the acx driver from OpenBSD, we have noted that the %X flag doesn't have the expected behaviour ( we have d, and we wait for D ).
Reading the implementation of kprintf, it is clear there is a little bug in the implementation.
>How-To-Repeat:
try to see the result of a snprintf(buf, sizeof buf,"%X",13) ( in kerneland )
>Fix:
this trivial patch must resolve the issue
--- /usr/src/sys/kern/subr_prf.c 2006-01-28 15:37:31.000000000 +0100
+++ /home/zul/src/sys/kern/subr_prf.c 2006-09-03 18:23:12.000000000 +0200
@@ -1264,7 +1264,7 @@ reswitch: switch (ch) {
base = DEC;
goto nosign;
case 'X':
- xdigs = hexdigits;
+ xdigs = HEXDIGITS;
goto hex;
case 'x':
xdigs = hexdigits;