summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-09-07 17:33:26 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-09-07 17:33:26 +0000
commit951d01fd1c1f619db6e2d7d625eb1f99c22c1eff (patch)
tree80bd5beb61c28f91acc8ea45cc0819a20677a60a
parentb1bbcfee1956714070ed055a04050d67b1f29190 (diff)
downloadrdiff-backup-951d01fd1c1f619db6e2d7d625eb1f99c22c1eff.tar.gz
Avoid lchown requirement
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@630 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/CHANGELOG2
-rw-r--r--rdiff-backup/rdiff_backup/cmodule.c4
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py7
-rw-r--r--rdiff-backup/testing/commontest.py2
4 files changed, 14 insertions, 1 deletions
diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG
index f6a7057..53ec051 100644
--- a/rdiff-backup/CHANGELOG
+++ b/rdiff-backup/CHANGELOG
@@ -22,6 +22,8 @@ outside path. Bug with --restrict option allowed writes outside path.
bug #14304: Python 2.2 compatibility spoiled by device files.
+lchown no longer required, which is good news for Mac OS X 10.3.
+
New in v1.0.0 (2005/08/14)
--------------------------
diff --git a/rdiff-backup/rdiff_backup/cmodule.c b/rdiff-backup/rdiff_backup/cmodule.c
index f6a44a3..5fc61e0 100644
--- a/rdiff-backup/rdiff_backup/cmodule.c
+++ b/rdiff-backup/rdiff_backup/cmodule.c
@@ -371,6 +371,7 @@ static PyObject *acl_unquote(PyObject *self, PyObject *args)
/* ------------- lchown taken from Python's posixmodule.c -------------- */
/* duplicate here to avoid v2.3 requirement */
+#ifdef HAVE_LCHOWN
static PyObject *
posix_error_with_allocated_filename(char* name)
{
@@ -398,6 +399,7 @@ posix_lchown(PyObject *self, PyObject *args)
Py_INCREF(Py_None);
return Py_None;
}
+#endif /* HAVE_LCHOWN */
/* ------------- Python export lists -------------------------------- */
@@ -411,8 +413,10 @@ static PyMethodDef CMethods[] = {
"Quote string, escaping non-printables"},
{"acl_unquote", acl_unquote, METH_VARARGS,
"Unquote string, producing original input to quote"},
+#ifdef HAVE_LCHOWN
{"lchown", posix_lchown, METH_VARARGS,
"Like chown, but don't follow symlinks"},
+#endif /* HAVE_LCHOWN */
{NULL, NULL, 0, NULL}
};
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index aa411a0..b9e84ca 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -782,7 +782,12 @@ class RPath(RORPath):
def chown(self, uid, gid):
"""Set file's uid and gid"""
- self.conn.C.lchown(self.path, uid, gid)
+ if self.issym():
+ try: self.conn.C.lchown(self.path, uid, gid)
+ except AttributeError:
+ log.Log("Warning: lchown missing, cannot change ownership "
+ "of symlink " + self.path, 2)
+ else: os.chown(self.path, uid, gid)
self.data['uid'] = uid
self.data['gid'] = gid
diff --git a/rdiff-backup/testing/commontest.py b/rdiff-backup/testing/commontest.py
index 636ce51..801e3b6 100644
--- a/rdiff-backup/testing/commontest.py
+++ b/rdiff-backup/testing/commontest.py
@@ -93,6 +93,7 @@ def InternalBackup(source_local, dest_local, src_dir, dest_dir,
"""
Globals.current_time = current_time
#_reset_connections()
+ Globals.security_level = "override"
remote_schema = '%s'
if not source_local:
@@ -174,6 +175,7 @@ def get_increment_rp(mirror_rp, time):
def _reset_connections(src_rp, dest_rp):
"""Reset some global connection information"""
+ Globals.security_level = "override"
Globals.isbackup_reader = Globals.isbackup_writer = None
#Globals.connections = [Globals.local_connection]
#Globals.connection_dict = {0: Globals.local_connection}