summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-03-11 17:18:32 +0200
committerLars Wirzenius <liw@liw.fi>2016-03-11 17:19:33 +0200
commit450870e1414b1be579a9130006ff62d429754280 (patch)
treea88897f8dbbc0f4032e4d0cd0c2c8652999426a9
parent898a4f7242318e3593f97cb15f7bdb4932cc1b2a (diff)
downloadobnam-450870e1414b1be579a9130006ff62d429754280.tar.gz
Do not alias test key with symlink target key
This caused other parts of Obnam to break when backing up symlinks.
-rw-r--r--obnamlib/fmt_6/repo_fmt_6.py2
-rw-r--r--obnamlib/metadata.py4
-rw-r--r--obnamlib/plugins/restore_plugin.py2
-rw-r--r--obnamlib/repo_interface.py18
4 files changed, 16 insertions, 10 deletions
diff --git a/obnamlib/fmt_6/repo_fmt_6.py b/obnamlib/fmt_6/repo_fmt_6.py
index bc08f764..6f95ee3c 100644
--- a/obnamlib/fmt_6/repo_fmt_6.py
+++ b/obnamlib/fmt_6/repo_fmt_6.py
@@ -851,7 +851,7 @@ class RepositoryFormat6(obnamlib.RepositoryInterface):
# field names. This simplifies code (at the cost of a little
# magic) in the file key getting and setting code.
self._file_keys = {
- obnamlib.REPO_FILE_TEST_KEY: 'target',
+ obnamlib.REPO_FILE_TEST_KEY: 'test',
obnamlib.REPO_FILE_MODE: 'st_mode',
obnamlib.REPO_FILE_MTIME_SEC: 'st_mtime_sec',
obnamlib.REPO_FILE_MTIME_NSEC: 'st_mtime_nsec',
diff --git a/obnamlib/metadata.py b/obnamlib/metadata.py
index 8d6f046d..9f2e46b4 100644
--- a/obnamlib/metadata.py
+++ b/obnamlib/metadata.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2015 Lars Wirzenius
+# Copyright (C) 2009-2016 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
@@ -34,7 +34,7 @@ metadata_verify_fields = (
)
metadata_fields = metadata_verify_fields + (
'st_blocks', 'st_dev', 'st_gid', 'st_ino', 'st_atime_sec',
- 'st_atime_nsec', 'md5',
+ 'st_atime_nsec', 'md5', 'test',
)
diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py
index f24ac491..6bb66189 100644
--- a/obnamlib/plugins/restore_plugin.py
+++ b/obnamlib/plugins/restore_plugin.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2015 Lars Wirzenius
+# Copyright (C) 2009-2016 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
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index 640fbffb..1c74981d 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -1893,41 +1893,47 @@ class RepositoryInterfaceTests(unittest.TestCase): # pragma: no cover
gen_id, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY)
def test_committing_client_remembers_set_file_keys(self):
+ # We use the symlink target for these tests, since the
+ # FILE_TEST_KEY mightn't get stored.
+
gen_id = self.create_generation()
self.repo.add_file(gen_id, '/foo/bar')
self.repo.set_file_key(
gen_id, '/foo/bar', obnamlib.REPO_FILE_MODE, stat.S_IFREG)
self.repo.set_file_key(
- gen_id, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY, 'yoyo')
+ gen_id, '/foo/bar', obnamlib.REPO_FILE_SYMLINK_TARGET, 'yoyo')
self.repo.commit_client('fooclient')
self.repo.unlock_client('fooclient')
value = self.repo.get_file_key(
- gen_id, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY)
+ gen_id, '/foo/bar', obnamlib.REPO_FILE_SYMLINK_TARGET)
self.assertEqual(value, 'yoyo')
def test_setting_file_key_does_not_affect_previous_generation(self):
+ # We use the symlink target for these tests, since the
+ # FILE_TEST_KEY mightn't get stored.
+
gen_id = self.create_generation()
self.repo.add_file(gen_id, '/foo/bar')
self.repo.set_file_key(
gen_id, '/foo/bar', obnamlib.REPO_FILE_MODE, stat.S_IFREG)
self.repo.set_file_key(
- gen_id, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY, 'first')
+ gen_id, '/foo/bar', obnamlib.REPO_FILE_SYMLINK_TARGET, 'first')
self.repo.commit_client('fooclient')
self.repo.unlock_client('fooclient')
self.repo.lock_client('fooclient')
gen_id_2 = self.repo.create_generation('fooclient')
self.repo.set_file_key(
- gen_id_2, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY, 'second')
+ gen_id_2, '/foo/bar', obnamlib.REPO_FILE_SYMLINK_TARGET, 'second')
self.repo.commit_client('fooclient')
self.repo.unlock_client('fooclient')
value = self.repo.get_file_key(
- gen_id, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY)
+ gen_id, '/foo/bar', obnamlib.REPO_FILE_SYMLINK_TARGET)
self.assertEqual(value, 'first')
value_2 = self.repo.get_file_key(
- gen_id_2, '/foo/bar', obnamlib.REPO_FILE_TEST_KEY)
+ gen_id_2, '/foo/bar', obnamlib.REPO_FILE_SYMLINK_TARGET)
self.assertEqual(value_2, 'second')
def test_new_file_has_no_chunk_ids(self):