Re: [Dar-support] Problem using -E option with paths containing spaces
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Per J. <per...@gm...> - 2022-04-12 05:58:17
|
Hi Denis,
Many thanks for you very thorough answer, much appreciated. I will
dabble more with different kinds of quoting to get it working :-)
Best regards
Per
Den 11.04.2022 kl. 22.50 skrev Denis Corbin:
> Le 11/04/2022 à 15:43, Per Jensen a écrit :
>> All,
>
> Hi Per,
>
>>
>> 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 tried this simple test:
>
> cd /tmp
> mkdir "With Space"
> cp /bin/ls With\ Space
> dar -c test -s 1M -E '/tmp/With\ Space/ls %p/%b.%N.%e' -N
> Warning: using insecure memory!
> /tmp/test.1.dar
> /tmp/test.2.dar
> /tmp/test.3.dar
> /tmp/test.4.dar
> /tmp/test.5.dar
> /tmp/test.6.dar
> /tmp/test.7.dar
> /tmp/test.8.dar
> [...]
>
> so to my point of view, there does not seem to be any problem when the
> path given to -E option contains space.
>
> [...]
>
>> 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 ...
>
>
> You have to take into account that the command you type on the shell
> prompt is first interpreted before being passed to dar. Then the
> argument given to -E option is passed to a second shell for execution:
>
> The shell job is to split the long string you type at the prompt, into
> words. Words are separated by spaces unless spaces are escaped or when
> spaces are quoted (simple quote (') double quoted (") back quote (`) all
> having a different meaning for most shells but still avoid space to be
> considered as word separator).
>
> So when you type at the shell prompt the following string
> dar -E "Hello world"
> the shell CLI parser will provide three words, which I put between
> brackets for clarity:
> [dar] [-E] [Hello world]
>
> Note that the double quotes (") have been removed by the shell.
> dar is then executed with two arguments [-E] and [Hello world] given by
> the shell.
>
> dar's work is then to pass the word following "-E" to a new shell
> process. This second shell will read the string [Hello wolrd] as if you
> have typed it at the prompt and will also split it into words, leading
> to this list of words:
> [Hello] [world]
>
> If the command you want dar to run is not "Hello" but "Hello world" you
> have to quote/escape twice the spaces, once for the shell you use to run
> dar from, and a second time for the shell that dar runs to interpret the
> argument given to -E option.
>
> in my example I can use the following instead of escaping the space(s):
>
> dar -c test -s 1M -E '"/tmp/With Space/ls" %p/%b.%N.%e' -N
>
> [...]
>
> Cheers,
> Denis
>
>
|