Skip to content

Commit

Permalink
shredder: only hash single-inode groups that are actually hardlinked
Browse files Browse the repository at this point in the history
`group->n_inodes == 1` is also true for groups that simply consist of a
single file. This condition will cause all single-file groups to be
hashed if `--merge-directories` is also set.

Additionally, the whole `group->n_inodes == 1` condition is redundant
because not following on the branch means that `group->n_clusters == 1`
and therefore `group->n_inodes == 1`.

Thus, check that we are actually dealing with a group of hardlinks (and
not just a single-file group that did not cause an early return because
we are also doing `--hash-unmatched`).

Fixes #614.
  • Loading branch information
intelfx committed Mar 9, 2023
1 parent 25948db commit 62fb5cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/shredder.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ static void rm_shred_group_update_status(RmShredGroup *group) {
} else if(group->n_clusters > 1) {
// we have potential match candidates; start hashing
group->status = RM_SHRED_GROUP_START_HASHING;
} else if(group->n_inodes == 1 && group->n_unhashed_clusters > 0 &&
} else if(group->num_files > 1 && group->n_unhashed_clusters > 0 &&
group->session->cfg->merge_directories) {
/* special case of hardlinked files that still need hashing to help identify
* matching directories */
Expand Down

0 comments on commit 62fb5cf

Please sign in to comment.