From 2f287b8c7ac8766071a6e2cbe0dcfb75f07386f9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 14 Dec 2005 10:23:16 +0000 Subject: fix handling absolute binary in chroot (and add some comment about the usefulness of catching program not found early) --- perl-install/run_program.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm index c6eb456b8..042f4883e 100644 --- a/perl-install/run_program.pm +++ b/perl-install/run_program.pm @@ -62,8 +62,11 @@ sub raw { my $stdout = $stdout_raw && (ref($stdout_raw) ? $tmpdir->() . "/.drakx-stdout.$$" : "$root$stdout_raw"); my $stderr = $stderr_raw && (ref($stderr_raw) ? $tmpdir->() . "/.drakx-stderr.$$" : "$root$stderr_raw"); - my ($rname) = split(/[ \|]/, $real_name, 2); - if (! ($rname =~ m!^/! ? -x $rname : whereis_binary($rname, $root))) { + #- checking if binary exist to avoid cloberring stdout file + my ($rname) = $real_name =~ /(.*)[\s\|]/; + if (! ($rname =~ m!^/! + ? -x "$root$rname" || $root && -l "$root$rname" #- handle non-relative symlink which can be broken when non-rooted + : whereis_binary($rname, $root))) { log::l("program not found: $real_name"); return; } -- cgit v1.2.1