Actions
Bug #1919
closedPackage re-install loop on console after upgrade - package reinstall take ages on serial console
Status:
Resolved
Priority:
High
Assignee:
-
Category:
Upgrade
Target version:
-
Start date:
09/29/2011
Due date:
% Done:
0%
Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.0
Affected Architecture:
All
Description
In fact, this is not an actual loop.... it's rather an innefiency in update_output_window() when $pkg_interface == "console".
The text is being output to the console, but the variable $static_output is still accumulating text, so update_output_window only prints repeated text, with some additions on every calls. That simply square the amount of character being sent to the console. On a 9600 link... reinstalling squid/squidguard packages takes more than an hour!
My fix is simple, but very ackward on the programming style. I added $static_output as a global variable, and then I clear its content after the "echo":
function update_output_window($text) { global $pkg_interface, $static_output; $log = ereg_replace("\n", "\\n", $text); if($pkg_interface != "console") { echo "\n<script language=\"JavaScript\">\nthis.document.forms[0].output.value = \"" . $log . "\";\n"; echo "this.document.forms[0].output.scrollTop = this.document.forms[0].output.scrollHeight;\n"; echo "</script>"; } else { echo $text; $static_output=""; } /* ensure that contents are written out */ ob_flush(); }
Actions