Problem using -E option with paths containing spaces
Per Jensen <[email protected]>
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <[email protected]> |
All,
I have an issue making dar (I think) run a par2 script when the path to
the par2 script has spaces in directory names.
I have tried to make the issue clear using the -E option on the command
line, in the following.
This is part of work on my "dar-backup" scripts here:
https://github.com/per2jensen/dar-backup
I have a test case
(https://github.com/per2jensen/dar-backup/blob/main/test/test-path-with-spaces.sh),
that currently fails.
Any insights or pointers to issues in my setup is very much appreciated.
This works (using escaped spaces in path to the -E option):
==========================================
➜ ~/.local/bin/dar_static_2.7.4 -Q -c '/tmp/TEST_FULL_2022-04-11' -N -B
'/tmp/ abc/ def/dar-backup-test/bin/../backups.d/TEST' -E '/tmp/\ \
abc/\ \ \ def/dar-backup-test/bin/../conf/dar_par_create.duc "%p" "%b"
"%N" "%e" "%c" 5'
PAR2 started: "/tmp/ abc/
def/dar-backup-test/bin/../conf/dar_par_create.duc"
creating PAR file for file /tmp/TEST_FULL_2022-04-11.1.dar ...
--------------------------------------------
6 inode(s) saved
including 0 hard link(s) treated
0 inode(s) changed at the moment of the backup and could not be saved
properly
0 byte(s) have been wasted in the archive to resave changing files
0 inode(s) with only metadata changed
0 inode(s) not saved (no inode/file change)
0 inode(s) failed to be saved (filesystem error)
5 inode(s) ignored (excluded by filters)
0 inode(s) recorded as deleted from reference backup
--------------------------------------------
Total number of inode(s) considered: 11
--------------------------------------------
EA saved for 0 inode(s)
FSA saved for 6 inode(s)
--------------------------------------------
➜ ls -l /tmp/TEST_FULL_2022-04-11.1.dar*
-rw-rw-r-- 1 pj pj 654200 apr 11 15:19 /tmp/TEST_FULL_2022-04-11.1.dar
-rw-rw-r-- 1 pj pj 40324 apr 11 15:19 /tmp/TEST_FULL_2022-04-11.1.dar.par2
-rw-rw-r-- 1 pj pj 321244 apr 11 15:19
/tmp/TEST_FULL_2022-04-11.1.dar.vol000+100.par2
This does not work (a path with spaces in "" to the -E option):
================================================================
➜ ~/.local/bin/dar_static_2.7.4 -Q -c '/tmp/TEST_FULL_2022-04-11' -N -B
'/tmp/ abc/ def/dar-backup-test/bin/../backups.d/TEST' -E '/tmp/
abc/ def/dar-backup-test/bin/../conf/dar_par_create.duc "%p" "%b" "%N"
"%e" "%c" 5'
sh: 1: /tmp/: Permission denied
Final memory cleanup...
Aborting program. An error occurred concerning user command execution:
Fatal error on user command line: Ignore previous error on user command
line and continue ?
➜ ls -l '/tmp/ abc/ def/dar-backup-test/bin/../conf/dar_par_create.duc'
-rwxrwxr-x 1 pj pj 1081 apr 11 12:53 '/tmp/ abc/
def/dar-backup-test/bin/../conf/dar_par_create.duc'
File referenced from "-B" option
=================================
# Switch to ordered selection mode, which means that the following
# options will be considered top to bottom
-am
# Backup Root dir
-R "/tmp/ abc/ def/dar-backup-test/"
# Directories to backup below the Root dir
-g "dirs"
# Directories to exclude below the Root dir
-P "dirs/exclude this one"
# compression level
-z5
# no overwrite, if you rerun a backup, 'dar' halts and asks what to do
-n
# size of each slice in the archive
--slice 4G
# bypass directores marked as cache directories
# http://dar.linux.free.fr/doc/Features.html
--cache-directory-tagging
File referenced from "-E" option
==================================
#! /bin/bash
echo "PAR2 started: \"$0\""
if [ "$1" = "" -a "$2" = "" -a "$3" = "" -a "$4" = "" -a "$6" = "" ]; then
echo "usage: $0 <path> <basename> <slice number> <extension>
<context(not used)> <redundancy ratio (%)>"
echo "$0 builds Parchive redundancy file for the given slice"
exit 1
fi
# change according to you need
PAR=par2
echo "creating PAR file for file $1/$2.$3.dar ..."
exec "$PAR" c -r"$6" -n1 "$1/$2.$3.$4" >/dev/null 2>&1
Directory structure shown by "find":
=======================================
➜ find "/tmp/ abc/ def/dar-backup-test/"
/tmp/ abc/ def/dar-backup-test/
/tmp/ abc/ def/dar-backup-test/backups.d
/tmp/ abc/ def/dar-backup-test/backups.d/TEST
/tmp/ abc/ def/dar-backup-test/dirs
/tmp/ abc/ def/dar-backup-test/dirs/compressable
/tmp/ abc/ def/dar-backup-test/dirs/compressable/Lorem Ipsum.txt
/tmp/ abc/ def/dar-backup-test/dirs/exclude this one
/tmp/ abc/ def/dar-backup-test/dirs/exclude this one/In exclude dir.txt
/tmp/ abc/ def/dar-backup-test/dirs/include this one
/tmp/ abc/ def/dar-backup-test/dirs/include this one/Krummi.JPG
/tmp/ abc/ def/dar-backup-test/dirs/include this one/Abe.jpg
/tmp/ abc/ def/dar-backup-test/bin
/tmp/ abc/ def/dar-backup-test/bin/ls-archives.sh
/tmp/ abc/ def/dar-backup-test/bin/dar-backup.sh
/tmp/ abc/ def/dar-backup-test/bin/dar-util.sh
/tmp/ abc/ def/dar-backup-test/bin/install.sh
/tmp/ abc/ def/dar-backup-test/bin/dar-diff-backup.sh
/tmp/ abc/ def/dar-backup-test/bin/show-FULL.sh
/tmp/ abc/ def/dar-backup-test/bin/show-DIFF.sh
/tmp/ abc/ def/dar-backup-test/bin/dar-inc-backup.sh
/tmp/ abc/ def/dar-backup-test/FULL-filelist.txt
/tmp/ abc/ def/dar-backup-test/conf
/tmp/ abc/ def/dar-backup-test/conf/dar_par_create.duc
/tmp/ abc/ def/dar-backup-test/conf/dar_par_test.duc
/tmp/ abc/ def/dar-backup-test/conf/dar-backup.conf
/tmp/ abc/ def/dar-backup-test/conf/dar_par.dcf