diff options
author | Stew Benedict <stewb@mandriva.org> | 2005-01-03 23:09:49 +0000 |
---|---|---|
committer | Stew Benedict <stewb@mandriva.org> | 2005-01-03 23:09:49 +0000 |
commit | 369349c6aba61faf98aee168e7981a4d5dce2d4b (patch) | |
tree | b9039f4909cc046932cf044975cc0b1d4be1b99b | |
parent | 0e870978d5e587f0dd155c2f7ceaff2db1898365 (diff) | |
download | drakx-backup-do-not-use-369349c6aba61faf98aee168e7981a4d5dce2d4b.tar drakx-backup-do-not-use-369349c6aba61faf98aee168e7981a4d5dce2d4b.tar.gz drakx-backup-do-not-use-369349c6aba61faf98aee168e7981a4d5dce2d4b.tar.bz2 drakx-backup-do-not-use-369349c6aba61faf98aee168e7981a4d5dce2d4b.tar.xz drakx-backup-do-not-use-369349c6aba61faf98aee168e7981a4d5dce2d4b.zip |
Bugzilla 12861 - Directories with spaces
Mandrakeclub - Perms too relaxed on tarballs
perl_checker compliance
-rwxr-xr-x | perl-install/standalone/drakbackup | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup index 14ca93f9c..f92f48803 100755 --- a/perl-install/standalone/drakbackup +++ b/perl-install/standalone/drakbackup @@ -308,7 +308,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 ''; } } } @@ -390,7 +390,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; @@ -398,7 +398,7 @@ sub save_cron_files() { if (/$exec_string/) { splice(@cronlines, $index, 1); } - $index++ + $index++; } push(@cronlines, $newdetail) if $backup_daemon; output($tmpcron, @cronlines); @@ -1182,7 +1182,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}; @@ -1249,6 +1249,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 { @@ -1261,6 +1263,8 @@ sub do_tar { #- 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); } @@ -1281,6 +1285,7 @@ sub files_to_results { $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 { @@ -1377,6 +1382,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(0, $file_name); @@ -1795,7 +1802,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; @@ -1963,7 +1970,7 @@ sub advanced_where_hd { 1, Gtk2::VBox->new(0, 6), 0, gtkset_size_request(gtkset_sensitive($save_path_entry = Gtk2::Entry->new, $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, Gtk2::VBox->new(0, 6), @@ -2018,7 +2025,7 @@ sub advanced_where() { }), 1, gtksignal_connect(my $button_where_tape = Gtk2::Button->new, clicked => sub { destroy_widget(); - advanced_where_tape(undef) + advanced_where_tape(undef); }), 1, Gtk2::VBox->new(0, 5), ), @@ -2167,7 +2174,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_text - 1, 0) }); @@ -2281,7 +2288,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...")); advanced_where_net_types(\&wizard_step2) if $conf{USE_NET}; @@ -2408,7 +2415,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); @@ -2573,7 +2580,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; @@ -2954,7 +2961,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; @@ -3077,7 +3084,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; } @@ -3132,7 +3139,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; @@ -3211,7 +3218,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; @@ -3401,7 +3408,7 @@ sub catalog_restore { }); $button->add(gtkpack(Gtk2::HBox->new(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; @@ -3764,7 +3771,7 @@ sub restore_box() { 1, Gtk2::VBox->new(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(); @@ -3772,7 +3779,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(); @@ -3789,7 +3796,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; @@ -3834,7 +3841,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(); }), ), Gtk2::VBox->new(0, 5), |