[yast-commit] r52369 - in /branches/SuSE-Linux-11_0-Branch/backup: VERSION package/yast2-backup.changes src/scripts/backup_search.pl
Author: locilka Date: Mon Oct 20 16:17:08 2008 New Revision: 52369 URL: http://svn.opensuse.org/viewcvs/yast?rev=52369&view=rev Log: - Fixed storing the symlinks. - Correctly escaping shell commands (both bnc #421214). - 2.16.6 Modified: branches/SuSE-Linux-11_0-Branch/backup/VERSION branches/SuSE-Linux-11_0-Branch/backup/package/yast2-backup.changes branches/SuSE-Linux-11_0-Branch/backup/src/scripts/backup_search.pl Modified: branches/SuSE-Linux-11_0-Branch/backup/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/backup/VERSION?rev=52369&r1=52368&r2=52369&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/backup/VERSION (original) +++ branches/SuSE-Linux-11_0-Branch/backup/VERSION Mon Oct 20 16:17:08 2008 @@ -1 +1 @@ -2.16.5 +2.16.6 Modified: branches/SuSE-Linux-11_0-Branch/backup/package/yast2-backup.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/backup/package/yast2-backup.changes?rev=52369&r1=52368&r2=52369&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/backup/package/yast2-backup.changes (original) +++ branches/SuSE-Linux-11_0-Branch/backup/package/yast2-backup.changes Mon Oct 20 16:17:08 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Oct 20 16:13:27 CEST 2008 - locilka@suse.cz + +- Fixed storing the symlinks. +- Correctly escaping shell commands (both bnc #421214). +- 2.16.6 + +------------------------------------------------------------------- Mon May 19 09:43:11 CEST 2008 - locilka@suse.cz - Replacing Wizard::SetFocusToNextButton with UI::SetFocus which Modified: branches/SuSE-Linux-11_0-Branch/backup/src/scripts/backup_search.pl URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Linux-11_0-Branch/backup/src/scripts/backup_search.pl?rev=52369&r1=52368&r2=52369&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/backup/src/scripts/backup_search.pl (original) +++ branches/SuSE-Linux-11_0-Branch/backup/src/scripts/backup_search.pl Mon Oct 20 16:17:08 2008 @@ -219,6 +219,20 @@ my %package_files_inodes; my %dups; +# bnc #421214 +sub Quote ($) { + my $string = shift; + + if (not defined $string || $string eq "") { + return ''; + }; + + $string =~ s/\'/\'"\'"\'/g; + $string = '\''.$string.'\''; + + return $string; +} + # read list of all package's files if searching not owned files is required # or MD5 sum is not used in searching modified files if ($search_files or $no_md5) @@ -259,7 +273,7 @@ # TODO: this approach is not 100% reliable - a device can mounted after this check if ($same_fs) { - open(MOUNT, "/bin/mount |"); + open(MOUNT, "-|", "LC_ALL=C /bin/mount"); while (my $line = <MOUNT>) { @@ -319,7 +333,7 @@ sub ReadAllPackages() { # read all installed packages - open(RPMQA, "rpm -qa |") + open(RPMQA, "-|", "LC_ALL=C rpm -qa") or die "Command 'rpm -qa' failed\n"; print "Reading installed packages\n"; @@ -473,7 +487,7 @@ # check if Mtime changed file is in more than one package if ($mtime and !$size and $no_md5 and $$$refref_duplicates_file{$file}) { - open(RPMQFILE, "rpm -qf $file |"); + open(RPMQFILE, "-|", "LC_ALL=C rpm -qf ".Quote ($file)); my @packages_list = (); while (my $pkg = <RPMQFILE>) @@ -493,7 +507,7 @@ # so all files in package are verified # in this verification is not MD5 test excluded # TODO LATER: don't grep but cache results of all files from package - open(RPMVRF, "rpm -V $pack --nodeps | grep $file |"); + open(RPMVRF, "-|", "LC_ALL=C rpm -V ".Quote ($pack)." --nodeps | grep ".Quote ($file)); my $fl = <RPMVRF>; @@ -534,7 +548,7 @@ sub PrintOutInstPrefix ($) { my $package = shift; - my $rpm_query = 'LC_ALL=C rpm -q --queryformat "%{INSTPREFIXES}" '.$package; + my $rpm_query = 'LC_ALL=C rpm -q --queryformat "%{INSTPREFIXES}" '.Quote ($package); print "Installed: ".`$rpm_query`."\n"; } @@ -546,13 +560,14 @@ ### Printing out all unavailable packages and their content if (keys %{$unavail}) { - open(RPML, - 'LC_ALL=C '. - 'rpm -q --queryformat "FULL-PACKAGE-NAME: %{NAME}-%{VERSION}-%{RELEASE}\n" --filesbypkg '. - join(' ', (keys %{$unavail})). - ' |' - ) || do { - warn "Cannot run: ".'rpm -q --filesbypkg '.join(' ', (keys %{$unavail})).' |'; + my $command = ""; + foreach my $pack (keys %{$unavail}) { + $command .= ' '.Quote ($pack); + } + + $command = 'LC_ALL=C rpm -q --queryformat "FULL-PACKAGE-NAME: %{NAME}-%{VERSION}-%{RELEASE}\n" --filesbypkg '.$command; + open(RPML, "-|", $command) || do { + warn "Cannot run: ".$command; }; my $current_package_name = ''; while (my $l = <RPML>) { @@ -593,7 +608,7 @@ } # verification of the package - do not check package dependencies - open(RPMV, "LC_ALL=C rpm -V $package $md5_param --nodeps |") + open(RPMV, "-|", "LC_ALL=C rpm -V ".Quote ($package)." $md5_param --nodeps") or die "Verification of package $package failed."; while (my $line = <RPMV>) { @@ -615,7 +630,7 @@ my ($all_files, $pkg_inodes) = @_; my %duplicates; - open(RPMQAL, "rpm -qal |") + open(RPMQAL, "-|", "LC_ALL=C rpm -qal") or die "Command 'rpm -qal' failed\n"; if ($output_progress) @@ -661,12 +676,15 @@ { my ($filename) = @_; - open(RPMQFILE, 'rpm -qf '.$filename.' 2>/dev/null |'); + open(RPMQFILE, '-|', 'LANG=C rpm -qf '.Quote ($filename).' 2>/dev/null'); my $inpackage = 0; while (my $pkg = <RPMQFILE>) { - $inpackage = 1; + # bnc #421214, backup also symbolic links + if ( $pkg !~ /is not owned by any package$/ ) { + $inpackage = 1; + } } close(RPMQFILE); @@ -782,7 +800,7 @@ foreach my $fsys (@fs) { - open(MOUNTT, "export LC_ALL=C; mount -t $fsys |") + open(MOUNTT, "-|", "export LC_ALL=C; mount -t ".Quote ($fsys)) or next; while ($line = <MOUNTT>) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
locilka@svn.opensuse.org