Originally posted to cygwin list, now I suspect the problem lies in all 1.23 releases of tar. I've reproduced this issue on Linux as well now.
I have duplicated the following behavior on: 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) Linux 2.6.18-164.9.1.el5.centos.plus #1 SMP Wed Dec 16 11:29:37 EST 2009 i686 i686 i386 GNU/Linux tar version 1.23 issue 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. Scenario: 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 file1.asc file2.asc file3.asc file4.asc Produces the expected result of a single test.tar, with the 4 asc files removed. $ ls test.tar 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 *** PROBLEM STARTS HERE *** 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 file1.asc file2.asc file3.asc file4.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 also 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. It appears from the release notes that some changes were made in 1.23 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. Thanks, Jeremy
