Bug #2643

restore-data-duplicity action fails with whitespaces

Added by Massimo Palazzetti almost 6 years ago. Updated almost 6 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:v6.5-rc1
Security class: Resolution:
Affected version:v6.4-beta2 NEEDINFO:No

Description

The action restore-data-duplicity action fails if the path contains whitespace characters:

    # /etc/e-smith/events/actions/restore-data-duplicity /tmp "var/lib/nethserver/ibay/condivisage/SUB PATH/Martin Smith" 
    # echo $?
1
    # cat /var/log/restore.log
Command line error: Expected 2 args, got 6
Enter 'duplicity --help' for help screen.

Package:
nethserver-backup-data-1.0.7-1.ns6.noarch

Associated revisions

Revision 6eedf0ae
Added by Giacomo Sanchietti almost 6 years ago

Restore: handle restoring files with whitespaces. Refs #2643

History

#1 Updated by Davide Principi almost 6 years ago

  • Affected version set to v6.4-beta2

The spaces are not quoted when duplicity is called from Perl code: I've tried to add some quotes (reverse patch):

--- /etc/e-smith/events/actions/restore-data-duplicity  2014-01-31 17:27:40.959345064 +0000
+++ /etc/e-smith/events/actions/restore-data-duplicity.orig     2014-01-31 17:23:00.924301856 +0000
@@ -71,9 +70,9 @@
     foreach (@files) {
         $cmd = CMD." restore $opts ";
         if ($position eq "/") {
-            $cmd .= " --force --file-to-restore '$_' $src /'$_'";
+            $cmd .= " --force --file-to-restore $_ $src /$_";
         } else {
-            $cmd .= " --file-to-restore '$_' $src $position/'$_'";
+            $cmd .= " --file-to-restore $_ $src $position/$_";
         }
         $ret += system("$cmd &>>$logFile");
     }

Maybe we have to rework the code so that system() is invoked with a list of arguments instead of using an interpolated string.

#2 Updated by Davide Principi almost 6 years ago

  • Target version set to v6.5-rc1

#3 Updated by Giacomo Sanchietti almost 6 years ago

  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

#4 Updated by Giacomo Sanchietti almost 6 years ago

  • Status changed from TRIAGED to ON_DEV
  • % Done changed from 20 to 30

#5 Updated by Giacomo Sanchietti almost 6 years ago

  • Assignee set to Giacomo Sanchietti

Proposed patch is reversed.

#6 Updated by Giacomo Sanchietti almost 6 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 60

Implemented using the proposed patch.

#7 Updated by Giacomo Sanchietti almost 6 years ago

  • Status changed from MODIFIED to ON_QA
  • Assignee deleted (Giacomo Sanchietti)
  • % Done changed from 60 to 70
Packages in nethserver-testing:
  • nethserver-backup-data-1.0.8-1.0git6eedf0ae.ns6.noarch.rpm
Test case
  • Configure the backup
  • Create a file with name in spaces and start the backup:
    echo "goofy" >  "/var/lib/nethserver/home/admin/file with spaces" 
    backup-data
    
  • Try to restore the file:
    /etc/e-smith/events/actions/mount-cifs
    mkdir -p /tmp//var/lib/nethserver/home/admin
    /etc/e-smith/events/actions/restore-data-duplicity /tmp "var/lib/nethserver/home/admin/file with spaces" 
    /etc/e-smith/events/actions/umount-cifs
    
  • Verifiy the file is presente in /tmp/var/lib/nethserver/home/admin/

#8 Updated by Alessio Fattorini almost 6 years ago

  • Assignee set to Alessio Fattorini

#9 Updated by Alessio Fattorini almost 6 years ago

  • Status changed from ON_QA to VERIFIED
  • % Done changed from 70 to 90
# rpm -q nethserver-backup-data
nethserver-backup-data-1.0.8-2.0gitdb6d4e2e.ns6.noarch
[root@botolo ~]# echo "goofy" >  "/var/lib/nethserver/home/admin/file with spaces" 
[root@botolo ~]# backup-data
[root@botolo ~]# /etc/e-smith/events/actions/mount-cifs
[root@botolo ~]# mkdir -p /tmp//var/lib/nethserver/home/admin
[root@botolo ~]# /etc/e-smith/events/actions/restore-data-duplicity /tmp "var/lib/nethserver/home/admin/file with spaces" 
[root@botolo ~]# ll /tmp/var/lib/nethserver/home/admin
totale 4
-rw-r--r--. 1 root root 6 20 feb 15:04 file with spaces
[root@botolo ~]# /etc/e-smith/events/actions/umount-cifs

VERIFIED

#10 Updated by Alessio Fattorini almost 6 years ago

  • Assignee deleted (Alessio Fattorini)

#11 Updated by Davide Principi almost 6 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100

#12 Updated by Davide Principi almost 6 years ago

In nethserver-updates:
nethserver-release-6.5-4.ns6.rc1.noarch.rpm
nethserver-devbox-1.4.0-1.ns6.noarch.rpm
nethserver-backup-data-1.0.9-1.ns6.noarch.rpm
nethserver-base-2.1.0-1.ns6.noarch.rpm
nethserver-directory-2.0.1-1.ns6.noarch.rpm
nethserver-firewall-base-1.1.0-1.ns6.noarch.rpm
nethserver-hosts-1.0.7-1.ns6.noarch.rpm
nethserver-httpd-2.3.0-1.ns6.noarch.rpm
nethserver-httpd-admin-1.2.1-1.ns6.noarch.rpm
nethserver-hylafax-1.0.5-1.ns6.noarch.rpm
nethserver-ibays-2.0.3-1.ns6.noarch.rpm
nethserver-lib-2.0.1-1.ns6.noarch.rpm
nethserver-mail-server-1.6.1-1.ns6.noarch.rpm
nethserver-nethgui-1.4.0-1.ns6.noarch.rpm
nethserver-ntopng-1.1.2-1.ns6.noarch.rpm
nethserver-nut-1.0.7-1.ns6.noarch.rpm
nethserver-openssh-1.0.5-1.ns6.noarch.rpm
nethserver-roundcubemail-0.0.2-1.ns6.noarch.rpm
nethserver-samba-1.4.2-1.ns6.noarch.rpm
nethserver-shorewall-1.0.4-1.ns6.noarch.rpm
nethserver-sogo-thunderbird-1.1.1-1.ns6.noarch.rpm
nethserver-vpn-1.1.2-1.ns6.noarch.rpm
sogo-frontends-1.3.0-1.ns6.noarch.rpm

Also available in: Atom PDF