bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Fwd: [regression] tar mess up \ and \\ files


From: Nathan Stratton Treadway
Subject: Re: [Bug-tar] Fwd: [regression] tar mess up \ and \\ files
Date: Tue, 4 Mar 2014 01:13:34 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Mar 03, 2014 at 07:19:23 +0200, Sergey Poznyakoff wrote:
> from a file supplied with the -T option, not the ones listed in the
> command line.  The latter were handled as always.  To wit:
> 
> $ ls --quoting-style=literal
> \  \\
> $ tar --version|head -1
> tar (GNU tar) 1.27
> $ tar cfv ../2.tar *
> \\
> \\

I didn't quite understand why tar was giving that output until I ran the
experiment myself.  In case anyone else following this thread was
wondering, what's actually happening here is that the file called "\" on
the filesystem (and "\\" by tar) is getting added to the archive twice,
and the one called "\\" on the filesystem isn't included at all:

$ tar --version | head -1
tar (GNU tar) 1.27.1


$ ls -l
total 8
-rw-r--r-- 1 nathanst nathanst  5 2014-03-04 00:00 \
-rw-r--r-- 1 nathanst nathanst 10 2014-03-04 01:00 \\

$ tar -cvf test.tar *
\\
\\

$ tar -tvf test.tar 
-rw-r--r-- nathanst/nathanst 5 2014-03-04 00:00 \\
hrw-r--r-- nathanst/nathanst 0 2014-03-04 00:00 \\ link to \\


$ mkdir extr
$ cd extr

$ tar -xvf ../test.tar 
\\
\\

$ ls -l
total 4
-rw-r--r-- 1 nathanst nathanst 5 2014-03-04 00:00 \


Adding "--quoting-style=literal" to the tar command line (or
"--quoting-style=escape" to the ls command line) reduces the confusion a
little (on the output side).

$ tar --quoting-style=literal -tvf ../test.tar 
-rw-r--r-- nathanst/nathanst 5 2014-03-04 00:00 \
hrw-r--r-- nathanst/nathanst 0 2014-03-04 00:00 \ link to \


$ ls -l --quoting-style=escape
total 24
-rw-r--r-- 1 nathanst nathanst     5 2014-03-04 00:00 \\
-rw-r--r-- 1 nathanst nathanst    10 2014-03-04 01:00 \\\\


(On the input side, "tar --no-unquote -cvf test.tar *" does successfully
include both files in the archive, as mentioned elsewhere in this
thread.)

                                                Nathan

----------------------------------------------------------------------------
Nathan Stratton Treadway  -  address@hidden  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239



reply via email to

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