summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-08-24 08:25:56 +0100
committerLars Wirzenius <liw@liw.fi>2013-08-24 08:25:56 +0100
commita2532321a330ec7edba3230137c6e8739c68b256 (patch)
tree145324ee106b42f300cb5a8f04666b86e5c9ea39
parentcb7173f2ab04edea858977c9a23365efde962b1a (diff)
downloadobnam-a2532321a330ec7edba3230137c6e8739c68b256.tar.gz
Patches to port Obnam to FreeBSD
By Itamar Turner-Trauring.
-rw-r--r--_obnammodule.c81
-rw-r--r--obnamlib/lockmgr.py4
-rw-r--r--obnamlib/metadata.py6
-rw-r--r--obnamlib/metadata_tests.py4
-rw-r--r--obnamlib/vfs.py12
-rw-r--r--obnamlib/vfs_local.py17
-rw-r--r--obnamlib/vfs_local_tests.py29
-rwxr-xr-xtest-many-generations2
-rwxr-xr-xtests/convert5to6.script8
-rwxr-xr-xtests/encryption-replaces-key.script2
-rwxr-xr-xtests/forget-removes-according-to-policy.script8
-rwxr-xr-xtests/forget-removes-specified-gens.script8
-rwxr-xr-xtests/logs-for-owner-only.script2
-rw-r--r--tests/logs-for-owner-only.stdout2
-rwxr-xr-xtests/named-pipe.script2
-rwxr-xr-xtests/named-socket.script4
-rwxr-xr-xtests/pretend-time.script2
-rwxr-xr-xtests/remove-checkpoints.script2
-rwxr-xr-xtests/unreadable-dir.script2
-rwxr-xr-xtests/use-old-node-size.script2
-rwxr-xr-xtests/verify8
-rwxr-xr-xtests/verify-notices-changes.script2
22 files changed, 170 insertions, 39 deletions
diff --git a/_obnammodule.c b/_obnammodule.c
index f3e208bc..a5f93acb 100644
--- a/_obnammodule.c
+++ b/_obnammodule.c
@@ -45,10 +45,17 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/xattr.h>
#include <unistd.h>
#include <stdlib.h>
+#ifdef __FreeBSD__
+ #include <sys/extattr.h>
+ #define NO_NANOSECONDS 1
+#else
+ #include <sys/xattr.h>
+ #define NO_NANOSECONDS 0
+#endif
+
static PyObject *
fadvise_dontneed(PyObject *self, PyObject *args)
@@ -78,8 +85,11 @@ utimensat_wrapper(PyObject *self, PyObject *args)
const char *filename;
long atime_sec, atime_nsec;
long mtime_sec, mtime_nsec;
+#if NO_NANOSECONDS
+ struct timeval tv[2];
+#else
struct timespec tv[2];
-
+#endif
if (!PyArg_ParseTuple(args, "sllll",
&filename,
&atime_sec,
@@ -88,17 +98,41 @@ utimensat_wrapper(PyObject *self, PyObject *args)
&mtime_nsec))
return NULL;
+#if NO_NANOSECONDS
+ tv[0].tv_sec = atime_sec;
+ tv[0].tv_usec = atime_nsec / 1000;
+ tv[1].tv_sec = mtime_sec;
+ tv[1].tv_usec = mtime_nsec / 1000;
+ ret = lutimes(filename, tv);
+#else
tv[0].tv_sec = atime_sec;
tv[0].tv_nsec = atime_nsec;
tv[1].tv_sec = mtime_sec;
tv[1].tv_nsec = mtime_nsec;
ret = utimensat(AT_FDCWD, filename, tv, AT_SYMLINK_NOFOLLOW);
+#endif
if (ret == -1)
ret = errno;
return Py_BuildValue("i", ret);
}
+/*
+Since we can't set nanosecond mtime and atimes on some platforms, also
+don't retrieve that level of precision from lstat(), so comparisons
+work.
+*/
+unsigned long long
+remove_precision(unsigned long long nanoseconds)
+{
+#if NO_NANOSECONDS
+ return nanoseconds - (nanoseconds % 1000);
+#else
+ return nanoseconds;
+#endif
+}
+
+
static PyObject *
lstat_wrapper(PyObject *self, PyObject *args)
{
@@ -126,11 +160,11 @@ lstat_wrapper(PyObject *self, PyObject *args)
(long long) st.st_blksize,
(long long) st.st_blocks,
(long long) st.st_atim.tv_sec,
- (unsigned long long) st.st_atim.tv_nsec,
+ remove_precision(st.st_atim.tv_nsec),
(long long) st.st_mtim.tv_sec,
- (unsigned long long) st.st_mtim.tv_nsec,
+ remove_precision(st.st_mtim.tv_nsec),
(long long) st.st_ctim.tv_sec,
- (unsigned long long) st.st_ctim.tv_nsec);
+ remove_precision(st.st_ctim.tv_nsec));
}
@@ -140,16 +174,38 @@ llistxattr_wrapper(PyObject *self, PyObject *args)
const char *filename;
size_t bufsize;
PyObject *o;
+ char* buf;
+ ssize_t n;
if (!PyArg_ParseTuple(args, "s", &filename))
return NULL;
+#ifdef __FreeBSD__
+ bufsize = extattr_list_link(filename, EXTATTR_NAMESPACE_USER, NULL, 0);
+ buf = malloc(bufsize);
+ n = extattr_list_link(filename, EXTATTR_NAMESPACE_USER, buf, bufsize);
+ if (n >= 0) {
+ /* Convert from length-prefixed BSD style to '\0'-suffixed
+ Linux style. */
+ size_t i = 0;
+ while (i < n) {
+ unsigned char length = (unsigned char) buf[i];
+ memmove(buf + i, buf + i + 1, length);
+ buf[i + length] = '\0';
+ i += length + 1;
+ }
+ o = Py_BuildValue("s#", buf, (int) n);
+ } else {
+ o = Py_BuildValue("i", errno);
+ }
+ free(buf);
+#else
bufsize = 0;
o = NULL;
do {
bufsize += 1024;
- char *buf = malloc(bufsize);
- ssize_t n = llistxattr(filename, buf, bufsize);
+ buf = malloc(bufsize);
+ n = llistxattr(filename, buf, bufsize);
if (n >= 0)
o = Py_BuildValue("s#", buf, (int) n);
@@ -157,7 +213,7 @@ llistxattr_wrapper(PyObject *self, PyObject *args)
o = Py_BuildValue("i", errno);
free(buf);
} while (o == NULL);
-
+#endif
return o;
}
@@ -178,8 +234,11 @@ lgetxattr_wrapper(PyObject *self, PyObject *args)
do {
bufsize += 1024;
char *buf = malloc(bufsize);
+#ifdef __FreeBSD__
+ int n = extattr_get_link(filename, EXTATTR_NAMESPACE_USER, attrname, buf, bufsize);
+#else
ssize_t n = lgetxattr(filename, attrname, buf, bufsize);
-
+#endif
if (n >= 0)
o = Py_BuildValue("s#", buf, (int) n);
else if (n == -1 && errno != ERANGE)
@@ -203,7 +262,11 @@ lsetxattr_wrapper(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "sss#", &filename, &name, &value, &size))
return NULL;
+#ifdef __FreeBSD__
+ ret = extattr_set_link(filename, EXTATTR_NAMESPACE_USER, name, value, size);
+#else
ret = lsetxattr(filename, name, value, size, 0);
+#endif
if (ret == -1)
ret = errno;
return Py_BuildValue("i", ret);
diff --git a/obnamlib/lockmgr.py b/obnamlib/lockmgr.py
index 87f148a7..0e35dd30 100644
--- a/obnamlib/lockmgr.py
+++ b/obnamlib/lockmgr.py
@@ -33,11 +33,11 @@ class LockManager(object):
data = data + self._read_boot_id()
self.data = '\r\n'.join(data)
- def _read_boot_id(self):
+ def _read_boot_id(self): # pragma: no cover
try:
with open("/proc/sys/kernel/random/boot_id", "r") as f:
boot_id = f.read().strip()
- except: # pragma: no cover
+ except:
return []
else:
return ["boot_id=%s" % boot_id]
diff --git a/obnamlib/metadata.py b/obnamlib/metadata.py
index 94b87a73..9bb2d0d9 100644
--- a/obnamlib/metadata.py
+++ b/obnamlib/metadata.py
@@ -25,6 +25,8 @@ import tracing
import obnamlib
+# lchmod is not available on Linux:
+LCHMOD_AVAILABLE = getattr(os, "lchmod", None) is not None
metadata_verify_fields = (
'st_mode', 'st_mtime_sec', 'st_mtime_nsec',
@@ -247,13 +249,13 @@ def set_metadata(fs, filename, metadata, getuid=None):
if getuid() == 0:
fs.lchown(filename, metadata.st_uid, metadata.st_gid)
- if not symlink:
+ if LCHMOD_AVAILABLE or not symlink:
# If we are not the owner, and not root, do not restore setuid/setgid.
mode = metadata.st_mode
if getuid() not in (0, metadata.st_uid): # pragma: no cover
mode = mode & (~stat.S_ISUID)
mode = mode & (~stat.S_ISGID)
- fs.chmod(filename, mode)
+ fs.lchmod(filename, mode)
if metadata.xattr: # pragma: no cover
set_xattrs_from_blob(fs, filename, metadata.xattr)
diff --git a/obnamlib/metadata_tests.py b/obnamlib/metadata_tests.py
index f77abe1b..557f2c97 100644
--- a/obnamlib/metadata_tests.py
+++ b/obnamlib/metadata_tests.py
@@ -18,6 +18,7 @@ import os
import stat
import tempfile
import unittest
+import platform
import obnamlib
@@ -175,6 +176,9 @@ class SetMetadataTests(unittest.TestCase):
fd, self.filename = tempfile.mkstemp()
os.close(fd)
+ # On some systems (e.g. FreeBSD) /tmp is apparently setgid and
+ # default gid of files is therefore not the user's gid.
+ os.chown(self.filename, os.getuid(), os.getgid())
self.fs = obnamlib.LocalFS('/')
self.fs.connect()
diff --git a/obnamlib/vfs.py b/obnamlib/vfs.py
index bf470078..207d4c35 100644
--- a/obnamlib/vfs.py
+++ b/obnamlib/vfs.py
@@ -160,8 +160,8 @@ class VirtualFileSystem(object):
def lchown(self, pathname, uid, gid):
'''Like os.lchown.'''
- def chmod(self, pathname, mode):
- '''Like os.chmod.'''
+ def lchmod(self, pathname, mode):
+ '''Like os.lchmod.'''
def lutimes(self, pathname, atime_sec, atime_nsec, mtime_sec, mtime_nsec):
'''Like lutimes(2).
@@ -523,13 +523,13 @@ class VfsTests(object): # pragma: no cover
def test_lstat_raises_oserror_for_nonexistent_entry(self):
self.assertRaises(OSError, self.fs.lstat, 'notexists')
- def test_chmod_sets_permissions_correctly(self):
+ def test_lchmod_sets_permissions_correctly(self):
self.fs.mkdir('foo')
- self.fs.chmod('foo', 0777)
+ self.fs.lchmod('foo', 0777)
self.assertEqual(self.fs.lstat('foo').st_mode & 0777, 0777)
- def test_chmod_raises_oserror_for_nonexistent_entry(self):
- self.assertRaises(OSError, self.fs.chmod, 'notexists', 0)
+ def test_lchmod_raises_oserror_for_nonexistent_entry(self):
+ self.assertRaises(OSError, self.fs.lchmod, 'notexists', 0)
def test_lutimes_sets_times_correctly(self):
self.fs.mkdir('foo')
diff --git a/obnamlib/vfs_local.py b/obnamlib/vfs_local.py
index 639f4451..20b0dc7d 100644
--- a/obnamlib/vfs_local.py
+++ b/obnamlib/vfs_local.py
@@ -29,6 +29,15 @@ import tracing
import obnamlib
+# O_NOATIME is Linux specific:
+EXTRA_OPEN_FLAGS = getattr(os, "O_NOATIME", 0)
+
+# On Linux, lchmod() is not available. We make sure not to call it
+# with symlinks (see obnamlib.metadata.set_metadata) so falling back
+# to os.chmod is fine.
+lchmod = getattr(os, "lchmod", os.chmod)
+
+
class LocalFSFile(file):
def read(self, amount=-1):
@@ -191,9 +200,9 @@ class LocalFS(obnamlib.VirtualFileSystem):
tracing.trace('lchown %s %d %d', pathname, uid, gid)
os.lchown(self.join(pathname), uid, gid)
- def chmod(self, pathname, mode):
- tracing.trace('chmod %s %o', pathname, mode)
- os.chmod(self.join(pathname), mode)
+ def lchmod(self, pathname, mode):
+ tracing.trace('lchmod %s %o', pathname, mode)
+ lchmod(self.join(pathname), mode)
def lutimes(self, pathname, atime_sec, atime_nsec, mtime_sec, mtime_nsec):
assert atime_sec is not None
@@ -228,7 +237,7 @@ class LocalFS(obnamlib.VirtualFileSystem):
tracing.trace('opened %s', pathname)
try:
flags = fcntl.fcntl(f.fileno(), fcntl.F_GETFL)
- flags |= os.O_NOATIME
+ flags |= EXTRA_OPEN_FLAGS
fcntl.fcntl(f.fileno(), fcntl.F_SETFL, flags)
except IOError, e: # pragma: no cover
tracing.trace('fcntl F_SETFL failed: %s', repr(e))
diff --git a/obnamlib/vfs_local_tests.py b/obnamlib/vfs_local_tests.py
index f654eb81..071ebae8 100644
--- a/obnamlib/vfs_local_tests.py
+++ b/obnamlib/vfs_local_tests.py
@@ -14,7 +14,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
+import platform
import errno
import os
import shutil
@@ -22,6 +22,7 @@ import tempfile
import unittest
import obnamlib
+from obnamlib import _obnam
class LocalFSTests(obnamlib.VfsTests, unittest.TestCase):
@@ -45,5 +46,29 @@ class LocalFSTests(obnamlib.VfsTests, unittest.TestCase):
self.assertEqual(self.fs.get_username(0), 'root')
def test_get_groupname_returns_root_for_zero(self):
- self.assertEqual(self.fs.get_groupname(0), 'root')
+ root = 'wheel' if platform.system() == 'FreeBSD' else 'root'
+ self.assertEqual(self.fs.get_groupname(0), root)
+
+
+class XAttrTests(unittest.TestCase):
+ '''Tests for extended attributes.'''
+
+ def setUp(self):
+ fd, self.filename = tempfile.mkstemp()
+ os.close(fd)
+
+ def test_empty_list(self):
+ '''A new file has no extended attributes.'''
+ self.assertEqual(_obnam.llistxattr(self.filename), "")
+
+ def test_lsetxattr(self):
+ '''lsetxattr() sets an attribute on a file.'''
+ _obnam.lsetxattr(self.filename, "user.key", "value")
+ _obnam.lsetxattr(self.filename, "user.hello", "world")
+ self.assertEqual(sorted(_obnam.llistxattr(self.filename).strip("\0").split("\0")),
+ ["user.hello", "user.key"])
+ def test_lgetxattr(self):
+ '''lgetxattr() gets the value of an attribute set on the file.'''
+ _obnam.lsetxattr(self.filename, "user.hello", "world")
+ self.assertEqual(_obnam.lgetxattr(self.filename, "user.hello"), "world")
diff --git a/test-many-generations b/test-many-generations
index 741f67c4..bec9e6d4 100755
--- a/test-many-generations
+++ b/test-many-generations
@@ -55,7 +55,7 @@ seq "$N" |
while read gen
do
genbackupdata --quiet --create="$amount" "$root" --seed="$RANDOM"
- find "$root" -exec touch --date="1970-01-01 00:00:$gen" '{}' ';'
+ find "$root" -exec touch -d "1970-01-01 00:00:$gen" '{}' ';'
./verification-test backup "$repopath" "$root" "$conf" \
>> "$client-verif.output" 2>&1 || exit 1
done || exit 1
diff --git a/tests/convert5to6.script b/tests/convert5to6.script
index c4936043..aeacf2b1 100755
--- a/tests/convert5to6.script
+++ b/tests/convert5to6.script
@@ -19,6 +19,12 @@
set -eu
+# GNU sed is required:
+if [ -e /usr/local/bin/gsed ]; then
+ SED=/usr/local/bin/gsed; else
+ SED=sed
+fi
+
cd "$DATADIR"
tar -xf "$SRCDIR/test-data/repo-format-5-encrypted-gzipped.tar.gz"
"$SRCDIR/tests/obnam" convert5to6 \
@@ -32,7 +38,7 @@ tar -xf "$SRCDIR/test-data/repo-format-5-encrypted-gzipped.tar.gz"
# Not all filesystems support nanosecond timestamps, but that doesn't
# matter for us. So we remove the sub-second timestamps from both
# summain files.
-sed -i '/^Mtime:/s/\.[0-9]* /.IGNORED /' data.summain restored.summain
+$SED -i '/^Mtime:/s/\.[0-9]* /.IGNORED /' data.summain restored.summain
diff -u data.summain restored.summain
diff --git a/tests/encryption-replaces-key.script b/tests/encryption-replaces-key.script
index d2f31321..afc89778 100755
--- a/tests/encryption-replaces-key.script
+++ b/tests/encryption-replaces-key.script
@@ -33,7 +33,7 @@ $SRCDIR/tests/obnam --encrypt-with="$gpgkey2" remove-key --keyid="$gpgkey" \
# Remove the old key from the gpg keyring.
export GNUPGHOME="$DATADIR/gpg"
-gpg --batch --delete-secret-key "$fingerprint"
+gpg --batch --delete-secret-key "$fingerprint" 2>/dev/null
# Verify that the backup is still readable, now with the new key.
$SRCDIR/tests/restore --encrypt-with="$gpgkey2"
diff --git a/tests/forget-removes-according-to-policy.script b/tests/forget-removes-according-to-policy.script
index 12d5ab0f..25a603f1 100755
--- a/tests/forget-removes-according-to-policy.script
+++ b/tests/forget-removes-according-to-policy.script
@@ -19,12 +19,18 @@ set -e
echo aaa > "$DATADIR/data/aaa"
echo ccc > "$DATADIR/data/ccc"
+# GNU sed is required:
+if [ -e /usr/local/bin/gsed ]; then
+ SED=/usr/local/bin/gsed; else
+ SED=sed
+fi
+
$SRCDIR/tests/backup
$SRCDIR/tests/backup
$SRCDIR/tests/obnam genids > "$DATADIR/genids-1"
$SRCDIR/tests/obnam forget --keep=1d
-sed -i 1d "$DATADIR/genids-1"
+$SED -i 1d "$DATADIR/genids-1"
$SRCDIR/tests/obnam genids > "$DATADIR/genids-2"
diff -u "$DATADIR/genids-1" "$DATADIR/genids-2"
diff --git a/tests/forget-removes-specified-gens.script b/tests/forget-removes-specified-gens.script
index 2565590e..e0de9d47 100755
--- a/tests/forget-removes-specified-gens.script
+++ b/tests/forget-removes-specified-gens.script
@@ -16,6 +16,12 @@
set -e
+# GNU sed is required:
+if [ -e /usr/local/bin/gsed ]; then
+ SED=/usr/local/bin/gsed; else
+ SED=sed
+fi
+
echo aaa > "$DATADIR/data/aaa"
echo ccc > "$DATADIR/data/ccc"
@@ -24,7 +30,7 @@ $SRCDIR/tests/backup
$SRCDIR/tests/obnam genids > "$DATADIR/genids-1"
$SRCDIR/tests/obnam forget $(head -n1 "$DATADIR/genids-1")
-sed -i 1d "$DATADIR/genids-1"
+$SED -i 1d "$DATADIR/genids-1"
$SRCDIR/tests/obnam genids > "$DATADIR/genids-2"
diff -u "$DATADIR/genids-1" "$DATADIR/genids-2"
diff --git a/tests/logs-for-owner-only.script b/tests/logs-for-owner-only.script
index 920620c0..9e665f54 100755
--- a/tests/logs-for-owner-only.script
+++ b/tests/logs-for-owner-only.script
@@ -19,5 +19,5 @@ set -e
$SRCDIR/tests/backup --log="$DATADIR/obnam.log"
# Print out the permissions.
-stat --printf '%A\n' "$DATADIR/obnam.log"
+python -c "import sys, os; print os.lstat(sys.argv[1]).st_mode" "$DATADIR/obnam.log"
diff --git a/tests/logs-for-owner-only.stdout b/tests/logs-for-owner-only.stdout
index 2bdc0369..7bd2e962 100644
--- a/tests/logs-for-owner-only.stdout
+++ b/tests/logs-for-owner-only.stdout
@@ -1 +1 @@
--rw-------
+33152
diff --git a/tests/named-pipe.script b/tests/named-pipe.script
index 0f2ccd35..a0f0d09c 100755
--- a/tests/named-pipe.script
+++ b/tests/named-pipe.script
@@ -23,7 +23,7 @@ then
fi
# Create a named pipe.
-mknod "$DATADIR/data/pipe" p
+mkfifo "$DATADIR/data/pipe"
$SRCDIR/tests/backup
$SRCDIR/tests/restore
diff --git a/tests/named-socket.script b/tests/named-socket.script
index 7f87a321..1d4d08e1 100755
--- a/tests/named-socket.script
+++ b/tests/named-socket.script
@@ -24,6 +24,10 @@ fi
# Create a named socket.
python -c '
+import platform
+if platform.system() == "FreeBSD":
+ # Cannot mknod sockets on FreeBSD.
+ raise SystemExit(0)
import os, stat
filename = os.path.join(os.environ["DATADIR"], "data", "socket")
os.mknod(filename, 0600 | stat.S_IFSOCK)
diff --git a/tests/pretend-time.script b/tests/pretend-time.script
index 8296b157..ac616e44 100755
--- a/tests/pretend-time.script
+++ b/tests/pretend-time.script
@@ -20,4 +20,4 @@ $SRCDIR/tests/backup --pretend-time='2007-08-12 01:02:03'
# Print out the generation timestamp.
$SRCDIR/tests/obnam $opts generations |
- sed 's/([0-9]\+ files/(xx files/'
+ sed 's/([0-9]* files/(xx files/'
diff --git a/tests/remove-checkpoints.script b/tests/remove-checkpoints.script
index 1a70921c..d61c7e06 100755
--- a/tests/remove-checkpoints.script
+++ b/tests/remove-checkpoints.script
@@ -19,5 +19,5 @@ set -e
$SRCDIR/tests/backup --checkpoint=1k
# Check that there's only one generation.
-$SRCDIR/tests/obnam genids | wc -l
+$SRCDIR/tests/obnam genids | wc -l | sed 's/ *//'
diff --git a/tests/unreadable-dir.script b/tests/unreadable-dir.script
index 7533b589..71fe28aa 100755
--- a/tests/unreadable-dir.script
+++ b/tests/unreadable-dir.script
@@ -17,7 +17,7 @@
set -e
echo aaa > "$DATADIR/data/aaa"
-mkdir --mode=0 "$DATADIR/data/bbb"
+mkdir -m 0 "$DATADIR/data/bbb"
echo ccc > "$DATADIR/data/ccc"
if $SRCDIR/tests/backup
diff --git a/tests/use-old-node-size.script b/tests/use-old-node-size.script
index 7c905182..a540db10 100755
--- a/tests/use-old-node-size.script
+++ b/tests/use-old-node-size.script
@@ -20,5 +20,5 @@ $SRCDIR/tests/backup --node-size=4k
$SRCDIR/tests/backup --node-size=16k
# Check that there's two generations.
-$SRCDIR/tests/obnam $opts genids | wc -l
+$SRCDIR/tests/obnam $opts genids | wc -l | sed 's/ *//'
diff --git a/tests/verify b/tests/verify
index d064a98b..bfac1c6e 100755
--- a/tests/verify
+++ b/tests/verify
@@ -18,6 +18,12 @@
set -e
+# GNU sed is required:
+if [ -e /usr/local/bin/gsed ]; then
+ SED=/usr/local/bin/gsed; else
+ SED=sed
+fi
+
summain -r "$DATADIR/data" > "$DATADIR/data.summain"
summain -r "$DATADIR/restored/$DATADIR/data" > "$DATADIR/restored.summain"
@@ -25,7 +31,7 @@ summain -r "$DATADIR/restored/$DATADIR/data" > "$DATADIR/restored.summain"
# summain output to remove sub-second timestamps.
if [ "$OBNAM_TEST_SFTP_ROOT" = yes ]
then
- sed -i '/^Mtime:/s/\.[[:digit:]]\+ / /' \
+ $SED -i '/^Mtime:/s/\.[[:digit:]]\+ / /' \
"$DATADIR/data.summain" \
"$DATADIR/restored.summain"
fi
diff --git a/tests/verify-notices-changes.script b/tests/verify-notices-changes.script
index 45e01e2b..6443c0c0 100755
--- a/tests/verify-notices-changes.script
+++ b/tests/verify-notices-changes.script
@@ -21,7 +21,7 @@ echo ccc > "$DATADIR/data/ccc"
$SRCDIR/tests/backup
-touch --date="1970-01-02 03:04:05" "$DATADIR/data/aaa"
+touch -d "1970-01-02 03:04:05" "$DATADIR/data/aaa"
$SRCDIR/tests/obnam verify "$(cat $DATADIR/rooturl)" 2>&1 |
sed "s,$DATADIR,TMP,g" |