bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] tar barfs on backslash in filename


From: Jim Avera
Subject: [Bug-tar] tar barfs on backslash in filename
Date: Fri, 15 Dec 2017 14:04:19 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Thunderbird/57.0

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

[Prev in Thread] Current Thread [Next in Thread]