From f15530f4457b380907c1cf9bcfad1798a7a53e2f Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Tue, 26 Apr 2016 07:07:56 +0000 Subject: [PATCH] 98_backup.pm: Patch by Johannes for filenames with space (Forum #52660) git-svn-id: https://svn.fhem.de/fhem/trunk@11313 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_backup.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/98_backup.pm b/fhem/FHEM/98_backup.pm index a679132f0..560a2f37a 100644 --- a/fhem/FHEM/98_backup.pm +++ b/fhem/FHEM/98_backup.pm @@ -49,8 +49,8 @@ CommandBackup($$) my ($cl, $param) = @_; my $modpath = $attr{global}{modpath}; - my $configfile = AttrVal("global", "configfile", undef); - my $statefile = AttrVal("global", "statefile", undef); + my $configfile = AttrVal("global", "configfile", ""); + my $statefile = AttrVal("global", "statefile", ""); my $msg; my $ret; @@ -90,7 +90,7 @@ CommandBackup($$) push @pathname, $configfile; Log 4, "backup include: '$configfile'"; $ret = parseConfig($configfile); - push @pathname, $statefile; + push @pathname, $statefile if($statefile); Log 4, "backup include: '$statefile'"; } $ret = readModpath($modpath,$backupdir); @@ -172,6 +172,8 @@ createArchiv($$) $dateTime =~ s/ /_/g; $dateTime =~ s/(:|-)//g; + my $pathlist = join( "\" \"", @pathname ); + my $cmd=""; if (!defined($backupcmd)) { if (lc($symlink) eq "no") { @@ -181,10 +183,10 @@ createArchiv($$) } # prevents tar's output of "Removing leading /" and return total bytes of archive - $cmd = "tar -$tarOpts - @pathname |gzip > $backupdir/FHEM-$dateTime.tar.gz"; + $cmd = "tar -$tarOpts - \"$pathlist\" |gzip > $backupdir/FHEM-$dateTime.tar.gz"; } else { - $cmd = "$backupcmd \"@pathname\""; + $cmd = "$backupcmd \"$pathlist\""; } Log 2, "Backup with command: $cmd";