From: <jam...@te...> - 2002-06-21 19:26:52
|
Hi All, I found a bug in the fsdump module on RH 7.3 (it could have been in other places). If you added a new backup or changed an existing one such that instead of using file or tape to backup to you instead choose to backup to host., as soon as you saved your changes the following would appear: HTTP/1.0 500 Perl execution failed Server: MiniServ/0.01 Date: Fri, 21 Jun 2002 19:04:52 GMT Content-type: text/html Connection: close Error - Perl execution failed Can't use an undefined value as a HASH reference at redhat-linux-lib.pl line 255. Note line number is different than the original error as I added some debug code to figure out what was going on. The config I created that was causing this problem was as follows: weekdays=* update=0 huser=joden3 months=* host=nsdlinux07 days=* fs=ext3 level=2 hfile=t.tgz dir=/root/tmp hours=0 mins=0 multi=0 id=110131024684666 enabled=0 label= email= Anyway, I fixed and have placed the patch at the end of my email. It was appearantly dying on the following lines in dump_dest() in redhat-linux-lib.pl: if ($_[0]->{'file'}) { Now if you look at the function and look at the error message you might think that some how a reference to a has was not passed into the function. That was not the case. The hash simply did not have the element 'file'. Perl is normally supposed to return undef in this case, but for some reason it was puking and dying. My solution was to explicitly set $_[0] to a lexically scoped variable and use that variable instead. Here is the patch: *** redhat-linux-lib.pl Fri Jun 21 15:13:59 2002 --- redhat-linux-lib.pl.orig Fri Jun 21 14:54:52 2002 *************** *** 244,264 **** # dump_dest(&dump) sub dump_dest { ! my $dump_data = shift; ! ! if(!ref($dump_data)) { ! return "<B>Error Call to dump_dest() in redhat-linux-lib.pl with invalid arguments!</B>"; ! } ! if ($dump_data->{'file'}) { ! return "<tt>".&html_escape($dump_data->{'file'})."</tt>"; } elsif ($_[0]->{'huser'}) { ! return "<tt>" . &html_escape($dump_data->{'huser'} . '@' . ! $dumpdata->{'host'} . ':' . $dump_data->{'hfile'}) . "</tt>"; } else { ! return "<tt>" . &html_escape($dump_data->{'host'} . ':' . ! $dump_data->{'hfile'}) . "</tt>"; } } --- 244,257 ---- # dump_dest(&dump) sub dump_dest { ! if ($_[0]->{'file'}) { ! return "<tt>".&html_escape($_[0]->{'file'})."</tt>"; } elsif ($_[0]->{'huser'}) { ! return "<tt>".&html_escape("$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>"; } else { ! return "<tt>".&html_escape("$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>"; } } Cheers...james |