Package: mawk
Version: 1.3.3-17
Severity: normal

Dear Maintainer,
*** Please consider answering these questions, where appropriate ***

   * What led up to the situation?

    I attempted to use awk to find the sum of file sizes in a directory.


   * What exactly did you do (or not do) that was effective (or
     ineffective)?

    Precisely this.  I have an externally attached USB storage disk 
    from SeaGate and on this disk are many resources.  There are 
    large files such as Debian DVD iso install images thus : 

# ls -lop Debian_resources
total 8410800
drwxr-xr-x   2 dclarke       4096 Nov 10 17:00 ./
drwxr-xr-x  19 dclarke       4096 Mar 29  2014 ../
-rw-r--r--.  1 dclarke 3938795520 Apr 26  2014 debian-7.5.0-amd64-DVD-1.iso
-rw-r--r--.  1 dclarke  679477248 Apr 26  2014 debian-7.5.0-amd64-lxde-CD-1.iso
-rw-r--r--   1 dclarke 3994337280 Oct 18 10:52 debian-7.7.0-powerpc-DVD-1.iso

    Therefore the sum of all filesizes in that directory would be about 8GB
    however I wanted an exact number for my own reasons.  The output from
    awk was floating point by default thus : 

# find ./Debian_resources -ls | \
> awk 'BEGIN{ ttl=0 }{ ttl+=$7 }END{ print ttl }'
8.61261e+09

    Therefore I tried integer output from awk using printf :
 
# find ./Debian_resources -ls | \
> awk 'BEGIN{ ttl=0 }{ ttl+=$7 }END{ printf ( "%12i\n", ttl ) }'
  2147483647

    Seems obviously wrong and familiar looking : 

# echo "2 31 ^ 1 - p q" | dc
2147483647

   * What was the outcome of this action?

    Integer output is limited to signed 32 bit however not overflow nor
    underflow. 


   * What outcome did you expect instead?

    I expected a precise sum of the filesizes from awk which is what I
    see with Solaris 10 servers.

*** End of the template - remove these lines ***


-- System Information:
Debian Release: 7.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mawk depends on:
ii  libc6  2.13-38+deb7u6

mawk recommends no packages.

mawk suggests no packages.

-- no debconf information


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

Reply via email to