From 70942e1fef37d8661b0a0f4d4ed1612dc6574455 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 28 Apr 2020 10:55:48 +0200 Subject: silent rpm --version during installation/removal Calling "LC_ALL=C rpm --version" from urpm::install::install_logger() sometimes causes the following to be displayed when using --urpmi-root: "shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory" Typically, we run into: chdir("/") = 0 chroot("/home/tv/mga/pkgs/RPM/perl-URPM/mga7/") = 0 (...) clone() execve("/bin/sh", ["sh", "-c", "LC_ALL=C rpm --version"], ... getcwd("(unreachable)/", 4095) = 15 So just caches the rpm version prior to the first transaction and voila --- urpm/install.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'urpm') diff --git a/urpm/install.pm b/urpm/install.pm index 0e4cd81b..174291c7 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -94,7 +94,7 @@ See L for parameters =cut # install logger callback -my ($erase_logger, $index, $total_pkg, $uninst_count, $current_pkg); +my ($erase_logger, $index, $total_pkg, $uninst_count, $current_pkg, $rpm_version); sub install_logger { my ($urpm, $type, undef, $subtype, $amount, $total) = @_; local $| = 1; @@ -121,7 +121,7 @@ sub install_logger { $cnt = $pname ? $urpm->{logger_count} : '-'; } require urpm::select; - $index++ if urpm::select::_rpm_version() lt 4.13.0; + $index++ if $rpm_version lt 4.13.0; my $s = sprintf("%9s: %-22s", $cnt . "/" . $total_pkg, $pname); print $s; $s =~ / $/ or printf "\n%9s %-22s", '', ''; @@ -377,6 +377,7 @@ sub install { } elsif (!$options{noorder} && (@errors = $trans->order(%options))) { } else { $urpm->{readmes} = {}; + $rpm_version ||= urpm::select::_rpm_version(); _get_callbacks($urpm, $db, $trans, \%options, $install, $upgrade, scalar @trans_pkgs); -- cgit v1.2.1