From b8a40dfe16ec444250942e9309ea34146020213e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 1 Oct 2007 17:28:47 +0100 Subject: [PATCH] * adt-testreport-onepackage: limit log to 64K (32K head, 32K tail) to avoid humungous bug reports which LP silently discards. --- debian/changelog | 4 +++- runner/adt-testreport-onepackage | 34 ++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index f240b54..73f9641 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,8 +13,10 @@ autopkgtest (1.0.9) unstable; urgency=low * adt-testreport-onepackage: skip emails if _source_ is suppresed. * adt-testreport-onepackage etc.: new blacklist feature, and initially blacklist ltsp-client{,-core}. + * adt-testreport-onepackage: limit log to 64K (32K head, 32K tail) + to avoid humungous bug reports which LP silently discards. - -- + -- autopkgtest (1.0.8) gutsy; urgency=low diff --git a/runner/adt-testreport-onepackage b/runner/adt-testreport-onepackage index 87d33a7..b0f138b 100755 --- a/runner/adt-testreport-onepackage +++ b/runner/adt-testreport-onepackage @@ -11,6 +11,8 @@ interactive=true target=source suppressrepeatedemails=false arch=`dpkg --print-architecture` +logheadmaxbytes=32768 +logtailmaxbytes=32768 for config in "$@"; do case "$config" in @@ -428,10 +430,10 @@ END esac cat >>"$tmp/_email" <"$tmp"/_log -pe ' +perl <"$tmp"/_log_raw >"$tmp"/_log -ne ' s/[^\012\040-\133\135-\176]/ $& eq "\t" ? "\\t" : $& eq "\r" ? "\\r" : $& eq "\b" ? "\\b" : $& eq "\\" ? "\\\\" : sprintf "\\x%02x", ord $& - /ge' + /ge; + + if (!$middle) { + $headlen += length; + $middle=1 if $headlen > '"$logheadmaxbytes"'; + } + if (!$middle) { + print or die $!; + } else { + $taillen += length; + push @tail, $_; + while ($taillen > '"$logtailmaxbytes"') { + $taillen -= length shift @tail; + $some_dropped= 1; + } + } + END { + print "...\n" or die $! if $some_dropped; + print @tail or die $!; + } +' if [ "x$email" = x ]; then if $interactive; then -- 2.30.2