]> arthur.barton.de Git - bup.git/log
bup.git
7 years agoAdd note/0.28-from-0.28.1.md and mention in README 0.28.1
Rob Browning [Sun, 12 Jun 2016 16:18:14 +0000 (11:18 -0500)]
Add note/0.28-from-0.28.1.md and mention in README

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agotest-web: use path with unique unicode sequence
Rob Browning [Sat, 11 Jun 2016 17:59:38 +0000 (12:59 -0500)]
test-web: use path with unique unicode sequence

Change the test path from "éxcitement" to "¡excitement!" since the
former has multiple valid unicode encodings (e.g. given combining
characters, etc.).

With the previous string, the test might fail if something along the way
normalized it (which was the case on at least some versions of OS X).

Thanks to ilovezfs for reporting the problem and helping with the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agotest-meta: loosen expected rsync diff pattern
Rob Browning [Sat, 11 Jun 2016 17:15:21 +0000 (12:15 -0500)]
test-meta: loosen expected rsync diff pattern

Homebrew's rsync produces 12 status characters, not 11.

Thanks to ilovezfs for reporting the problem and helping test the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agoFix release archives and add tests
Rob Browning [Fri, 27 May 2016 00:30:40 +0000 (19:30 -0500)]
Fix release archives and add tests

Previously, an archive created by "git archive" would fail to build,
because the versioning code was broken (in part by
03d35993b87f49753542e705e37949a46964be17) for any build outside a git
clone.  Although "bup version" may not really have been quite right
since the switch from "bup-VERSION" to "VERSION release tags.

Fix the problem by reintroducing the content of the older
_version.py.pre as a permanent _release.py file, which (as with the
previous incarnation) is a template that's expanded during "git archive"
via export-subst (cf. gitattributes(5)).

Add a version module as the public interface to versioning, and have it
sort out whether or not the current tree is an official release.  Adjust
configure-version to manage _checkout.py instead of _version.py (drop
_version.py), so that the version module is effectively just
disambiguating between _release.py and _checkout.py.

Adjust "bup version" to use the new version module and to handle
unprefixed VERSION tags.

Finally, add test-release-archive.sh, invoked via "make distcheck", so
we (hopefully) don't unknowingly break this again.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agowvtest.sh: fix WVDIE
Rob Browning [Sat, 28 May 2016 16:09:32 +0000 (11:09 -0500)]
wvtest.sh: fix WVDIE

It was unused, and didn't actually work.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agoAdd config.vars.sh for bup_make and bup_python
Rob Browning [Sat, 28 May 2016 14:37:09 +0000 (09:37 -0500)]
Add config.vars.sh for bup_make and bup_python

During configure create a config/config.vars.sh file including (for now)
properly shell escaped bup_make and bup_python definitions so that we
can use them in other schell scripts.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agobup-python: respect umask when adding execute bit
Gernot Schulz [Tue, 31 May 2016 08:42:10 +0000 (10:42 +0200)]
bup-python: respect umask when adding execute bit

Signed-off-by: Gernot Schulz <post@gernot-schulz.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agodrecurse.py: add missing resolve_parent import
Karl Semich [Wed, 1 Jun 2016 16:53:55 +0000 (12:53 -0400)]
drecurse.py: add missing resolve_parent import

Signed-off-by: Karl Semich
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agoUpdate HACKING and README for 0.28 0.28
Rob Browning [Sat, 21 May 2016 19:36:28 +0000 (14:36 -0500)]
Update HACKING and README for 0.28

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agoCompute exact sizes via t/data-size in test-gc.sh
Rob Browning [Tue, 24 May 2016 00:15:30 +0000 (19:15 -0500)]
Compute exact sizes via t/data-size in test-gc.sh

Add a t/data-size helper that computes the total data size of all named
paths and use it instead of du in test-gc.sh to determine the
before/after repository sizes.

This should fix spurious test failures on filesystems with a large block
size.  (Observed on ppc64el and powerpc tmpfs filesystems.)

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agoAdd xattr EACCES fix to release notes 0.28-rc3
Rob Browning [Sat, 21 May 2016 14:19:17 +0000 (09:19 -0500)]
Add xattr EACCES fix to release notes

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agoDon't return const types from sparse find helpers
Rob Browning [Sat, 21 May 2016 14:03:47 +0000 (09:03 -0500)]
Don't return const types from sparse find helpers

Let the caller decide.

Thanks to Greg Troxel for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agoTreat EACCES like EPERM when removing xattrs
Rob Browning [Sat, 21 May 2016 14:11:01 +0000 (09:11 -0500)]
Treat EACCES like EPERM when removing xattrs

Thanks to Brian Minton for reporting the problem on Fedora 23.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agoAdd thanks to 0.28 release notes 0.28-rc2
Rob Browning [Fri, 20 May 2016 23:29:49 +0000 (18:29 -0500)]
Add thanks to 0.28 release notes

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agoAdd note/0.27.1-from-0.27.md and mention in README
Rob Browning [Sat, 30 Apr 2016 23:28:02 +0000 (18:28 -0500)]
Add note/0.27.1-from-0.27.md and mention in README

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agoMerge restore --sparse corruption fix
Rob Browning [Fri, 20 May 2016 02:11:00 +0000 (21:11 -0500)]
Merge restore --sparse corruption fix

7 years agorestore: fix --sparse corruption
Rob Browning [Sun, 24 Apr 2016 16:58:04 +0000 (11:58 -0500)]
restore: fix --sparse corruption

Rework the restore --sparse implementation to fix a bug that might cause
it to produce output that didn't match the original input.

Rewrite the code to probe for sparse regions in min_sparse_len jumps,
searching backward from the jump target for a non-zero byte.  If one is
found, move just past that byte and try again.

This should be substantially more efficient than the previous approach
for non-sparse regions.  In the limiting case, it should read roughly
1/min_sparse_len bytes instead of all of them.

The original bug was masked by the fact that the test that would have
revealed it wasn't actually generating random data (across trials),
something that was fixed in "Use $RANDOM seed for --sparse random
tests".

Thanks to Marcus Schopen for reporting the problem and Frank Gevaerts
for helping track down the solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
7 years agotest-sparse-files: use bup-python in master
Rob Browning [Fri, 20 May 2016 02:00:59 +0000 (21:00 -0500)]
test-sparse-files: use bup-python in master

Change python to bup-python after cherry-picking the sparse test in
b5636d001151fe64bc617507200a55af73766819.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agorestore: test --sparse with zeros at 64k boundary
Frank Gevaerts [Tue, 19 Apr 2016 20:02:49 +0000 (22:02 +0200)]
restore: test --sparse with zeros at 64k boundary

bup restore --sparse fails with short zero runs around 64K boundaries.
The new testcase reproduces that failure

Signed-off-by: Frank Gevaerts <frank@gevaerts.be>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit summary]

7 years agorestore: add generative --sparse testing
Rob Browning [Sun, 24 Apr 2016 22:52:02 +0000 (17:52 -0500)]
restore: add generative --sparse testing

Add t/sparse-test-data to automatically generate cases that might trip
up "restore --sparse", and use it in test-sparse-files.sh.  This change
causes the current --sparse code to fail if you run enough trials,
but not as quickly as the existing "bup random" based test.

As compared to the existing "bup random" test, this one should evaluate
larger sparse regions much more often.

Thanks to Frank Gevaerts for help evaluating the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
7 years agoUse $RANDOM seed for --sparse random tests
Rob Browning [Sun, 24 Apr 2016 22:07:39 +0000 (17:07 -0500)]
Use $RANDOM seed for --sparse random tests

Since bup random defaults to a fixed random seed of 1, the restore
--sparse test for random data was actually testing the same data every
time.  Specify a $RANDOM --seed to fix that.

After this change, the affected test fails fairly often.

Thanks to Frank Gevaerts for help evaluating the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd note/0.28-from-0.27.md and mention in README 0.28-rc1
Rob Browning [Sun, 3 Apr 2016 18:18:03 +0000 (13:18 -0500)]
Add note/0.28-from-0.27.md and mention in README

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoREADME: update deps, platforms, related projects
Rob Browning [Sun, 3 Apr 2016 17:56:49 +0000 (12:56 -0500)]
README: update deps, platforms, related projects

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agorm/gc: update README and mention testing in bup-gc(1)
Rob Browning [Sun, 3 Apr 2016 17:15:47 +0000 (12:15 -0500)]
rm/gc: update README and mention testing in bup-gc(1)

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoReflect availability of experimental rm/gc in docs
Rob Browning [Sun, 3 Apr 2016 16:48:55 +0000 (11:48 -0500)]
Reflect availability of experimental rm/gc in docs

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd add_error imports missed in import * removal
stevelr [Sun, 7 Feb 2016 02:05:51 +0000 (18:05 -0800)]
Add add_error imports missed in import * removal

[rlb@defaultvalue.org: rebased on current master; squashed related
 patches; adjusted commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoCheck saved_errors before and after every test
Rob Browning [Sun, 27 Mar 2016 00:33:57 +0000 (19:33 -0500)]
Check saved_errors before and after every test

Add a new buptest module that includes a no_lingering_errors context
manager which provokes a wvtest failure if there are any saved_errors
before or after a test, and then clears them, and use that manager in
all of the Python tests so that unexpected errors will be detected
immediately, instead of causing an unrelated failure later, when testing
for expected saved_errors.

Add a temp_testdir context manager to replace all of the current
tmpdir-related boilerplate.

Rework all of the tests to use the two managers where appropriate, so
that this:

  def test_bloom():
      initial_failures = wvfailure_count()
      tmpdir = tempfile.mkdtemp(dir=bup_tmp, prefix='bup-tbloom-')
      ...
      if wvfailure_count() == initial_failures:
          subprocess.call(['rm', '-rf', tmpdir])

becomes this:

  def test_bloom():
      with no_lingering_errors(), test_tempdir('bup-tbloom-') as tmpdir:
          ...

While making the changes, clean up the imports to match the PEP 8 import
recommendations a bit more closely (excepting the suggestion to avoid
"import bar, baz", which seems odd given the blessing of "from foo
import bar, baz", where bar and baz could still be modules).

Thanks to Tadej Janež for reporting the initial issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest_server_split_with_indexes: close packwriter
Rob Browning [Sat, 26 Mar 2016 23:40:57 +0000 (18:40 -0500)]
test_server_split_with_indexes: close packwriter

Otherwise there are random test failures when the tmpdir is removed
before the PackWriter's destructor calls close().  This doesn't cause an
immediate problem, but it adds an unexpected entry to saved_errors that
causes later tests to fail.

The related saved_errors entries looked like this:

  ['../../../bup', 'midx', '--auto', '--dir', ...]: returned 15

and the underlying (hidden) midx stderr output in that case looked like
this:

  error: '...' is not a bup repository; run "bup init"

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest-rm: replace pipefail with explicit tests
Rob Browning [Sat, 26 Mar 2016 15:19:24 +0000 (10:19 -0500)]
test-rm: replace pipefail with explicit tests

...and fix some missing or ineffective status checks.

Thanks to Greg Troxel for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.
8 years agosync-trees: drop -X and retry if -X fails
Rob Browning [Tue, 22 Mar 2016 05:13:14 +0000 (00:13 -0500)]
sync-trees: drop -X and retry if -X fails

It appears that rsync may fail if -X is specified and the filesystem
doesn't support xattrs.

Thanks to Greg Troxel for reporting the problem and helping test the
solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agocompare-trees: drop -X and retry if -X fails
Rob Browning [Sat, 27 Feb 2016 20:07:41 +0000 (14:07 -0600)]
compare-trees: drop -X and retry if -X fails

It appears that rsync may fail, even during a --dry-run, if -X is
specified and the filesystem doesn't support xattrs.

Thanks to Greg Troxel for reporting the problem and helping test the
solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agofuse: remove redundant custom Stat class
Rob Browning [Sun, 28 Feb 2016 16:21:57 +0000 (10:21 -0600)]
fuse: remove redundant custom Stat class

It looks like our Stat class was just reinitializing all of the things
that the built in fuse.Stat class already initializes, so just rely on
theirs, and use their keyword initializers to avoid a few more
reinitializations.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agofuse: add --verbose argument and use it
Rob Browning [Sun, 28 Feb 2016 16:14:46 +0000 (10:14 -0600)]
fuse: add --verbose argument and use it

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoweb: retrieve paths exactly as presented
Rob Browning [Sat, 6 Feb 2016 18:02:58 +0000 (12:02 -0600)]
web: retrieve paths exactly as presented

Bup paths are byte strings, not Unicode, so don't attempt to convert
them to Unicode.  Retrieve exactly what was requested.

Thanks to Mathieu Schroeter for reporting the problem and helping test
the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMerge web GET fix and SIGTERM and unix:// support
Rob Browning [Sat, 12 Mar 2016 17:55:05 +0000 (11:55 -0600)]
Merge web GET fix and SIGTERM and unix:// support

Tested-by: Rob Browning <rlb@defaultvalue.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoweb: fix broken GETs and test
Rob Browning [Sat, 12 Mar 2016 17:45:08 +0000 (11:45 -0600)]
web: fix broken GETs and test

It appears that content GETs, i.e. "curl
http://localhost/foo/latest/bar" may have been broken for a while.  To
addresss that, switch to the apparently preferred upstream coroutine
approach, and add some initial tests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoweb: add missing chunkyreader import
Rob Browning [Sat, 5 Mar 2016 23:56:06 +0000 (17:56 -0600)]
web: add missing chunkyreader import

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoweb: for unix://path, listen on filesystem socket
Rob Browning [Sat, 5 Mar 2016 23:09:16 +0000 (17:09 -0600)]
web: for unix://path, listen on filesystem socket

Add support for filesystem sockets.  If nothing else, this is very
useful for testing.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoweb: attempt orderly shut down on SIGTERM
Rob Browning [Sat, 5 Mar 2016 22:56:03 +0000 (16:56 -0600)]
web: attempt orderly shut down on SIGTERM

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoweb: remove unneeded __name__ == '__main__' guard
Rob Browning [Sat, 5 Mar 2016 22:49:36 +0000 (16:49 -0600)]
web: remove unneeded __name__ == '__main__' guard

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agobup-index.md: fix path ref; update description
Rob Browning [Mon, 18 Jan 2016 00:53:18 +0000 (18:53 -0600)]
bup-index.md: fix path ref; update description

Change one more "filename" to "path", and adjust the initial
description.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoNever omit explicitly named mounts during index -x
Rob Browning [Sun, 10 Jan 2016 19:44:04 +0000 (13:44 -0600)]
Never omit explicitly named mounts during index -x

Assuming mounts like this:

  /
  /usr

and an index invocation like "bup index -x / /usr", don't skip indexing
/usr.  Previously bup would skip /usr when -x was specified because
reduce_paths() would drop /usr from the list of paths to index, assuming
that /usr would be covered when indexing /.  However, when /usr was
actually reached, -x would cause it to be skipped.

To fix that, exempt all mount points mentioned on the command line from
-x during filesystem traversal, expand the (root only) tests to cover
this situation, and check some corner cases.

Thanks to Wayne Scott for reporting the problem, and Yves-Alexis Perez
for a reminder.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoindex: raise children_n limit to struct 'I' max
Rob Browning [Sat, 5 Mar 2016 17:21:50 +0000 (11:21 -0600)]
index: raise children_n limit to struct 'I' max

This assertion appears to be a sanity check, and one that's perhaps too
low (think giant Maildirs), so raise it to the real limit, which should
be UINT_MAX, given that the index header containing it is
encoded/decoded via 'I' (platform native unsigned int):

  https://docs.python.org/2/library/struct.html

Since Python doesn't appear to provide access to UINT_MAX, add it (and
INT_MAX) to _helpers.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoindex: always return at least the root for filter prefixes
Rob Browning [Mon, 21 Dec 2015 19:35:24 +0000 (13:35 -0600)]
index: always return at least the root for filter prefixes

Return at least an entry for the prefix itself for each prefix passed
to filter.  Otherwise something like "bup save ... x/y" will fail when
x is up to date because filter will return nothing, save will traverse
nothing in its main loop, and bup will crash with an assertion
failure:

  File "/home/rlb/src/bup/main/cmd/bup-save", line 440, in <module>
    assert(len(shalists) == 1)

Instead "bup save ... x/y" should (and now will) produce a new save
containing x/y.

Thanks to Simon Persson for helping formulate a good test case.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest-rm: match rsync output against rx, not string
Rob Browning [Sun, 14 Feb 2016 21:42:19 +0000 (15:42 -0600)]
test-rm: match rsync output against rx, not string

Add a wv_matches_rx to use Bash =~ to match the expected output against
a regular expression.

Thanks to Greg Troxel for reporting a related problem on NetBSD,
and providing the nudge.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMerge initial bup gc command
Rob Browning [Sat, 13 Feb 2016 20:34:47 +0000 (14:34 -0600)]
Merge initial bup gc command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMerge initial bup rm command
Rob Browning [Sat, 13 Feb 2016 15:25:45 +0000 (09:25 -0600)]
Merge initial bup rm command

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agogc-cmd: add the bup-python #! preamble
Paul Kronenwetter [Wed, 23 Dec 2015 02:05:33 +0000 (21:05 -0500)]
gc-cmd: add the bup-python #! preamble

Signed-off-by: Paul Kronenwetter <kronenpj@gmail.com>
[rlb@defaultvalue.org: remove everything except preamble update;
 rebase on current gc branch; adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agorm-cmd: add the bup-python #! preamble
Paul Kronenwetter [Wed, 23 Dec 2015 02:05:33 +0000 (21:05 -0500)]
rm-cmd: add the bup-python #! preamble

Signed-off-by: Paul Kronenwetter <kronenpj@gmail.com>
[rlb@defaultvalue.org: remove everything except preamble update;
 rebase on current rm branch; adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd probabilistic "bup gc", but require --unsafe
Rob Browning [Mon, 20 Oct 2014 23:44:06 +0000 (18:44 -0500)]
Add probabilistic "bup gc", but require --unsafe

WARNING: This code is UNSAFE, please test it with care.  Among other
things, it adds the first bup command that intends to modify packfiles.
Also, the code assumes/requires a "quiet" repository; any simultaneous
access is dangerous.

Add a "bup gc" command that uses a Bloom filter to track the live
objects during the mark phase.  This means that the collection is
probabilistic -- that it may retain some (known) percentage of
garbage, but it can also work within a reasonable, fixed RAM budget
for any particular percentage and repository size.

In many cases, this may be sufficient and preferable, but in the
longer run, we might also want to add a precise method that guarantees
bup retains *no* unreachable/dead objects -- nothing here should
prevent that.

This command is potentially dangerous, so until we've had broader
testing, require all invocations to specify --unsafe, and make it clear
in the documentation that this command isn't considered stable.

Thanks to Tim Riemenschneider for suggesting the pruning of already
visited trees, and an earlier implementation thereof.  Thanks to Ben
Kelley for testing and reporting bugs in earlier versions of the
current implementation.

Thanks to Ben Kelly for help devising this Bloom-based approach, and for
testing and reporting bugs in earlier versions.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd "bup rm", but require --unsafe invocation
Rob Browning [Tue, 29 Dec 2015 20:53:54 +0000 (14:53 -0600)]
Add "bup rm", but require --unsafe invocation

Allow the removal of branches, and the removal of saves from specified
branches.  This command only removes the references, so until "bup gc"
is available, all of the related data will still be in the repository,
though possibly difficult to reach, unless otherwise tagged.

This command is potentially dangerous, so until we've had broader
testing, require all invocations to specify --unsafe, and make it clear
in the documentation that this command isn't considered stable.

Thanks to Nix for reporting an earlier mistake in the manpage.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agogit.py: add walk_object
Rob Browning [Mon, 5 Jan 2015 00:47:42 +0000 (18:47 -0600)]
git.py: add walk_object

Add walk_object(), which can recursively traverse a git reference (tree,
commit, blob, etc.).  This will be used by "bup gc".

Thanks to Aidan Hobson Sayers for suggesting improvements to an earlier
version of the code.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd author and committer arguments to new_commit()
Rob Browning [Fri, 14 Feb 2014 18:22:41 +0000 (12:22 -0600)]
Add author and committer arguments to new_commit()

Support "bup get" and "bup rm", which need to write commits with
differing author and committer information.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd imports missed during helpers import * removal
Rob Browning [Sat, 13 Feb 2016 20:13:13 +0000 (14:13 -0600)]
Add imports missed during helpers import * removal

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agobup-index.md: elaborate on update path handling
Rob Browning [Sun, 24 Jan 2016 17:57:13 +0000 (11:57 -0600)]
bup-index.md: elaborate on update path handling

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoPackWriter _end: fsync parent dir (not fdatasync)
Rob Browning [Tue, 5 Jan 2016 03:07:40 +0000 (21:07 -0600)]
PackWriter _end: fsync parent dir (not fdatasync)

Thanks to Greg Troxel for jogging my memory.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoSync pack data more carefully when writing
Rob Browning [Sun, 3 Jan 2016 18:08:56 +0000 (12:08 -0600)]
Sync pack data more carefully when writing

Otherwise a system failure might leave a broken repo.  Note that these
changes may not be comprehensive, but they're a start, and hopefully
deal with some of the most critical data.

In addition to syncing the pack data itself, sync the parent directory
after the final rename so that we don't risk losing the reference to
the new file.

See also:

  http://austingroupbugs.net/view.php?id=672
  https://www.sqlite.org/atomiccommit.html

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years ago_write_pack_idx_v2: close idx_map separately
Rob Browning [Sun, 3 Jan 2016 17:59:17 +0000 (11:59 -0600)]
_write_pack_idx_v2: close idx_map separately

...in its own finally block, so that the idx_f close will be attempted
even if the idx_map close throws an exception.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoPackWriter open: clean up fd if fdopen fails
Rob Browning [Sun, 3 Jan 2016 17:44:13 +0000 (11:44 -0600)]
PackWriter open: clean up fd if fdopen fails

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoPackWriter init: initialize file guard first
Rob Browning [Sun, 3 Jan 2016 17:42:27 +0000 (11:42 -0600)]
PackWriter init: initialize file guard first

Initialize the self.file variable first since it's used to test the
state of the object.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoPackWriter _end: try to always close the file
Rob Browning [Sun, 3 Jan 2016 16:59:33 +0000 (10:59 -0600)]
PackWriter _end: try to always close the file

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoPackWriter _abort: try to always close the file
Rob Browning [Sat, 2 Jan 2016 21:54:57 +0000 (15:54 -0600)]
PackWriter _abort: try to always close the file

...even if the unlink fails.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agols: add missing sys and columnate imports
Rob Browning [Sun, 17 Jan 2016 19:20:49 +0000 (13:20 -0600)]
ls: add missing sys and columnate imports

This was ignored by the existing tests because there was no tty.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoDon't import * from helpers
Rob Browning [Sun, 17 Jan 2016 16:11:22 +0000 (10:11 -0600)]
Don't import * from helpers

So we're not pulling access to random other namespaces through helpers
(like errno, subprocess, etc.), and so it's obvious what's coming from
where.

Thanks to Greg Troxel for help evaluating the changes.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd initial test-list-idx.sh
Rob Browning [Sat, 9 Jan 2016 21:45:01 +0000 (15:45 -0600)]
Add initial test-list-idx.sh

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd trivial test-main.sh
Rob Browning [Sat, 9 Jan 2016 21:42:35 +0000 (15:42 -0600)]
Add trivial test-main.sh

For now, just test that "bup" exits with the specified 99, which also
exercises the usage() code (so we at least notice missing imports,
etc.).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agohelpers: rename realpath to resolve_parent
Rob Browning [Sat, 9 Jan 2016 18:55:45 +0000 (12:55 -0600)]
helpers: rename realpath to resolve_parent

helpers.realpath does not behave quite like os.path.realpath since it
doesn't resolve any leaf symlink, so to avoid confusion, rename it to
resolve_parent.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoREADME: add info about Fedora package
Tadej Janež [Mon, 4 Jan 2016 12:29:16 +0000 (13:29 +0100)]
README: add info about Fedora package

Signed-off-by: Tadej Janež <tadej.j@nez.si>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
8 years agofdatasync: call F_FULLFSYNC fcntl on OS X
Rob Browning [Fri, 1 Jan 2016 20:04:09 +0000 (14:04 -0600)]
fdatasync: call F_FULLFSYNC fcntl on OS X

Apparently fsync doesn't guarantee to actually sync all the way to disk
on OS X, for that you have to use this fcntl.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest-ls: add missing WVPASSes to report failures
Rob Browning [Fri, 1 Jan 2016 19:41:17 +0000 (13:41 -0600)]
test-ls: add missing WVPASSes to report failures

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoUse BytesIO instead of StringIO
Rob Browning [Tue, 29 Dec 2015 07:31:02 +0000 (01:31 -0600)]
Use BytesIO instead of StringIO

More accurate, and Python 3 compatible.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoUse Python 3 compatible "except ... as e" syntax
Rob Browning [Tue, 29 Dec 2015 07:11:19 +0000 (01:11 -0600)]
Use Python 3 compatible "except ... as e" syntax

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoUse Python 3 compatible octal notation
Rob Browning [Tue, 29 Dec 2015 06:56:23 +0000 (00:56 -0600)]
Use Python 3 compatible octal notation

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoCapture and check top level wvtest watch messages
Rob Browning [Thu, 31 Dec 2015 20:55:36 +0000 (14:55 -0600)]
Capture and check top level wvtest watch messages

During wvtest watch, report top level protocol messages to stderr so
that they can be safely captured for examination by report.  Continue
printing those message to stdout too, so that "wvtest watch
... 2>test-top.log" will still display them.

Adjust "make check" to include the top level messages when looking for
failures.  Otherwise a non-zero exit status from a t/test-*.sh test that
produced no wvtest failure output of its own was just ignored.  This can
be demonstrated by adding an "exit 1" to the top of an existing test and
running "make -j check".

Thanks to Greg Troxel for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMakefile: don't conflate DESTDIR with MANDIR etc.
Rob Browning [Wed, 30 Dec 2015 19:57:14 +0000 (13:57 -0600)]
Makefile: don't conflate DESTDIR with MANDIR  etc.

Don't prepend DESTDIR to the MANDIR, DOCDIR, BINDIR, and LIBDIR values.
Create new dest_* variables instead, so that we don't lose the original
information provided by something like "make MANDIR=... install".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agowvtest.py: set wvtest to wvtest module if __main__
Rob Browning [Tue, 29 Dec 2015 02:00:05 +0000 (20:00 -0600)]
wvtest.py: set wvtest to wvtest module if __main__

Without this, references to wvtest.* may fail, which can be demonstrated
(for example) by adding a "raise AttributeError('foo')' to
_add_posix1e_acl just before the "if posix1e.has_extended(path)" test.
Then "./wvtest.py lib/bup/t/tgit.py" will fail in the end with:

  NameError: global name 'wvtest' is not defined

As a result, wvtest.py never prints a "! ... FAILED" message for the
test, and so "wvtest report" never realizes there was a problem, and
then "make check" exits with zero status.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agowvtest.py: correct bup-python in #! preamble
Rob Browning [Tue, 29 Dec 2015 01:57:41 +0000 (19:57 -0600)]
wvtest.py: correct bup-python in #! preamble

Otherwise, manual invocations like "./wvtest.py lib/bup/t/tgit.py" fail.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoHave clean depend on bup-python so tools can too
Rob Browning [Sun, 27 Dec 2015 18:30:49 +0000 (12:30 -0600)]
Have clean depend on bup-python so tools can too

Have the clean target depend on bup-python so that we can use it during
cleanup, and adjust cleanup-mounts-under accordingly.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoGuard posxi1e has_extended with HAS_EXTENDED_CHECK
Rob Browning [Sun, 27 Dec 2015 17:23:37 +0000 (11:23 -0600)]
Guard posxi1e has_extended with HAS_EXTENDED_CHECK

Thanks to James Lott for reporting the issue (seen on FreeBSD) and
suggesting the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoindex: mention Btrfs in --no-check-device docs
Rob Browning [Sun, 27 Dec 2015 00:08:19 +0000 (18:08 -0600)]
index: mention Btrfs in --no-check-device docs

Thanks to Karl-Philipp Richter for the suggestion.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoSet sort LC_ALL=C correctly in test-meta and test-xdev
Rob Browning [Thu, 24 Dec 2015 17:00:31 +0000 (11:00 -0600)]
Set sort LC_ALL=C correctly in test-meta and test-xdev

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMakefile: set default install PREFIX to /usr/local
Rob Browning [Wed, 23 Dec 2015 23:54:43 +0000 (17:54 -0600)]
Makefile: set default install PREFIX to /usr/local

Thanks to Karl-Philipp Richter for the suggestion.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agofmincore: treat mmap EINVAL as ENODEV (i.e. skip)
Rob Browning [Sun, 20 Dec 2015 00:08:01 +0000 (18:08 -0600)]
fmincore: treat mmap EINVAL as ENODEV (i.e. skip)

As seen on OS X.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMakefile: pass MAKE to ./configure
Rob Browning [Sat, 19 Dec 2015 18:27:45 +0000 (12:27 -0600)]
Makefile: pass MAKE to ./configure

Thanks to Thomas Klausner for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agogitignore: add /sampledata/var; clean up
Rob Browning [Sat, 19 Dec 2015 16:38:04 +0000 (10:38 -0600)]
gitignore: add /sampledata/var; clean up

Remove some vestigial entries and add t/sampledata/var/.

Thanks to Thomas Klausner for reporting this and a few other ignore
omissions.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMove remainder of config/Makefile to Makefile
Rob Browning [Fri, 18 Dec 2015 20:38:34 +0000 (14:38 -0600)]
Move remainder of config/Makefile to Makefile

Everything except clean was already being handled by the top level
Makefile, so move the last bits there, and delete config/Makefile.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoBuild docs via top Makefile
Rob Browning [Thu, 17 Dec 2015 23:24:33 +0000 (17:24 -0600)]
Build docs via top Makefile

Move the operations in Documentation/Makefile to ./Makefile, and rework
the process to make it less likely we might overlook command
failures (like ./bup version).  Delete Documentation/Makefile.

This may also improve the accuracy of the build dependencies.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoGenerate bup-python from Makefile not configure
Rob Browning [Fri, 18 Dec 2015 20:59:54 +0000 (14:59 -0600)]
Generate bup-python from Makefile not configure

Don't generate cmd/bup-python in configure.  Instead, just define a
bup_python config variable (via config/config.vars.in), and use it to
generate bup-python from ./Makefile.

In support of that, include config/config.vars in ./Makefile, and add
a rule to generate it.  This simplifies some of the dependencies, and
removes a level of indirection when determining the correct python to
use (i.e. PYTHON via $(shell)).

This does mean that a "make clean" on a clean tree will run configure.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years ago"Fix" tests with differing logical/physical paths
Rob Browning [Fri, 18 Dec 2015 23:52:39 +0000 (17:52 -0600)]
"Fix" tests with differing logical/physical paths

Explicitly "cd $(pwd -P)" before testing to work around problems
relating to unresolved questions about the correct behavior of drecurse
when the logical and physical paths differ.

The problem can be reproduced by entering a bup source directory via a
symlink and running "make check":

  ln -s bup-real bup
  cd bup
  make check

Thanks to Brandon Smith and Greg Troxel for reporting the
problem (again) and proposing slightly different solutions.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMakefile: check $(shell) exit statuses
Rob Browning [Tue, 15 Dec 2015 18:07:14 +0000 (12:07 -0600)]
Makefile: check $(shell) exit statuses

Append " ok" or " no" to the output of every $(shell) invocation, and
then use that to detect failures.  Previously, failures were ignored.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoChange remaining uses of python to bup-python
Rob Browning [Tue, 15 Dec 2015 01:23:45 +0000 (19:23 -0600)]
Change remaining uses of python to bup-python

Putting a phony python in tmp-bin and running this:

  PATH="$(pwd)/../tmp-bin:${PATH}" make check

when configure had settled on python2.7 revealed a number of lingering
occurrences.

Thanks to Thomas Klausner for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMakefile: fix tests with bash and pipefail
Rob Browning [Tue, 15 Dec 2015 01:30:47 +0000 (19:30 -0600)]
Makefile: fix tests with bash and pipefail

The changes[1] to support parallel testing introduced a pipe to tee,
which masks the exit status of a failed test.  Fix that by requiring
bash and specifying pipefail.

[1] wvtest: add watch/report subcmds for parallel runs
    13612bf383392a9f8430717ced1bb2a26622c7b4

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoFix python-cmd.sh generation and cleanup
Rob Browning [Mon, 14 Dec 2015 18:59:14 +0000 (12:59 -0600)]
Fix python-cmd.sh generation and cleanup

Clean up cmd/python-cmd.sh, add config/configure.inc as a dependency,
and invoke ./configure, not config/configure (which would fail).

This was rarely observed because ./configure would normally be invoked
by other dependencies first.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoconfigure-version: completely handle _version.py
Rob Browning [Fri, 18 Dec 2015 00:24:48 +0000 (18:24 -0600)]
configure-version: completely handle _version.py

Don't rely on the external format-subst.pl script anymore, just generate
_version.py directly.  Delete format-subst.pl and _version.py.pre.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agohashsplit: skip uncaching when mmap is unsupported
Rob Browning [Thu, 17 Dec 2015 23:32:36 +0000 (17:32 -0600)]
hashsplit: skip uncaching when mmap is unsupported

Skip our fmincore based uncaching for any file region where mmap throws
an mmap.error with errno set to ENODEV, i.e.:

  mmap.error: [Errno 19] Operation not supported by device

by having fmincore return None.  This happens on some platforms when the
input is a pipe, i.e.:

  ... | bup split ...

Thanks to Thomas Klausner and Greg Troxel for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoConfigure python, use it, and embed during install
Rob Browning [Sat, 12 Dec 2015 19:30:18 +0000 (13:30 -0600)]
Configure python, use it, and embed during install

Search for a "reasonable" python in ./configure (or respect PYTHON), and
use that to create a source tree cmd/python-cmd.sh that all of the
relevant invocations in the source tree respect.

During install, rewrite all of the relevant #! lines to refer to the
./configure selected Python.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest-tz.sh: test save in a fractional time zone
David Kettler [Mon, 30 Nov 2015 13:28:28 +0000 (23:58 +1030)]
test-tz.sh: test save in a fractional time zone

Prior to this change[1], the commit time zone offset was generated
incorrectly for non-integer hour offsets from UTC; seconds, rather
than minutes, were output.  Such values in a bup commit cause
subsequent attempts to access the repository to fail with "Exception:
cannot parse commit".

When run with TZ=Australia/Adelaide the test suite failed in several
places.  Add a test which sets the time zone explicitly and tests a
save for consistency.

[1] Fix utc_offset_str for fractional TZs
    f25ef2e868f85ca19bfce314081c956ade9c10ef

Signed-off-by: David Kettler <kettler@internode.on.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: remove proposed utc_offset_str fix; adjust
 commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoFix utc_offset_str for fractional TZs
Rob Browning [Sat, 5 Dec 2015 19:41:36 +0000 (13:41 -0600)]
Fix utc_offset_str for fractional TZs

Previously, for fractional offsets like TZ=FOO+3:3 (where the offset
is not an integer number of hours), utc_offset_str() would return a
large, incorrect integer value.  Adjust it to handle arbitrary
offsets, and document that it truncates any fractional seconds of the
offset.

Before this fix, whenever bup was operating with a fractional offset
(e.g. TZ=Australia/Adelaide), it wrote commits (i.e. saves) that it
won't be able to read.  Attempts to read them will fail with
"Exception: cannot parse commit".

Thanks to David Kettler for reporting the problem, and proposing an
alternate fix.

Reviewed-by: David Kettler <kettler@internode.on.net>
Tested-by: David Kettler <kettler@internode.on.net>
[rlb@defaultvalue.org: changed / to // for Python 3 compat]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoCall tzset before localtime_r as required by POSIX
Rob Browning [Sat, 5 Dec 2015 19:10:45 +0000 (13:10 -0600)]
Call tzset before localtime_r as required by POSIX

Otherwise localtime_r() may not respect the current TZ setting.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: David Kettler <kettler@internode.on.net>
8 years agotest-fuse.sh: remove vestigial bash date expansion
Rob Browning [Sun, 29 Nov 2015 19:11:49 +0000 (13:11 -0600)]
test-fuse.sh: remove vestigial bash date expansion

Remove use of a bash printf date expansion that's not supported by some
versions of bash.

Overlooked in 8f4a02810eb48faecc66bf15fbc83b212b19bbbd

Thanks to Luis Sanchez Sanchez for reporting the problem.

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