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>
config/configure: ignore utimensat on GNU/kFreeBSD.

Even though we'll find it, it won't work.

See also:

  http://bugs.debian.org/651104
  http://lists.debian.org/debian-bsd/2011/03/msg00063.html

Signed-off-by: Gonéri Le Bouder <goneri@rulezlan.org>
[rlb@defaultvalue.org: adjust indentation, comments, and message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/compare-trees: check rsync capability support correctly.

Handle older versions of rsync (where nothing was printed), and for
newer versions, check for "no FOO" rather than "FOO", since FOO will
always be listed one way or the other.

Handle ACL and xattr support independently.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Skip test_handling_of_incorrect_existing_linux_xattrs() when under fakeroot.

Don't try to do a loopback mount when running under fakeroot ("mount:
only root can do that").

Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Documentation/bup-tag.md: fix spelling error "retreive"

Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
Reviewed-by Zoran Zaric <zz@zoranzaric.de>
_helpers.c: be careful about memory alignment in bloom operations.

Debian (Bug#641488) discovered via the bloom test that bup crashes on
sparc because it's trying to access unaligned memory.  Fix that.

Signed-off-by: Julien Cristau <jcristau@debian.org>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
DESIGN: fix typo.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
test-meta.sh: use the more portable "touch -t" instead of "touch -d".

Thanks to Greg Troxel <gdt@work.lexort.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
web-cmd.py: add a tornado import guard like the one for fuse in fuse-cmd.py.

In Debian, we replace the embedded copy of tornado with a Recommends on
the python-tornado package. Print a nice error message instead of a
backtrace if the user doesn't have it installed.

Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
[rlb@defaultvalue.org: edited commit and error message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
web-cmd.py: accommodate HTTPServer s/_socket/_sockets/ in newer versions.

Newer versions of tornado changed HTTPServer._socket to
HTTPServer._sockets, with slightly different semantics.  Handle both.

Thanks to Andy Somerville <andy.somerville@gmail.com> for reporting
the problem and proposing an initial patch.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
fuse-cmd.py: match the style of the import failure message in web-cmd.py.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
git.py: don't automatically initialize ~/.bup if it doesn't exist.

bup had a convenience feature where commands would automagically
initialize a repo in ~/.bup if it didn't exist and no other BUP_DIR
was given.

This had the odd effect that when one forgot to specify BUP_DIR, a bup
repo would be initialized in ~/.bup even though only a browsing
command was used.

This patch drops that behaviour.  Now all repositories must be
explicitly intiialized via "bup init".

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: edit commit message; fix test ("set +e" during
 init run).]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
README.md: add a "bup init" step to "Using bup" since we killed auto-init.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
split-cmd.py: change -N to --noop (which actually exists) in error messages.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjusted commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
main.py: forward SIGTSTP/SIGCONT so "C-z" will actually suspend everything.

Catch and forward SIGTSTP (as SIGSTOP) and SIGCONT to the subprocess
as we already do for SIGTERM and SIGINT so that the subprocess will
also suspend/resume.

This still leaves bup with potentially unexpected behavior since the
(detached) subprocess will never see a SIGSTOP delivered to the parent
(because SIGSTOP can't be intercepted and forwarded).  This is due to
the os.setsid() call that was originally introduced to support current
newliner arrangement (cf. b7a524ccb662c9ed3ebd786da0f45f459929ef45).

Thanks to Kalle for the report.

Reported-by: krichter722@aol.de
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
save-cmd.py: don't write an irrelevant and incomplete .bupm fragment.

When finishing up (leaving) a directory and preparing to store its
related tree in the repository, don't write the pending .bupm (which
is still incomplete) to the pack if we know the directory already
exists in the repository (i.e. when we're not going to write it
either).

This problem was discovered when Zoran noticed that two consecutive
saves without an intervening index could produce a repository with an
unreferenced blob (according to git fsck).

Reported-by: Zoran Zaric <zz@zoranzaric.de>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Add --human-readable option to "bup web".

When --human-readable is specified, print sizes like 3.5K, 1.8G,
etc., instead of the exact byte count.

Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message; squash two of Kumar's
 patches into this one.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Add -l and --human-readable options to "bup ls".

When -l is specified, include the size in bytes for each item.

When --human-readable is also specified, print sizes like 3.5K, 1.8G,
etc., instead of the exact byte count.

Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message; adjust newlines; squash
 two of Kumar's patches into this one.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>