Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect hard link counts in mirror_metadata file #239

Closed
rknichols opened this issue Jan 18, 2020 · 1 comment
Closed

Incorrect hard link counts in mirror_metadata file #239

rknichols opened this issue Jan 18, 2020 · 1 comment

Comments

@rknichols
Copy link
Contributor

rknichols commented Jan 18, 2020

In rdiff-backup 1.4.0b1.dev4+gd9977cf, when new links are added to an existing group of hard linked files, the files that were originally in the group will not get an updated NumHardLinks count in the mirror_metadata file. Test script:

#!/bin/bash
mkdir tdir
echo something >tdir/File-00
for N in 10 20 30; do ln tdir/File-00 tdir/File-$N;done
rdiff-backup -b tdir tdir-bkup
sleep 2
for N in 15 25 26 ;do ln tdir/File-00 tdir/File-$N;done
ls -l tdir
rdiff-backup -b tdir tdir-bkup
cd tdir-bkup/rdiff-backup-data
New=$(ls mirror_metadata* | tail -1)
zgrep -E '^File|NumHardLinks|Inode' $New

Result:

# bash  ~/rblinktest 
total 28
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-00
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-10
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-15
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-20
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-25
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-26
-rw-r--r--. 7 root root 10 Jan 17 22:05 File-30
File .
File File-00
  NumHardLinks 4
  Inode 917506
File File-10
  NumHardLinks 4
  Inode 917506
File File-15
  NumHardLinks 7
  Inode 917506
File File-20
  NumHardLinks 4
  Inode 917506
File File-25
  NumHardLinks 7
  Inode 917506
File File-26
  NumHardLinks 7
  Inode 917506
File File-30
  NumHardLinks 4
  Inode 917506
#

Only the newly added files have the correct NumHardLinks count. The files in the mirror are correctly linked.

zjw added a commit to zjw/rdiff-backup that referenced this issue Jan 19, 2020
This patch was originally submitted about 10 years ago.  Details can be
found here: https://savannah.nongnu.org/bugs/?26848

The patch has been by in use for some time, e.g., Debian:
https://salsa.debian.org/python-team/applications/rdiff-backup/blob/7cd963df/debian/patches/03_fix_hardlinks.diff

The hardlink tests have also been revised so as to agree with the changes in
the patch.
@zjw
Copy link
Contributor

zjw commented Jan 19, 2020

I've submitted pull request #240 to resolve this issue.

zjw added a commit to zjw/rdiff-backup that referenced this issue Mar 8, 2020
This fixes and reenables the failing hash test identified in rdiff-backup#78.  Currently,
rdiff-backup only stores a hash with the first file in a series of linked
files.  The test has now been modfied to recognize that fact.

Issue rdiff-backup#78 also pointed out certain warnings that are generated about missing
SHA1 digests.  It's believed that those warnings have already been fixed by
pull request rdiff-backup#239.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants