Skip to content

Commit

Permalink
This commit was manufactured by cvs2svn to create tag 'r1-2-7'.
Browse files Browse the repository at this point in the history
  • Loading branch information
cvs2svn committed Mar 3, 2009
1 parent d0400ce commit 4fa1a48
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 273 deletions.
40 changes: 7 additions & 33 deletions rdiff-backup/CHANGELOG
@@ -1,34 +1,21 @@
New in v1.3.2 (????/??/??)
New in v1.2.7 (2009/03/02)
---------------------------

Don't crash when filesystem can't set ACL. Thanks to Matt Thompson for the bug
report. (Andrew Ferguson)

Fix Security Error when performing non-backup operations on Windows. Thanks to
Tommy Keene for the bug report. (Andrew Ferguson)

Properly disable hardlinks by default on Windows.

Fix Python 2.2 compatibility. Closes Savannah bug #25529. (Andrew Ferguson)

Fix typo which caused failure when checking if another rdiff-backup process is
running on Windows. Thanks to Ryan Hughes for the bug report. (Andrew Ferguson)

Disable hardlinks by default on Windows when performing operations such as
--compare, etc. Thanks to Ryan Hughes for the bug report. (Andrew Ferguson)

Change --min-file-size and --max-file-size to agree with man page. These
options no longer include files, and will only apply to regular files. Thanks
to Johannes Jensen for the suggestion. (Andrew Ferguson)

Improve error message if regress operation fails due to Security Violation.
Thanks to Grzegorz Marszalek for the bug report. (Andrew Ferguson)


New in v1.3.1 (2009/01/27)
New in v1.2.6 (2009/01/27)
---------------------------

Improve support for handling too long filenames under Windows. Too long
Improve support for handling too long filenames under Windows. Too long
directory names and paths are still a problem. (Andrew Ferguson)

Print more helpful error messages when the remote command cannot be started
Expand All @@ -39,27 +26,14 @@ Thanos Diacakis for testing. (Andrew Ferguson)

Fix --override-chars-to-quote option. (Andrew Ferguson)

Fix typo in robust.py which broke error reporting. Closes Savannah bug #25255.

Ignore Windows errors caused by too long filenames; the files are not yet
backed-up, but the backup process is no longer halted. (Andrew Ferguson)


New in v1.3.0 (2009/01/03)
New in v1.2.5 (2009/01/06)
---------------------------

New option: --use-compatible-timestamps, which causes rdiff-backup to use - as
the hour/minute/second separator instead of :. Enabled by default on systems
which require : to be escaped. (Oliver Mulatz)

Allow rdiff-backup to backup files which it cannot read, but can change
the permissions of. (Andrew Ferguson)

Take start and end times from same system so that the elapsed time printed in
the statistics is not affected by time zone. (Andrew Ferguson)
Fix typo in robust.py which broke error reporting. Closes Savannah bug #25255.

Properly fix escaping DOS devices and trailing periods and spaces; now supports
native Windows and Linxu/FAT32. (Andrew Ferguson)
Ignore Windows errors caused by too long filenames; the files are not yet
backed-up, but the backup process is no longer halted. (Andrew Ferguson)


New in v1.2.4 (2009/01/01)
Expand Down
9 changes: 1 addition & 8 deletions rdiff-backup/rdiff-backup.1
@@ -1,4 +1,4 @@
.TH RDIFF-BACKUP 1 "JANUARY 2009" "Version 1.3.0" "User Manuals" \" -*- nroff -*-
.TH RDIFF-BACKUP 1 "MARCH 2009" "Version 1.2.7" "User Manuals" \" -*- nroff -*-
.SH NAME
rdiff-backup \- local/remote mirror and incremental backup
.SH SYNOPSIS
Expand Down Expand Up @@ -486,13 +486,6 @@ Test for the presence of a compatible rdiff-backup server as specified
in the following host::filename argument(s). The filename section
will be ignored.
.TP
.B \-\-use-compatible-timestamps
Create timestamps in which the hour/minute/second separator is a - (hyphen)
instead of a : (colon). It is safe to use this option on one backup, and then
not use it on another; rdiff-backup supports the intermingling of different
timestamp formats. This option is enabled by default on platforms which
require that the colon be escaped.
.TP
.BI "\-\-user-mapping-file " filename
Map user names and ids according to the user mapping file
.IR filename .
Expand Down
7 changes: 4 additions & 3 deletions rdiff-backup/rdiff_backup/FilenameMapping.py
Expand Up @@ -85,17 +85,18 @@ def quote(path):
"""
QuotedPath = chars_to_quote_regexp.sub(quote_single, path)
if not Globals.escape_dos_devices and not Globals.escape_trailing_spaces:
if not Globals.must_escape_dos_devices \
and not Globals.must_escape_trailing_spaces:
return QuotedPath

# Escape a trailing space or period (invalid in names on FAT32 under DOS,
# Windows and modern Linux)
if Globals.escape_trailing_spaces:
if Globals.must_escape_trailing_spaces:
if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'):
QuotedPath = QuotedPath[:-1] + \
"%s%03d" % (quoting_char, ord(QuotedPath[-1]))

if not Globals.escape_dos_devices:
if not Globals.must_escape_dos_devices:
return QuotedPath

# Escape first char of any special DOS device files even if filename has an
Expand Down
5 changes: 0 additions & 5 deletions rdiff-backup/rdiff_backup/Globals.py
Expand Up @@ -159,11 +159,6 @@
chars_to_quote = None
quoting_char = ';'

# If true, the timestamps use the following format: "2008-09-01T04-49-04-07-00"
# (instead of "2008-09-01T04:49:04-07:00"). This creates timestamps which
# don't need to be escaped on Windows.
use_compatible_timestamps = 0

# If true, emit output intended to be easily readable by a
# computer. False means output is intended for humans.
parsable_output = None
Expand Down
32 changes: 5 additions & 27 deletions rdiff-backup/rdiff_backup/Main.py
Expand Up @@ -20,7 +20,7 @@
"""Start (and end) here - read arguments, set global settings, etc."""

from __future__ import generators
import getopt, sys, re, os, cStringIO, tempfile, time
import getopt, sys, re, os, cStringIO, tempfile
from log import Log, LoggerError, ErrorLog
import Globals, Time, SetConnections, selection, robust, rpath, \
manage, backup, connection, restore, FilenameMapping, \
Expand Down Expand Up @@ -85,8 +85,8 @@ def normalize_path(path):
"remove-older-than=", "restore-as-of=", "restrict=",
"restrict-read-only=", "restrict-update-only=", "server",
"ssh-no-compression", "tempdir=", "terminal-verbosity=",
"test-server", "use-compatible-timestamps", "user-mapping-file=",
"verbosity=", "verify", "verify-at-time=", "version"])
"test-server", "user-mapping-file=", "verbosity=", "verify",
"verify-at-time=", "version"])
except getopt.error, e:
commandline_error("Bad commandline options: " + str(e))

Expand Down Expand Up @@ -199,8 +199,6 @@ def normalize_path(path):
elif opt == "--tempdir": tempfile.tempdir = arg
elif opt == "--terminal-verbosity": Log.setterm_verbosity(arg)
elif opt == "--test-server": action = "test-server"
elif opt == "--use-compatible-timestamps":
Globals.set("use_compatible_timestamps", 1)
elif opt == "--user-mapping-file": user_mapping_filename = arg
elif opt == "-v" or opt == "--verbosity": Log.setverbosity(arg)
elif opt == "--verify": action, restore_timestr = "verify", "now"
Expand Down Expand Up @@ -347,7 +345,6 @@ def Backup(rpin, rpout):
else:
backup.Mirror(rpin, rpout)
rpout.conn.Main.backup_touch_curmirror_local(rpin, rpout)
rpout.conn.Main.backup_close_statistics(time.time())

def backup_quoted_rpaths(rpout):
"""Get QuotedRPath versions of important RPaths. Return rpout"""
Expand Down Expand Up @@ -537,19 +534,6 @@ def backup_remove_curmirror_local():
C.sync() # Make sure everything is written before curmirror is removed
older_inc.delete()

def backup_close_statistics(end_time):
"""Close out the tracking of the backup statistics.
Moved to run at this point so that only the clock of the system on which
rdiff-backup is run is used (set by passing in time.time() from that
system). Use at end of session.
"""
assert Globals.rbdir.conn is Globals.local_connection
if Globals.print_statistics: statistics.print_active_stats(end_time)
if Globals.file_statistics: statistics.FileStats.close()
statistics.write_active_statfileobj(end_time)


def Restore(src_rp, dest_rp, restore_as_of = None):
"""Main restoring function
Expand Down Expand Up @@ -876,8 +860,7 @@ def checkdest_need_check(dest_rp):
"""Return None if no dest dir found, 1 if dest dir needs check, 0 o/w"""
if not dest_rp.isdir() or not Globals.rbdir.isdir(): return None
for filename in Globals.rbdir.listdir():
if filename not in ['chars_to_quote', 'special_escapes',
'backup.log']: break
if filename not in ['chars_to_quote', 'backup.log']: break
else: # This may happen the first backup just after we test for quoting
return None
curmirroot = Globals.rbdir.append("current_mirror")
Expand Down Expand Up @@ -919,9 +902,4 @@ def checkdest_if_necessary(dest_rp):
if need_check == 1:
Log("Previous backup seems to have failed, regressing "
"destination now.", 2)
try:
dest_rp.conn.regress.Regress(dest_rp)
except Security.Violation:
Log.FatalError("Security violation while attempting to regress "
"destination, perhaps due to --restrict-read-only "
"or --restrict-update-only.")
dest_rp.conn.regress.Regress(dest_rp)
5 changes: 2 additions & 3 deletions rdiff-backup/rdiff_backup/Security.py
Expand Up @@ -132,14 +132,14 @@ def set_allowed_requests(sec_level):
"Globals.get", "Globals.is_not_None", "Globals.get_dict_val",
"log.Log.open_logfile_allconn", "log.Log.close_logfile_allconn",
"Log.log_to_file", "FilenameMapping.set_init_quote_vals_local",
"FilenameMapping.set_init_quote_vals", "Time.setcurtime_local",
"FilenameMapping.set_init_quote_vals",
"SetConnections.add_redirected_conn", "RedirectedRun",
"sys.stdout.write", "robust.install_signal_handlers"]
if (sec_level == "read-only" or sec_level == "update-only" or
sec_level == "all"):
l.extend(["rpath.make_file_dict", "os.listdir", "rpath.ea_get",
"rpath.acl_get", "rpath.setdata_local",
"log.Log.log_to_file", "os.getuid",
"log.Log.log_to_file", "os.getuid", "Time.setcurtime_local",
"rpath.gzip_open_local_read", "rpath.open_local_read",
"Hardlink.initialize_dictionaries", "user_group.uid2uname",
"user_group.gid2gname"])
Expand Down Expand Up @@ -173,7 +173,6 @@ def set_allowed_requests(sec_level):
"backup.DestinationStruct.patch_and_increment",
"Main.backup_touch_curmirror_local",
"Main.backup_remove_curmirror_local",
"Main.backup_close_statistics",
"regress.check_pids",
"Globals.ITRB.increment_stat",
"statistics.record_error",
Expand Down
20 changes: 5 additions & 15 deletions rdiff-backup/rdiff_backup/Time.py
Expand Up @@ -61,13 +61,8 @@ def setprevtime_local(timeinseconds, timestr):
prevtime, prevtimestr = timeinseconds, timestr

def timetostring(timeinseconds):
"""Return w3 datetime compliant listing of timeinseconds, or one in
which :'s have been replaced with -'s"""
if not Globals.use_compatible_timestamps:
format_string = "%Y-%m-%dT%H:%M:%S"
else:
format_string = "%Y-%m-%dT%H-%M-%S"
s = time.strftime(format_string, time.localtime(timeinseconds))
"""Return w3 datetime compliant listing of timeinseconds"""
s = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(timeinseconds))
return s + gettzd(timeinseconds)

def stringtotime(timestring):
Expand All @@ -77,13 +72,10 @@ def stringtotime(timestring):
like a w3 datetime string, return None.
"""

regexp = re.compile('[-:]')

try:
date, daytime = timestring[:19].split("T")
year, month, day = map(int, date.split("-"))
hour, minute, second = map(int, regexp.split(daytime))
hour, minute, second = map(int, daytime.split(":"))
assert 1900 < year < 2100, year
assert 1 <= month <= 12
assert 1 <= day <= 31
Expand Down Expand Up @@ -165,18 +157,16 @@ def gettzd(timeinseconds = None):
elif offset < 0: prefix = "-"
else: return "Z" # time is already in UTC

if Globals.use_compatible_timestamps: time_separator = '-'
else: time_separator = ':'
hours, minutes = map(abs, divmod(offset, 60))
assert 0 <= hours <= 23
assert 0 <= minutes <= 59
return "%s%02d%s%02d" % (prefix, hours, time_separator, minutes)
return "%s%02d:%02d" % (prefix, hours, minutes)

def tzdtoseconds(tzd):
"""Given w3 compliant TZD, return how far ahead UTC is"""
if tzd == "Z": return 0
assert len(tzd) == 6 # only accept forms like +08:00 for now
assert (tzd[0] == "-" or tzd[0] == "+") and (tzd[3] == ":" or tzd[3] == "-")
assert (tzd[0] == "-" or tzd[0] == "+") and tzd[3] == ":"
return -60 * (60 * int(tzd[:3]) + int(tzd[4:]))

def cmp(time1, time2):
Expand Down
12 changes: 4 additions & 8 deletions rdiff-backup/rdiff_backup/backup.py
Expand Up @@ -110,16 +110,8 @@ def attach_diff(diff_rorp, src_rp, dest_sig):
if dest_sig.isflaglinked():
diff_rorp.flaglinked(dest_sig.get_link_flag())
elif src_rp.isreg():
reset_perms = False
if (Globals.process_uid != 0 and not src_rp.readable() and
src_rp.isowner()):
reset_perms = True
src_rp.chmod(0400 | src_rp.getperms())

if dest_sig.isreg(): attach_diff(diff_rorp, src_rp, dest_sig)
else: attach_snapshot(diff_rorp, src_rp)

if reset_perms: src_rp.chmod(src_rp.getperms() & ~0400)
else:
dest_sig.close_if_necessary()
diff_rorp.set_attached_filetype('snapshot')
Expand Down Expand Up @@ -498,6 +490,10 @@ def close(self):
self.metawriter.close()
metadata.ManagerObj.ConvertMetaToDiff()

if Globals.print_statistics: statistics.print_active_stats()
if Globals.file_statistics: statistics.FileStats.close()
statistics.write_active_statfileobj()


class PatchITRB(rorpiter.ITRBranch):
"""Patch an rpath with the given diff iters (use with IterTreeReducer)
Expand Down

0 comments on commit 4fa1a48

Please sign in to comment.