Skip to content

Update rsync #2696

Merged
merged 3 commits into from
Jun 22, 2022
Merged

Update rsync #2696

merged 3 commits into from
Jun 22, 2022

Conversation

donald
Copy link
Collaborator

@donald donald commented Jun 21, 2022

This adds a patch to rsync, so that it doesn't run into undefined behavior if a hard link operation fails unexpectedly (eg, ext4 65000 hard links limit) but does a _exit(33) instead which can be recognized by pbackup.

https://github.com/WayneD/rsync/issues/329

This works by accident if $p evaluates to an empty string which is no
longer the case when we add a PATCHURL.
Rsync might crash if we continue after a hard link failure. There is no
reasonable way anyway, so just abort with recognizable error code.

https://github.com/WayneD/rsync/issues/329
---
 hlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hlink.c b/hlink.c
index 66810a3e..23869872 100644
--- a/hlink.c
+++ b/hlink.c
@@ -464,7 +464,10 @@ int hard_link_one(struct file_struct *file, const char *fname,
 			code = FERROR_XFER;
 		rsyserr(code, errno, "link %s => %s failed",
 			full_fname(fname), oldname);
-		return 0;
+
+		/* This is broken beyond repair for --link-dest. No good way to continue here. */
+		fprintf(stderr, "Aborting due to hard link failure\n");
+		_exit(33);
 	}

 	file->flags |= FLAG_HLINK_DONE;
--
2.36.0
@donald donald merged commit 30dff45 into master Jun 22, 2022
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant