Hello,

Using tar 1.29 in Ubuntu 17.10

Tar on Linux blows up if there are backslashes in the file name, or maybe specifically backslash followed by 'n' mis-interpreted as an escape for newline (which would be wrong -- tar should back up exactly the files specified and not "translate" the arguments in any way, at least on Linux).  There is an old thread at http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00011.html but I think the discussion got confused over quoting conventions in C and/or the shell.

Regardless, tar v1.29 will not archive a file named, for example,

    'C:\nppdf32Log\debuglog.txt'

(I added the single quotes.  They are what you need to use to type the path in /bin/sh or bash)

=> This is the root cause why the gnu command "deluser --backup ..." fails if the user's files include something named like that.

SCRIPT TO REPRODUCE:

#!/bin/sh
filename='C:\nppdf32Log\debuglog.txt'
set -u -e -x
rm -rf /tmp/tartest;  mkdir /tmp/tartest
cd /tmp/tartest
touch "$filename"
ls -ld "$filename"
tar cvf test.tar "$filename"


RESULTS:

+ rm -rf /tmp/tartest
+ mkdir /tmp/tartest
+ cd /tmp/tartest
+ touch C:\nppdf32Log\debuglog.txt
+ ls -ld C:\nppdf32Log\debuglog.txt
-rw-r--r-- 1 jima jima 0 Dec 15 14:01 C:\nppdf32Log\debuglog.txt
+ tar cvf test.tar C:\nppdf32Log\debuglog.txt
tar: C\:\nppdf32Log\\debuglog.txt: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors


Reply via email to