Don't require non-negative timespec ns; fix stat timestamp conversions.

Previously we required that the system timespec tv_nsec values be
non-negative -- stop that.  POSIX doesn't specify, and there's no real
need for us to care, since all significant timestamp manipulations are
now handled as integer nanosecond values, not (sec, ns) pairs.

Change stat_struct_to_py() (used by bup_stat()/bup_lstat()) to use
INTEGER_TO_PY() to convert the timestamp st_atime/st_mtime/st_ctime
values so that we don't have to care about the sign/size of the
underlying type (which should be time_t).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move save --strip/--graft tests from test.sh to test-save-strip-graft.sh.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move import-rdiff-backup tests from test.sh to test-import-rdiff-backup.sh.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move compression tests from test.sh to test-compression.sh.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move test.sh exclude tests to renamed test-save-restore-excludes.sh.

Rename test-save-restore-exclude-rx.sh to
test-save-restore-excludes.sh, and move test.sh exclude tests there.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move clear-index tests from test.sh to test-index-clear.sh.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move the main fsck tests from test.sh to test-fsck.sh.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Check for overflow when converting from Python to unsigned integer types.

Python's PyArg_ParseTuple() unsigned integer type conversions don't
check for overflow, so stop using them.  Add bup_uint_from_py(),
bup_ulong_from_py(), and bup_ullong_from_py() functions that do check,
and use them instead.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
bup-join.md bup-save.md: note that even with "-r" a local repo is required.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
bup-restore.md: always initialize root_meta in do_root.

Previously, using bup split with bup restore would cause an error:

  UnboundLocalError: local variable 'root_meta' referenced before assignment

Signed-off-by: itxx00 <itxx00@gmail.com>
[rlb@defaultvalue.org: adjust commit message.  Initialize root_meta
 unconditionally before guard to match other code.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Mention par2 as one of the reasons you might want to avoid bup.

(i.e. add it to the informal list of requirements)

Thanks to James Lott <james@lottspot.com> for the suggestion.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
metadata.py: remove obsolete comments.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
tgit.py: use a tmpdir in t/tmp instead of working directly in lib/bup/t/.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Change -x/--xdev/--one-filesystem to include the mount point itself.

Match rsync, tar, etc., and add and use t/cleanup-mounts-under to
clean up all temporary mounts under t/mnt and t/tmp.

Thanks to Karl Kiniger <karl.kiniger@med.ge.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Karl Kiniger <karl.kiniger@med.ge.com>
tbloom.py: use a tmpdir in t/tmp instead of working directly in lib/bup/t/.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
save-cmd.py: disallow backup set names containing "/".

There's no way to refer to them via the VFS, because the VFS (as
expected) treats all forward slashes as path separators.

Before this change, it was possible to create backup sets with names
like "x/y/z" that were inaccessible via ls, restore, etc.

Thanks to Laura Morrissey <laura.morrissey@gmail.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
tclient.py: use a tmpdir in t/tmp instead of working directly in lib/bup/t/.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
tindex.py: use a tmpdir in t/tmp instead of working directly in lib/bup/t/.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
tmetadata.py, txstat.py: use t/tmp as the tmpdir parent.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
tmetadata.py, txstat.py: don't remove tmpdirs when tests fail.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>