Bug 5731 - origbackuppath backups for files over symlink-to-directory fails
Summary: origbackuppath backups for files over symlink-to-directory fails
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 4.4
Hardware: All All
: wish bug
Assignee: Mark Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-03 12:20 UTC by Mark Thomas
Modified: 2017-11-18 00:00 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Thomas 2017-11-03 12:20 UTC
I recently updated scmutil.origpath, so that when ui.origbackuppath is configured,  we better handle the cases of path conflicts (file replaced with directories and vice-versa).  I missed one of the cases: where the old backup is a symlink to a directory that exists, and the new backup is a file or symlink.

This is because vfs.isdir() follows symlinks, so we try to call vfs.rmtree on the symlink, which fails.

I have a test and fix coming.
Comment 1 HG Bot 2017-11-10 17:15 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/ad671b4cb9fc
Mark Thomas <mbthomas@fb.com>
tests: add a test demonstrating issue5731

If origbackups are in use, a symlink to a valid directory is backed up, and an
update is made that attempts to backup a file or link over that symlink, we
abort with a bad error message instead of successfully updating.

Differential Revision: https://phab.mercurial-scm.org/D1310

(please test the fix)
Comment 2 HG Bot 2017-11-10 17:15 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/99ab7bc944d2
Mark Thomas <mbthomas@fb.com>
scmutil: don't try to delete origbackup symlinks to directories (issue5731)

When origbackuppath is set, when looking to see if a file we are backing up
conflicts with a directory in the origbackuppath, we incorrectly match on
symlinks to directories.  This means we try to call vfs.rmtree on the
symlink, which fails.

Differential Revision: https://phab.mercurial-scm.org/D1311

(please test the fix)
Comment 3 Bugzilla 2017-11-18 00:00 UTC
Bug was set to TESTING for 7 days, resolving