Be more careful when testing that repeated saves can produce the same tree.

Previously, test.sh would run multiple saves with no intervening
modifications, and check to see that the top-level "save -t" hash
didn't change, but with the addition of metadata this may fail on some
platforms where the test process itself (the save runs, etc.) affects
atime values.  That's because save is pulling the metadata for
unindexed parent directories directly from the filesystem.  And note
that atime is only special here because the test itself may
incidentally alter it -- we would see the same problem if any of the
other metdata for one of the unindexed parent directories changed
during the test run (i.e. mtime, uid, gid, ...).

To fix this, move the relevant test code from test.sh to
test-redundant-saves.sh, and use a newly added subdir-hash tool so
that we can compare the hashes of the roots of the indexed subtrees
instead of the top-level "save -t" hashes, ignoring the unindexed
parents entirely.

Thanks to Robert Edmonds <edmonds@debian.org> for running rc3 through
the Debian buildds which lead to the kFreeBSD test failure that
demonstrated the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Handle EOPNOTSUPP as an indicator that Linux attrs are not supported.

Add EOPNOTSUPP to the set of errno values in _add_linux_attr() that
indicate Linux attrs are not supported by the target filesystem.  The
problem was observed on ZFS-on-Linux, 0.6.2.

Thanks to Will Rouesnel <w.rouesnel@gmail.com> for the report and an
initial patch.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Fall back from mknod() to socket()/bind() on EPERM for SOCK_STREAM.

Apparently OS X is throwing EPERM for mknod(... SOCK_STREAM), and the
current OS X manpage does state that mknod() requires superuser
privileges.

Thanks to Zoran Zaric <zz@zoranzaric.de> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
bloom-cmd.py: close open file object for tfname before attempting a rename.

Ben Kelly reported a an IOException (permission denied) during "bup
bloom" on Cygwin.  The exception was caused by the attempt to
os.rename(tfname, outfilename) in do_bloom().

This appears to be because Cygwin doesn't allow you to rename a file
while it's still open.  At first, we thought this might be because
bloom.py create() opens tfname, passes the resulting file to ShaBloom,
and then no one ever explicitly closes it.  So if the gc hasn't
collected the ShaBloom object before the rename, we're in trouble.

However, the problem may also have been caused by an unrelated process
scanning the file at the same time.

In any case, for the moment, explicitly close the ShaBloom object
before the rename.  That shouldn't hurt, and may help.

Thanks to Ben Kelly <btk@google.com> for the report.

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