From f1ed85d46043c523cd5b8196c1d266f3606a2531 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 29 Jul 2009 20:45:58 -0700 Subject: [PATCH 1/2] Preserve hard links with --remove-files When the --remove-files option is in effect, it is no longer reliable to use a file's link count to determine if we should use the hash table for hard links. Instead, we look into the hash table for every file when under the influence of the --remove-files option. --- debian/changelog | 3 ++- src/create.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index df3a125..747988e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ tar (1.22-1.2) UNRELEASED; urgency=low * Add Carl Worth as an uploader. * Fix to allow parallel build (-j2), closes #535319 * Don't close file stream before EOF, closes #525818 + * Preserve hard links with --remove-files, closes #188663 - -- Carl Worth Wed, 29 Jul 2009 16:18:18 -0700 + -- Carl Worth Wed, 29 Jul 2009 21:28:45 -0700 tar (1.22-1.1) unstable; urgency=low diff --git a/src/create.c b/src/create.c index fde7ed1..559aaa0 100644 --- a/src/create.c +++ b/src/create.c @@ -1377,7 +1377,7 @@ static Hash_table *link_table; static bool dump_hard_link (struct tar_stat_info *st) { - if (link_table && st->stat.st_nlink > 1) + if (link_table && (st->stat.st_nlink > 1 || remove_files_option)) { struct link lp; struct link *duplicate; @@ -1424,7 +1424,7 @@ file_count_links (struct tar_stat_info *st) { if (hard_dereference_option) return; - if (st->stat.st_nlink > 1) + if (st->stat.st_nlink > 1 || remove_files_option) { struct link *duplicate; struct link *lp = xmalloc (offsetof (struct link, name) -- 1.6.3.3