Rafael, Thanks for the patch #24704.
Now I will describe shortly a problem that you had with Fedora with SELinux in strict mode + mrtg + FindBin. When the mrtg cron job runs under the SELinux strict policy (this problem doesn't occur with the targeted policy), it runs in a restricted domain that doesn't allow acces to the root homedir (the cron job uses the root account). When this happen the variable $Bin (and $RealBin) becomes undefined due to the getcwd call inside abs_path() $Bin = abs_path($Bin) if($Bin) I wondered if it would be possible to also the following patch to FindBin.pm? ---------- diff -ruN perl-5.8.6-orig/lib/FindBin.pm perl-5.8.6/lib/FindBin.pm --- perl-5.8.6-orig/lib/FindBin.pm 2003-12-27 14:52:04.000000000 +0000 +++ perl-5.8.6/lib/FindBin.pm 2005-05-16 04:15:54.000000000 +0100 @@ -179,7 +179,12 @@ } # Get absolute paths to directories - $Bin = abs_path($Bin) if($Bin); + if ($Bin) + { + my $BinOld = $Bin; + $Bin = abs_path($Bin); + defined $Bin or $Bin = File::Spec->canonpath($BinOld); + } $RealBin = abs_path($RealBin) if($RealBin); } } ---------- The correct solution to the problem described should be done by changing the SELinux policy, or by running the cron job with a restricted account (not root). But this problem also triggered a potential problem in FindBin - it could avoid undefining the variable $Bin. A more information is available in the RedHat bugzilla tickets listed in the references (below). Thanks in advance, jpo References: [1] Bugzilla Bug 127023 – perl fails "lib/FindBin" test (breaks MRTG) https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=127023 [2] Bugzilla Bug 118877 – MRTG fails to run from cron. https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=118877 [3] FindBin patch (SELinux related) - attachmed to comment #37 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=127023#c37 > José Pedro Oliveira wrote: > >>Shouldn't the code in the FindBin.pm patches #24375 and #24379 be >>also applied to the true block of "if($0 eq '-e' || $0 eq '-')" ? >> >>---------- >>--- FindBin.pm.145 2005-05-03 13:46:43.000000000 +0100 >>+++ FindBin.pm 2005-05-12 20:20:22.000000000 +0100 >>@@ -113,8 +113,11 @@ >> { >> # perl invoked with -e or script is on C<STDIN> >> >>+ my $cwd = getcwd(); >>+ defined $cwd or $cwd = cwd(); # try harder >>+ >> $Script = $RealScript = $0; >>- $Bin = $RealBin = getcwd(); >>+ $Bin = $RealBin = $cwd; > > > Thanks, I implemented this as change #24704 (factorizing the above code > in its own function.) jpo -- José Pedro Oliveira * mailto: [EMAIL PROTECTED] * http://gsd.di.uminho.pt/~jpo * * gpg fingerprint = F9B6 8D87 859D 1C94 48F0 84C0 9749 9EB5 91BD 851B * http://conferences.yapceurope.org/2005/ * http://braga.yapceurope.org/
signature.asc
Description: OpenPGP digital signature