summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-05-23 13:29:55 +0200
committerLars Wirzenius <liw@liw.fi>2012-05-23 13:29:55 +0200
commitff46339f1c9595de69741b976c5f000455bfd21d (patch)
tree1935816458b41f3df511809ffe435bb7d3670d27
parent39388e4d1e6eea14cb42a0d448a20285420ce5a0 (diff)
parent8ff35a57bc434860d29ba38ccb11ce01f0bf465b (diff)
downloadobnam-ff46339f1c9595de69741b976c5f000455bfd21d.tar.gz
Backup xattr changes
-rw-r--r--NEWS2
-rw-r--r--obnamlib/plugins/backup_plugin.py3
-rwxr-xr-xtests/xattr-change-only.script30
3 files changed, 34 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index fdb84abe..94b0cf91 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ Version 0.29, released UNRELEASED; a BETA release
for requesting this.
* Add an `obnam-viewprof` utility to translate Python profiling output
into human readable text form.
+* Bug fix: If a file's extended attributes have changed in any way, the change
+ is now backed up.
Version 0.28, released 2012-05-10; a BETA release
-------------------------------------------------
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index 5e78ea20..62d33f8b 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -419,7 +419,8 @@ class BackupPlugin(obnamlib.ObnamPlugin):
current.st_nlink != old.st_nlink or
current.st_size != old.st_size or
current.st_uid != old.st_uid or
- current.st_gid != old.st_gid)
+ current.st_gid != old.st_gid or
+ current.xattr != old.xattr)
def backup_parents(self, root):
'''Back up parents of root, non-recursively.'''
diff --git a/tests/xattr-change-only.script b/tests/xattr-change-only.script
new file mode 100755
index 00000000..20e81f22
--- /dev/null
+++ b/tests/xattr-change-only.script
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright 2012 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Make two backup generations with different contents. Make sure the
+# last generation can be restored correctly.
+
+set -eu
+
+echo foo > "$DATADIR/data/foo"
+$SRCDIR/tests/backup
+
+setfattr --name=user.foo --value=bar "$DATADIR/data/foo"
+
+$SRCDIR/tests/backup
+$SRCDIR/tests/restore
+$SRCDIR/tests/verify
+