Package: dput Version: 0.9.2.37 Severity: minor Tags: patch Hi,
dput loads the whole file into RAM when generating the checksum. This causes problems with large files (e.g. my local package for Mathematica). The attached patch makes dput read the file in smaller chunks (currently 64k) instead. Memory usage was reduced from over 700MB to approx 4.5MB :) Note: I'm not familar with Python and the while(1)-loop with break condition inside does not look very elegant to me, but I didn't find another way to read a file in chunks. Regards, Ansgar -- System Information: Debian Release: 5.0 APT prefers testing APT policy: (900, 'testing'), (600, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages dput depends on: ii gnupg 1.4.9-3 GNU privacy guard - a free PGP rep ii python 2.5.2-3 An interactive high-level object-o dput recommends no packages. Versions of packages dput suggests: ii lintian 2.2.2 Debian package checker ii mini-dinstall 0.6.25 daemon for updating Debian package ii openssh-client 1:5.1p1-5 secure shell client, an rlogin/rsh ii rsync 3.0.3-2 fast remote file copy program (lik -- no debconf information
>From 9bdfcf6f3e8cd7ba6f018b82898a409c2076448f Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt <ans...@2008.43-1.org> Date: Sat, 7 Feb 2009 00:02:09 +0100 Subject: [PATCH] Read files in small chunks when generating checksum dput would read the whole file into RAM when generating the checksum. This patch makes it read the file in smaller chunks instead. Signed-off-by: Ansgar Burchardt <ans...@2008.43-1.org> --- dput | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dput b/dput index 076df06..f56b505 100755 --- a/dput +++ b/dput @@ -174,8 +174,10 @@ def checksum_test(filename,hash): check_obj = hash_type.new() - for line in file_to_test.readlines(): - check_obj.update(line) + while 1: + data = file_to_test.read(65536) + if len(data) == 0: break + check_obj.update(data) file_to_test.close() checksum = hexify_string(check_obj.digest()) -- 1.5.6.5