Add "bup index --clear" to clear the index.

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
bloom-cmd: don't explicitly create the bloom file (allow bloom.create()).

Don't explicitly create the bloom file since bloom.create() will
handle it, and will actually use the correct (binary) mode instead of
"w+".

The binary mode has no effect under Linux or Cygwin, but is important
under Windows.

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
clear_index(): remove unused "cleared" variable.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Add 'x' to the getopts call in t/compare-trees (i.e. allow -x).

Signed-off-by: Anton Eliasson <devel@antoneliasson.se>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Attempt to fix HACKING link in README.md.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Update HACKING to reflect the glorious death of tmp/pending/meta.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Officially drop support for Python 2.4.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Alexander Barton <alex@barton.de>
Mention what's "in-scope" for 0.25 in HACKING.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
wvtestrun: invoke perl via /usr/bin/env for portability.

This also matches format-subst.pl.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
bup-save.md: fix --graft documentation bug; use "chroot" consistently.

Change mixture of "chroot" and "chroots" in examples to "chroot".

Thanks to "jon.seymour" <jon.seymour@gmail.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Update bup-restore.md to match reality; document "/." handling.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move parse_excludes to helpers and rework it a bit.

Don't use f before it's initialized.

Narrow the catch to open(), and only catch IOException.

Call Options.fatal() when there's an error (as does
helpers.parse_date_or_fatal()).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Fix use of Python assert() with respect to optimization.

Fix a number of places where bup's assertions had material
side-effects, or where other code expected to see the AssertionError,
neither of which happen when optimization is enabled.

Reported-by: Jon Dowland <jmtd@debian.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Add a force-delete function to t/test.sh

Replace "rm -rf" with force-delete because "rm -rf" will proceed even
if it doesn't succeed.  This masked a problem (reported on Fedora)
where the root directory and other system directories had "r-xr-xr-x"
(0555) permissions, causing bup restore to create directories that "rm
-rf" couldn't remove.  As a result, subsequent tests would fail.

Signed-off-by: Ryan Brown <ryansb@csh.rit.edu>
[rlb@defaultvalue.org: edited commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
t/test.sh: remove a few calls to force-delete that shouldn't be needed.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Move force-delete to t/lib.sh from test.sh and test-meta.sh; improve.

Only call chattr and setfacl on Linux for now.

Test that each item is actually gone.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Include metadata when asked to restore individual non-directory paths.

Adjust bup restore to handle cases like this:

  bup restore -C tmp backup/latest/somewhere/not-a-directory

Previously bup wouldn't restore the metadata for not-a-directory; now
it should.

Add wvtest-bup.sh which includes wvmktempdir().  This function creates
all temporary directories under t/tmp, making cleanup easier.

Add t/test-restore-single-file.sh

Reported-by: Tim Riemenschneider <t.riemenschneider@detco.de>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
find_dir_item_metadata_by_name(): wait for the right item name.

Fix a bug in the previous patch:

  Include metadata when asked to restore individual non-directory paths.
  53649c18ec3db90f80ff4657315009538d4333f3

Don't return whatever metadata you have the first time you hit a
directory in the dir.  Wait until you find the right name.

Reported-by: varacanero <varacanero@zeromail.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Normalize stat(2) timespecs in _helpers.c.

Previously, the code required timespecs to have a nanosecond value
between 0 and 999999999, because that's what Linux appeared to
produce, but other platforms don't (i.e. Cygwin) -- so normalize the
system values to match expectations.

In particular, look for negative nanosecond values (must be greater
than -10**9), and if found, rewrite the timespec with non-negative
nanoseconds (still less than 10**9).

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
save-cmd.py: insist on having an index; check for the primary index file.

Insist on having an index, and report an error (with a suggestion to
run "bup index") if one isn't found.

Previously (at least as recently as 0.25-rc1), bup save would just
create an empty tree if there was no index.  The metadata work
unintentionally broke that behavior.

For now, treat a missing index as an error under the assumption that
it's not likely to be intentional.  If a good use case for the
previous behavior is presented, we can always restore it.

Signed-off-by: Jean-Baptiste Denis <jbd@jbdenis.net>
[rlb@defaultvalue.org: adjust commit message and save-cmd.py error message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>