首页 > 科技 > Fix P1 bug in AA system

Fix P1 bug in AA system

2006年10月18日 20点50分 发表评论 阅读评论

It took me about two days on fixing a P1 bug in AA system. I did not debug programs before, especally the AA is a very large program. In the fixing process, I stared on the code, and asked for help from other engineers, try to add debug information into code. Though I failed again and again, but I feel it was more nearly to the success, because, at least I known what would happen and who could make effect through all the failure.

First, know the actual factor the debugs describes, you’d better do it by yourself, it would be very benifit for your understanding the trouble. Second, try to locate which program would be the target debuged, in this case, Bruce told me to focus on “/bin/SYS_INSTALLSTARTOS”, and thanks for Sam’s advice, I watch on the “/webui/software/update.cgi” as the target which is proved to be right choice. In the “update.cgi”. I put many “print” and “echo” lines to collect the returned values created by the program running.

The issue is, the GUI hang or has no information when the patch is installed. Using the original “update.cgi”, the patch would be installed successfully without error, but the last screen has not inforamtion said the operating status, as normaly, there would be some lines messages said the patch was installed successfully and reboot the system. Other way, if I comment some lines, the successfully information displayed. but in fact, the patch is not installed which is proved by issueing “rpm -qa | grep UDO”.

In the first way, I found the XML parser seemed hang, so I commented these XML lines and added the “reboot” and “pre_err_message” returned from the second way, yes, the program would run well, install the patch and display successfully information. But it could not be considered as the final resolution.

I watched the code again, very carefully, and found other XML function which executes without hang, How do I use this XML formation to instead the trouble one? Just modify the trouble ones as the precious, remove the strings “>>INSTALL_LOG”. Yeah! I got it! The update.cgi runs well as what I want.

Summary, partience is the most important thing, and more carefully debug tracing. Nothing is difficult if put all heart on it, or nothing is easy if always thinks it’s too hard to do it.

The following is some modified part of the “update.cgi”source code:
Precious XML:
my $xml_out = `$config{‘update_system_cmd’} $install_file 0 pre_install 2>/dev/null`;
# Get parameter from XML input
my $parser = new XML::DOM::Parser;
my $doc = $parser->parse($xml_out);
my $pre_msg = &xml_in($doc, “pre_msg”, 0);
my $force_install_flag = 0;

Second XML(also my target):
my $cmd_out = `$config{‘update_system_cmd’} $install_file $force_install install 2>/dev/null`;
# ori: my $cmd_out = `$config{‘update_system_cmd’} $install_file $forceinstall install >> INSTALL_LOG 2>/dev/null`
$errnum = $?;
# Get parameter from XML input
my $parser = new XML::DOM::Parser;
my $doc = $parser->parse($cmd_out); # even confuse here
$patch_extra_msg = &xml_in($doc, “err_msg”, 0);
$reboot = &xml_in($doc, “need_reboot”, 0);
Summary, the term “INSTALL_LOG” makes the code confused and XML parser not work.

分类: 科技 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
您必须在 登录 后才能发布评论.