Saturday, October 23, 2010

tar 1.23 --remove-files option is seriously broken

I noticed tar behaves strange on Ubuntu 10.10.
Soon I found 10.10 has tar 1.23 and --remove-files option in tar 1.23 is seriously broken when it tries to archive a symbolic link. The option supposed to remove the link automatically after archiving it, but it actually removes the file the symlink is pointing to :(

This post is reporting the same issue.

Subject: [Bug-tar] broken --remove-files in tar-1.23 -
List: bug-tar-gnu

Option --remove-files seems to be broken in version 1.23.

$ mkdir -p a/b
$ ln -s b a/c
$ tar --remove-files -czf a.tar.gz a
tar: /home/build/tmp/a: Cannot rmdir: Directory not empty
tar: Exiting with failure status due to previous errors

Always passes in version 1.22.

Alexander Kozlov
Comp Biol, KTH,
Stockholm, Sweden

The solution is either reverting to 1.22 or applying the patch posted by Sergey:

No comments: