Possible tar version 1.23-1 --remove-files bug.

Jeremy Warren jerwah@gmail.com
Thu Aug 26 05:43:00 GMT 2010

I have duplicated the following behavior on 2 different machines
CYGWIN_NT-5.2 1.7.6(0.230/5/3) 2010-08-16 16:06 i686  (Windows 2003 R2 Server)
CYGWIN_NT-5.1 1.7.5(0.225/5/3) 2010-04-12 19:07 i686  (Windows XP Desktop)
Both are running tar version 1.23-1 and the problem is 100%
reproducible in my environment.

*Some editing has been made to the output to protect the innocent.
Any discrepancies in the output are unlikely related to the problem
itself and more likely caused by my sausage shaped fingers.

Given a directory with sample contents:
$ ls
file1.asc  file2.asc  file3.asc  file4.asc

the following command:
$ tar --remove-files -cvf test.tar *.asc

Produces the expected result of a single test.tar, with the 4 asc files removed.

$ ls

And the tarball correctly contains all 4 files.

$ tar -tvf test.tar
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:07 file1.asc
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:07 file2.asc
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:07 file3.asc
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:07 file4.asc


The following command, using the -r (append -vs- create) switch,
correctly produces a test.tar file with all 4 files but fails to
delete the files.
$ tar --remove-files -rvf test.tar *.asc

$ ls
file1.asc  file2.asc  file3.asc  file4.asc  test.tar

$ tar -tvf test.tar
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:11 file1.asc
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:11 file2.asc
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:11 file3.asc
-rw-r--r-- XXXXXXXXXXXXXX/None 22 2010-08-26 00:11 file4.asc

A return code of zero is produced in either instance, and the tarballs
created are both fully usable.  There is a second scenario where all
asc files are deleted except the last one (so test.tar and file4 would
be left in the directory at completion) but as of yet I cannot
reproduce that scenario at will, so I'm uncertain as to the exact
startup conditions that cause it.

In my situation using -c is not a solution since this command is
embedded within a large loop.   Each file is being processed and
appended to the archive one at a time.  The processing script worked
without issue prior to upgrading to the 1.23-1 version tar within the
last week or so.

*** Other possibly relevant pieces of information: ***

I verified using a Linux box (2.6.18-164.9.1.el5.centos.plus) running
tar (GNU tar) 1.15.1 to verify that my expectations of the command
were correct.

$ ls
file1.asc  file2.asc  file3.asc  file4.asc

$ tar --remove-files -rvf test.tar *.asc

$ ls

$ tar -tvf test.tar
-rw-r--r-- XXXXXXXXXXXXXX/XXXXXXXXXXXXXX 22 2010-08-26 00:15:28 file1.asc
-rw-r--r-- XXXXXXXXXXXXXX/XXXXXXXXXXXXXX 22 2010-08-26 00:15:28 file2.asc
-rw-r--r-- XXXXXXXXXXXXXX/XXXXXXXXXXXXXX 22 2010-08-26 00:15:28 file3.asc
-rw-r--r-- XXXXXXXXXXXXXX/XXXXXXXXXXXXXX 22 2010-08-26 00:15:28 file4.asc

Cygwin was installed from different mirrors at different times on each machine.

It appears from the release notes that some changes were made in
1.23-1 related to the --remove-files argument
"** The --remove-files option removes files only if they were
succesfully stored in the archive."

I was unable to find any related issues in the archive but was having
trouble making the archive search match the '--remove-files' switch in
the query.  Apologies in advance if I duped.


Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list