Bug 4037 - Rsync should obey --keep-dirlinks when searching basis dirs
Summary: Rsync should obey --keep-dirlinks when searching basis dirs
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.9
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
Depends on:
Reported: 2006-08-20 17:24 UTC by Matt McCutchen
Modified: 2008-01-24 13:28 UTC (History)
0 users

See Also:

Script for a backup scenario that tickles the bug (1.36 KB, text/plain)
2006-08-20 17:25 UTC, Matt McCutchen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt McCutchen 2006-08-20 17:24:12 UTC
Currently, when rsync searches for a basis file in an alternate basis directory specified with a --*-dest option, it blindly follows the file-list path from the top of the alternate basis directory.  This might be the wrong thing to do if the basis directory contains symlinks.  The script that I will soon attach demonstrates how rsync's behavior might result in a corrupt backup.

I propose that rsync should obey the --keep-dirlinks setting when searching for basis files.  If --keep-dirlinks is disabled, rsync would have to lstat every proper prefix of the path under the basis dir to make sure symlinks are not accidentally being followed.  For efficiency, this check should be done only once per directory.  It would fit nicely in the per-directory initialization, near line 911 of generator.c.
Comment 1 Matt McCutchen 2006-08-20 17:25:51 UTC
Created attachment 2098 [details]
Script for a backup scenario that tickles the bug
Comment 2 Matt McCutchen 2008-01-24 13:28:58 UTC
Note that, in the absence of a proper fix for this issue, symlink munging in the destination can prevent surprises like the one seen in comment #1.