Documentation: replace ~/.bup with $BUP_DIR in bup-index.md and bup-save.md.

When one is not using the default bupdir placement, then those files
aren't found inside ~/.bup, but wherever "-d /path.." or $BUP_DIR are
pointing to.

Thanks to krichter722@aol.de for mentioning this.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Catch errors when restoring Linux attrs into xfs or btrfs

Both xfs and btrfs turn out to return EOPNOTSUPP, rather than ENOTTY,
when we try to apply Linux attrs that they do not support.  This patch
improves matters in that it ensures we can restore into these file
systems without crashing, but does not quite address all issues yet:

- if any of the attributes we try to apply is not supported, none of
  them will be applied to the file at all
- the user will typically drown in error output; eg. for a backup
  originating from an ext4 file system, we can expect endless error
  output relating to the extents-flag not being supported on xfs/btrfs

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
README.md: describe mmap problems with limited address spaces.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
meta-cmd.py: mention --list in the invocation summary.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Use sys.platform instead of platform.system().

If nothing else, the former is computed at compile time, and so should
be more efficient.  Use the recommended "startswith()" idiom.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
metadata.py: use socket() instead of mknod(...IF_SOCK) on Cygwin.

Apparently os.mknod(...IF_SOCK) fails on Cygwin, but our t/mksock tool
(which uses socket()) works just fine, so use that in
_create_via_common_rec() when on Cygwin.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Remove lib.sh actually-root in favor of t/root-status.

Create a t/root-status command that outputs root, fake, or none and
that uses the same cross-platform logic as helpers.py is_superuser().
Use it everywhere.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/compare-trees: don't check ACLs on Cygwin (no support).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
README.md: add Cygwin dependencies.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/test.sh: skip two "tree SHA1 didn't change" tests on Cygwin for now.

Apparently Cygwin has some unusual behaviors with respect to access
times, so disable these two tests for now.

Possibly related: http://cygwin.com/ml/cygwin/2007-06/msg00436.html

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Skip the large bloom filter test if mmap fails on 32-bit archtectures.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Fix completely broken invocations of t/root-status.

No idea what I was thinking.

Thanks to Sascha Silbe <sascha-ml-reply-to-2013-2@silbe.org> for the
report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
git.py: flush idx_map before close so FILE* operations will see changes.

Flush idx_map (msync()) before closing it, since it doesn't look like
POSIX guarantees that a matching FILE* (i.e. idx_f) will see the
parallel changes if we don't.

From the original report:

  After `bup save`, `git fsck` would show messages like
  "Packfile index for %s SHA1 mismatch"
  This indicated a bad trailing checksum on the pack index file.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reported-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Reviewed-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Tested-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
config/configure: add and use bup_find_prog; remove unused MF_PATH_INCLUDEs.

Pull all the common program search code into bup_find_prog() and use
it everywhere.  This also makes configure's output a bit more
consistent in style/content.

Make it obvious that at the moment bup doesn't pay any attention to a
PYTHON or GIT environment variable value. i.e. bup currently ignores a
setting like PYTHON=python2.7.

Bup also doesn't use MF_PATH_INCLUDE settings yet, so remove them.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Completely disable ACL support on OS X for now.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Makefile: add any environmental CFLAGS to the end of the effective CFLAGS.

For now, just do the simplest thing.

Thanks to Greg Troxel <gdt@ir.bbn.com> for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Currently bup only indexes physical parent paths; adjust tests.

Fix tests that fail on systems where components of the parent path are
symlinks (like /tmp on OS X).  i.e. if you run:

  bup index /x/y/z

bup might actually store

  /a/z...

if y is a symlink to a.  See index-cmd.py and index.reduce_paths().

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: handle test.sh fix differently; add realpath();
 adjust commit message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
_create_via_common_rec: treat rmdir() EEXIST like ENOTEMPTY.

See rmdir(2):

       ENOTEMPTY
              pathname contains entries other than .  and ..  ; or,
              pathname has ..  as its final component.  POSIX.1-2001
              also allows EEXIST for this condition.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
_apply_linux_attr_rec: treat ENOSYS like EOPNOTSUPP (seen via sshfs).

After reports that set_linux_file_attr() produces ENOSYS on sshfs,
raise raise ApplyError for ENOSYS too.

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