Commit fb5c113d authored by owsla's avatar owsla

Prevent backing-up reparse points on Windows


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@977 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 07fad537
.TH RDIFF-BACKUP 1 "JULY 2007" "Version 1.1.13" "User Manuals" \" -*- nroff -*-
.TH RDIFF-BACKUP 1 "DECEMBER 2008" "Version 1.2.3" "User Manuals" \" -*- nroff -*-
.SH NAME
rdiff-backup \- local/remote mirror and incremental backup
.SH SYNOPSIS
......@@ -188,7 +188,8 @@ Exclude all device files, fifo files, socket files, and symbolic links.
Exclude all socket files.
.TP
.B "\-\-exclude-symbolic-links"
Exclude all symbolic links.
Exclude all symbolic links. This option is automatically enabled if the backup
source is running on native Windows to avoid backing-up NTFS reparse points.
.TP
.BI "\-\-exclude-if-present " filename
Exclude directories if
......
......@@ -356,6 +356,9 @@ def backup_quoted_rpaths(rpout):
def backup_set_select(rpin):
"""Create Select objects on source connection"""
if rpin.conn.os.name == 'nt':
log.Log("Symbolic links excluded by default on Windows", 4)
select_opts.append(("--exclude-symbolic-links", None))
rpin.conn.backup.SourceStruct.set_source_select(rpin, select_opts,
*select_files)
......
......@@ -38,6 +38,10 @@ are dealing with are local or remote.
import os, stat, re, sys, shutil, gzip, socket, time, errno
import Globals, Time, static, log, user_group, C
try:
import win32file, winnt
except ImportError:
pass
class SkipFileException(Exception):
"""Signal that the current file should be skipped but then continue
......@@ -328,6 +332,12 @@ def make_file_dict_python(filename):
data['devloc'] = statblock[stat.ST_DEV]
data['nlink'] = statblock[stat.ST_NLINK]
if os.name == 'nt':
attribs = win32file.GetFileAttributes(filename)
if attribs & winnt.FILE_ATTRIBUTE_REPARSE_POINT:
data['type'] = 'sym'
data['linkname'] = None
if not (type == 'sym' or type == 'dev'):
# mtimes on symlinks and dev files don't work consistently
data['mtime'] = long(statblock[stat.ST_MTIME])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment