From 4c624dd04f1a427793a77d2b497a96daf9fd8709 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Fri, 26 Mar 2010 15:11:43 +0100 Subject: [PATCH] Collect at most 10K lines of rpm output. (bnc#565126) --- zypp/target/rpm/RpmDb.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/zypp/target/rpm/RpmDb.cc b/zypp/target/rpm/RpmDb.cc index 84d3f75..a6e33da 100644 --- a/zypp/target/rpm/RpmDb.cc +++ b/zypp/target/rpm/RpmDb.cc @@ -52,6 +52,7 @@ using namespace zypp::filesystem; #define WARNINGMAILPATH "/var/log/YaST2/" #define FILEFORBACKUPFILES "YaSTBackupModifiedFiles" +#define MAXRPMMESSAGELINES 10000 namespace zypp { @@ -1717,10 +1718,15 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal string line; string rpmmsg; vector configwarnings; - vector errorlines; + unsigned linecnt = 0; while (systemReadLine(line)) { + if ( linecnt < MAXRPMMESSAGELINES ) + ++linecnt; + else + continue; + if (line.substr(0,2)=="%%") { int percent; @@ -1735,6 +1741,9 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal configwarnings.push_back(line); } } + if ( linecnt > MAXRPMMESSAGELINES ) + rpmmsg += "[truncated]\n"; + int rpm_status = systemStatus(); // evaluate result @@ -1887,10 +1896,17 @@ void RpmDb::doRemovePackage( const string & name_r, RpmInstFlags flags, callback // 50 - command completed // 100 if no error report->progress( 5 ); + unsigned linecnt = 0; while (systemReadLine(line)) { + if ( linecnt < MAXRPMMESSAGELINES ) + ++linecnt; + else + continue; rpmmsg += line+'\n'; } + if ( linecnt > MAXRPMMESSAGELINES ) + rpmmsg += "[truncated]\n"; report->progress( 50 ); int rpm_status = systemStatus(); -- 2.7.4