Bug#303827: mawk: printf %x clamps numbers to range of signed int rather than unsigned int

2010-03-01 Thread Jonathan Nieder
Hi Adam,

Adam M. Costello wrote:

 The printf %x conversion is supposed to treat its argument as an
 unsigned int (see printf(3)).  But look at what mawk does:
 
 $ mawk 'END { printf(%x %x\n, 2e9, 3e9) }'  /dev/null
 77359400 7fff
 
 Compare that to gawk:
 
 $ gawk 'END { printf(%x %x\n, 2e9, 3e9) }'  /dev/null
 77359400 b2d05e00
 
 The range of an unsigned int on 32-bit platforms goes up to ,
 not 7fff.

Yep.  Thomas Dickey wrote a fix for this and included it (among other
things) in his mawk 1.3.3-20090711 release.  Relevant changes:

http://git.debian.org/?p=collab-maint/mawk.git;a=blobdiff;f=print.c;h=4afe0a15f;hb=8044617;hpb=6e68fb445
http://git.debian.org/?p=collab-maint/mawk.git;a=blobdiff;f=cast.c;h=7052abe8;hb=8044617f;hpb=6e68fb44

Version 1.3.3-20090820 follows up on that.  The changelog says:

  correct lower-limit for d_to_U() function, which broke conversion of
  zero in %x format, added in fix for Debian #303825 (report by Masami
  Hiramatsu).

and the patch:

http://git.debian.org/?p=collab-maint/mawk.git;a=commitdiff;h=0dedcdb#patch5

I have not tested a minimal consolidated diff, though.

Hope that helps,
Jonathan



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#303827: mawk: printf %x clamps numbers to range of signed int rather than unsigned int

2005-04-08 Thread Adam M. Costello
Package: mawk
Version: 1.3.3-11
Severity: normal

[Sorry if this is a duplicate.  I'm not sure whether my first attempt
got through.]

The printf %x conversion is supposed to treat its argument as an
unsigned int (see printf(3)).  But look at what mawk does:

$ mawk 'END { printf(%x %x\n, 2e9, 3e9) }'  /dev/null
77359400 7fff

Compare that to gawk:

$ gawk 'END { printf(%x %x\n, 2e9, 3e9) }'  /dev/null
77359400 b2d05e00

The range of an unsigned int on 32-bit platforms goes up to ,
not 7fff.

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (900, 'testing'), (700, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-2-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages mawk depends on:
ii  libc6   2.3.2.ds1-20 GNU C Library: Shared libraries an

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]