summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2005-01-03 23:17:27 +0000
committerStew Benedict <stewb@mandriva.org>2005-01-03 23:17:27 +0000
commit7d9fcc1a41ba9779212bb9a1b594d0ff9be07a01 (patch)
tree20ac5646abca29589fb15aa00533138791bf8c0f
parent18aa8aba1f73c23d5cf890a149ee254237adea7b (diff)
downloaddrakx-backup-do-not-use-7d9fcc1a41ba9779212bb9a1b594d0ff9be07a01.tar
drakx-backup-do-not-use-7d9fcc1a41ba9779212bb9a1b594d0ff9be07a01.tar.gz
drakx-backup-do-not-use-7d9fcc1a41ba9779212bb9a1b594d0ff9be07a01.tar.bz2
drakx-backup-do-not-use-7d9fcc1a41ba9779212bb9a1b594d0ff9be07a01.tar.xz
drakx-backup-do-not-use-7d9fcc1a41ba9779212bb9a1b594d0ff9be07a01.zip
Bugzilla 12861 - Directories with spaces
Mandrakeclub - Perms too relaxed on tarballs perl_checker compliance
-rwxr-xr-xperl-install/standalone/drakbackup45
1 files changed, 26 insertions, 19 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup
index 958f54cc5..92d21061f 100755
--- a/perl-install/standalone/drakbackup
+++ b/perl-install/standalone/drakbackup
@@ -321,7 +321,7 @@ sub get_cd_info() {
print "{$key}->{dvdr} = $cd_devices{$key}{dvdr}\n";
print "{$key}->{dvdram} = $cd_devices{$key}{dvdram}\n";
} else {
- delete $cd_devices{$key} if $cd_devices{$key}{rec_dev} eq ''
+ delete $cd_devices{$key} if $cd_devices{$key}{rec_dev} eq '';
}
}
}
@@ -403,7 +403,7 @@ sub save_cron_files() {
system("chmod +x /etc/cron.$conf{DAEMON_TIME_SPACE}/drakbackup");
}
if ($conf{DAEMON_TIME_SPACE} eq "custom" || !$backup_daemon) {
- my $newdetail = join(" ", $time_string, $exec_string, "\n") if $backup_daemon;
+ my $newdetail = $backup_daemon && join(" ", $time_string, $exec_string, "\n");
system("crontab -l | tail +4 > $tmpcron");
my @cronlines = cat_($tmpcron);
my $index = 0;
@@ -411,7 +411,7 @@ sub save_cron_files() {
if (/$exec_string/) {
splice(@cronlines, $index, 1);
}
- $index++
+ $index++;
}
push(@cronlines, $newdetail) if $backup_daemon;
output($tmpcron, @cronlines);
@@ -1186,7 +1186,7 @@ sub build_backup_files() {
$catalog .= ":Users=(@user_list)" unless $conf{NO_USER_FILES};
$catalog .= ":I" if $conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES} && !$conf{USER_DIFFERENTIAL_BACKUPS};
$catalog .= ":D" if $conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES} && $conf{USER_DIFFERENTIAL_BACKUPS};
- $catalog .= ":F" if !$conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES};;
+ $catalog .= ":F" if !$conf{USER_INCREMENTAL_BACKUPS} && !$conf{NO_USER_FILES};
$catalog .= ":Other=(@other_files)" if $conf{OTHER_FILES};
$catalog .= ":I" if $conf{OTHER_INCREMENTAL_BACKUPS} && $conf{OTHER_FILES} && !$conf{OTHER_DIFFERENTIAL_BACKUPS};
$catalog .= ":D" if $conf{OTHER_INCREMENTAL_BACKUPS} && $conf{OTHER_FILES} && $conf{OTHER_DIFFERENTIAL_BACKUPS};
@@ -1253,6 +1253,8 @@ sub do_find {
#- $newer may be undef - if it's defined then "-cnewer $newer"
$newer = $conf{PATH_TO_SAVE} . "/" . $newer if defined($newer);
defined($newer) ? system("find @where -cnewer $newer $more_args > $into") : system("find @where $more_args > $into");
+ #- someone on club complained about perms being too open
+ chmod(0600, $into) if -e $into;
}
sub do_tar {
@@ -1260,6 +1262,8 @@ sub do_tar {
my $full_dest_file = $conf{PATH_TO_SAVE} . "/" . $dest_file . $the_time . "." . $conf{OPTION_COMP};
#- if $list_file is undefined, then use the @files list
defined($list_file) ? system("$tar_cmd -f $full_dest_file -T $list_file") : system("$tar_cmd -f $full_dest_file @files");
+ #- someone on club complained about perms being too open
+ chmod(0600, $full_dest_file) if -e $full_dest_file;
push_list($dest_file);
}
@@ -1276,6 +1280,7 @@ sub files_to_results {
$results .= "\nfile: " . $conf{PATH_TO_SAVE} . "/backup_" . $basename . $the_time . "." . $conf{OPTION_COMP} . "\n\n";
$results .= cat_("$conf{PATH_TO_SAVE}/list_" . $basename . $the_time . ".txt");
$results .= "\nignored:\n" . $ignore_files_list . "\n" if $ignore_files_list;
+
}
sub handle_ignores {
@@ -1372,6 +1377,8 @@ sub filedialog_generic {
$$widget->set_text($file_dialog->get_filename);
} else {
my $file_name = $file_dialog->get_filename;
+ #- catch files and dirs with spaces
+ $file_name = '"' . $file_name . '"' if $file_name =~ / /;
if (!member($file_name, @other_files)) {
push(@other_files, $file_name);
$list_model->append_set(undef, $file_name);
@@ -1797,7 +1804,7 @@ sub advanced_where_cd {
foreach ([$check_cdrw_erase, \$conf{MEDIA_ERASE}], [$check_dvdrw, \$conf{DVDRW}], [$check_dvdr, \$conf{DVDR}], [$check_dvdram, \$conf{DVDRAM}], [$check_multisession, \$conf{MULTI_SESSION}]) {
my $ref = $_->[1];
- gtksignal_connect(gtkset_active($_->[0], $$ref), toggled => sub { $$ref = $$ref ? 0 : 1 })
+ gtksignal_connect(gtkset_active($_->[0], $$ref), toggled => sub { $$ref = $$ref ? 0 : 1 });
}
gtksignal_connect(gtkset_active($check_where_cd, $conf{USE_CD}), toggled => sub {
$conf{USE_CD} = $conf{USE_CD} ? 0 : 1;
@@ -1959,7 +1966,7 @@ sub advanced_where_hd {
1, new Gtk2::VBox(0, 6),
0, gtkset_size_request(gtkset_sensitive($save_path_entry = new Gtk2::Entry(), $conf{USE_HD}), 152, 20),
0, gtkset_sensitive($button = gtksignal_connect(Gtk2::Button->new, clicked => sub {
- filedialog_generic(N("Directory to save to"), \$save_path_entry)
+ filedialog_generic(N("Directory to save to"), \$save_path_entry);
}), $conf{USE_HD}),
),
0, new Gtk2::VBox(0, 6),
@@ -2170,7 +2177,7 @@ sub advanced_when() {
advanced_when();
});
if ($custom_cron) {
- $entry_crontab->set_text("$time_string $exec_string")
+ $entry_crontab->set_text("$time_string $exec_string");
}
$combo_minute_when->entry->signal_connect('changed', sub { combo_to_cron_string($combo_minute_when->get_history - 1, 0) });
@@ -2286,7 +2293,7 @@ sub advanced_box() {
sub wizard_step3() {
destroy_widget();
- my $no_device = 1 if $conf{USE_CD} && $conf{CD_DEVICE} eq '' || $conf{USE_TAPE} && $conf{TAPE_DEVICE} eq '' || $conf{USE_NET} && $conf{NET_PROTO} eq '';
+ my $no_device = $conf{USE_CD} && $conf{CD_DEVICE} eq '' || $conf{USE_TAPE} && $conf{TAPE_DEVICE} eq '' || $conf{USE_NET} && $conf{NET_PROTO} eq '' && 1;
if ($no_device) {
show_warning("f", N("Backup destination not configured..."));
wizard_step2();
@@ -2427,7 +2434,7 @@ sub wizard() {
} else {
@user_list = ();
}
- })
+ });
}
if (!$conf{NO_SYS_FILES} || !$conf{NO_USER_FILES} && @user_list) {
fonction_env(\$box2, \&wizard, \&interactive_mode_box, \&wizard_step2);
@@ -2594,7 +2601,7 @@ sub select_user_data_to_restore() {
@user_list_to_restore = ();
local $_;
- -d $path_to_find_restore and my @list_backup_tmp2 = grep { /^backup/ } all($path_to_find_restore);
+ my @list_backup_tmp2 = -d $path_to_find_restore && grep { /^backup/ } all($path_to_find_restore);
@list_tmp2 = @list_backup_tmp2;
foreach (@list_backup_tmp2) {
s/_base//gi;
@@ -2975,7 +2982,7 @@ sub restore_step_user() {
if (!$check_user_to_restore{$name_complet}[1]) {
$check_user_to_restore{$name_complet}[1] = 1;
if (!any { /$name/ } @user_list_to_restore2) {
- push @user_list_to_restore2, $name_complet
+ push @user_list_to_restore2, $name_complet;
}
} else {
$check_user_to_restore{$name_complet}[1] = 0;
@@ -3100,7 +3107,7 @@ sub restore_step2() {
$sys_exist = 0; $restore_sys = 0;
}
if (any { /_user_/ } grep { /^$info_prefix/ } all("$restore_info_path/")) {
- $user_exist = 1
+ $user_exist = 1;
} else {
$user_exist = 0; $restore_user = 0;
}
@@ -3155,7 +3162,7 @@ sub restore_step2() {
} else {
$next_widget = \&restore_do;
}
- })
+ });
}
gtksignal_connect(gtkset_active($check_restore_other_path, $restore_other_path), toggled => sub {
$restore_other_path = $restore_other_path ? 0 : 1;
@@ -3235,7 +3242,7 @@ sub find_files_to_restore() {
chop;
$model->append_set($list_entry, [ 0 => $_, 1 => $unselected, 2 => 0 ]);
}
- $match = 1
+ $match = 1;
}
}
show_warning("i", N("No matches found...")) if $match == 0;
@@ -3425,7 +3432,7 @@ sub catalog_restore {
});
$button->add(gtkpack(new Gtk2::HBox(0,10), gtkcreate_img("ic82-dossier-32")));
button_box_restore();
- fonction_env(\$catalog_box, \&catalog_restore, \&restore_find_media_box, \&catalog_restore) if $call_method eq "need media";;
+ fonction_env(\$catalog_box, \&catalog_restore, \&restore_find_media_box, \&catalog_restore) if $call_method eq "need media";
fonction_env(\$catalog_box, \&catalog_restore, \&restore_box, \&catalog_restore) if $call_method eq "button";
$central_widget = \$catalog_box;
$up_box->show_all;
@@ -3768,7 +3775,7 @@ sub restore_box() {
1, new Gtk2::VBox(0,10),
1, gtksignal_connect(Gtk2::Button->new(N("Search for files to restore")), clicked => sub {
button_box_file_restore();
- find_files_to_restore()
+ find_files_to_restore();
}),
1, gtksignal_connect(Gtk2::Button->new(N("Restore all backups")), clicked => sub {
button_box_restore();
@@ -3776,7 +3783,7 @@ sub restore_box() {
$restore_sys = 1;
$restore_other = 1;
$restore_user = 1;
- restore_do()
+ restore_do();
}),
1, gtksignal_connect(Gtk2::Button->new(N("Custom Restore")), clicked => sub {
button_box_restore();
@@ -3793,7 +3800,7 @@ sub restore_box() {
);
} else {
destroy_widget();
- restore_find_media_box(),
+ restore_find_media_box();
}
fonction_env(\$box2, \&restore_box, \&interactive_mode_box);
$central_widget = \$box2;
@@ -3838,7 +3845,7 @@ sub restore_find_media_box() {
gtksignal_connect(Gtk2::Button->new(N("Search for files to restore")), clicked => sub {
$box2->destroy;
button_box_file_restore();
- find_files_to_restore()
+ find_files_to_restore();
}),
),
new Gtk2::VBox(0, 5),