]> arthur.barton.de Git - bup.git/log
bup.git
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 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 "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 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>
8 years agoChoose 2M when SC_ARG_MAX is -1 (unspecified)
Rob Browning [Sun, 29 Nov 2015 18:38:03 +0000 (12:38 -0600)]
Choose 2M when SC_ARG_MAX is -1 (unspecified)

When sysconf() returns -1 for a limit, that means the limit is
"unspecified".  In that case, choose 2M for SC_ARG_MAX instead of the
POSIX minimum, matching (somewhat arbitrarily) the value on a current
16GB Debian amd64 system.

The POSIX minimum was unnecessary, likely inefficient, and causing
unnecessary failures.

Thanks to Mark J Hewitt <m.hewitt@computer.org> for reporting the
problem and tracking down the cause.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agodemangle_name: handle .bupm files
Rob Browning [Sat, 1 Aug 2015 16:18:09 +0000 (11:18 -0500)]
demangle_name: handle .bupm files

A bit back we started allowing .bupm files to be hashsplit:

  ee777400cf624b4f7a24b15614c2b6c745560dcb

Fix demangle_name() to handle that.  This requires a mode argument
because .bupm files might or might not be chunked.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agothashsplit: don't assume MINCORE_INCORE is defined
Rob Browning [Mon, 24 Aug 2015 20:44:15 +0000 (15:44 -0500)]
thashsplit: don't assume MINCORE_INCORE is defined

We had intended to guard the use of MINCORE_INCORE with tests for the
presence of the underlying function call, but we missed the hashsplit
tests.

Fix it by allowing the tests to pass in the mask value they already
depend on (i.e. 1).

Thanks to Michael March for reporting the problem, Patrick Rouleau for
confirming it, and Markus for proposing an alternate solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agovfs: remove support for /foo/TAG (keep /.tag/TAG)
Rob Browning [Sun, 26 Jul 2015 15:26:35 +0000 (10:26 -0500)]
vfs: remove support for /foo/TAG (keep /.tag/TAG)

Don't interleave the tags with the branch save dates in the VFS.  Doing
so meant that any access to the /branch required retrieving all tags in
the repository.  It also introduced the possibility of duplicate tag and
date names.

Tags are still available in the global /.tag directory.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoindex: drop uid/gid from the index
Rob Browning [Sun, 24 May 2015 19:55:32 +0000 (14:55 -0500)]
index: drop uid/gid from the index

Since the ctime should track changes, and the uid and gid are stored in
the metadata now, drop the redundant values from the index.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMove Cygwin uid/gid fixup from index to xstat
Rob Browning [Sun, 24 May 2015 19:55:32 +0000 (14:55 -0500)]
Move Cygwin uid/gid fixup from index to xstat

Move the Cygwin uid/gid fixup (8417c11948532ba890b862dcad9d37810d482616)
from the index to xstat.py so that it will affect metadata too.

If Cygwin is still affected by this issue, then it's possible that some
existing saves might have incorrect uid/gid values.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoconfig/configure: find bash via env (as we should)
Rob Browning [Sat, 18 Jul 2015 18:41:03 +0000 (13:41 -0500)]
config/configure: find bash via env (as we should)

Thanks to Greg Troxel <gdt@lexort.com> for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoHandle mincore cross-platform differences
Rob Browning [Fri, 3 Jul 2015 17:34:24 +0000 (12:34 -0500)]
Handle mincore cross-platform differences

On the BSDs, mincore is defined to return char values rather than
unsigned char values, so test for that and adjust our invocation.

Also check for MINCORE_INCORE, which is used on some platforms to test
the returned status bytes.  When it's found, define
helpers.MINCORE_INCORE appropriately.

Rework the mincore-related code, moving much of the fmincore C code to
Python to avoid dealing with platform-related strerror_r differences,
and replace the _helpers fmincore with a more primitive mincore.

To accommodate the more complicated ./configure testing, require bash,
and use printf -v to (safely) set ac_defined_$name during all calls to
AC_DEFINE so that we can use the discovered values to guard tests during
configuration.

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 agoHandle sysconf results more carefully
Rob Browning [Tue, 14 Jul 2015 00:33:24 +0000 (19:33 -0500)]
Handle sysconf results more carefully

Sysconf indicates that there's no definite limit by returning -1 and
leaving errno unchanged.  In that case, for SC_ARG_MAX, guess 4096.  For
SC_PAGE_SIZE, die, since various operations currently require a
page_size.

Thanks to Mark J Hewitt for reporting the issue, and to Mark and Nix for
investigating the cause.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoLICENSE: update to the current GNU LGPLv2 text
Tadej Janež [Tue, 16 Jun 2015 12:15:18 +0000 (14:15 +0200)]
LICENSE: update to the current GNU LGPLv2 text

The text is taken from
https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt.
Remove form feed characters and trailing whitespace from the file.

Signed-off-by: Tadej Janež <tadej.j@nez.si>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
Acked-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit summary]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
8 years agoHACKING: explain running single and parallel tests
Rob Browning [Sat, 4 Jul 2015 14:30:56 +0000 (09:30 -0500)]
HACKING: explain running single and parallel tests

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoimport-rsnapshot: exit with 1, not -1
Gabriel Filion [Sun, 21 Jun 2015 03:51:15 +0000 (23:51 -0400)]
import-rsnapshot: exit with 1, not -1

Using a negative exit code is a bashism and since we use /bin/sh to
interpret the script, we should avoid it.

This was reported by Raphael Geissert in a Debian bug report:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772222

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoMove _page_size to helpers.sc_page_size
Rob Browning [Sun, 28 Jun 2015 12:07:55 +0000 (07:07 -0500)]
Move _page_size to helpers.sc_page_size

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoGet SC_ARG_MAX from os.sysconf(), not C
Rob Browning [Sun, 28 Jun 2015 16:35:36 +0000 (11:35 -0500)]
Get SC_ARG_MAX from os.sysconf(), not C

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agohashsplit: don't import * from bup.helpers
Rob Browning [Sat, 27 Jun 2015 22:51:16 +0000 (17:51 -0500)]
hashsplit: don't import * from bup.helpers

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agolist_refs: add limit_to_heads and limit_to_tags
Rob Browning [Thu, 3 Apr 2014 06:27:40 +0000 (01:27 -0500)]
list_refs: add limit_to_heads and limit_to_tags

Adjust git.py to use the limits when beneficial.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoEject pages after save more selectively
Rob Browning [Sat, 20 Jun 2015 16:00:38 +0000 (11:00 -0500)]
Eject pages after save more selectively

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoEject our pages after save via fmincore
Rob Browning [Sat, 30 May 2015 16:18:26 +0000 (11:18 -0500)]
Eject our pages after save via fmincore

Use fmincore and fadvise_done to eject only pages that have become
resident during our save traversal (i.e. via hashsplitting) in
batches (currently 8MB or one VM page, whichever's larger).

Hopefully this will work better than either universal ejection (our
previous behavior), or no ejection (which dramatically slows down save
operations on some systems, perhaps due to competition with access to
the indexes, etc.

Thanks to Nimen Nachname for the initial suggestion, and thanks to Tilo
Schwarz for reporting bugs in a previous version of the patch, and for
noting that we shouldn't wait until the end of a large region before
starting to eject it.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Ben Wiederhake <Ben.Wiederhake@gmail.com>
Tested-by: Tilo Schwarz <mail@tilo-schwarz.de>
[rlb@defaultvalue.org: bup_fmincore: add missing malloc result check,
 and missing free(result) when munmap fails to
 437fedd07ee327c14b11cb19f6c0519ef1e50884]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd fmincore to return an fd's mincore data
Rob Browning [Tue, 26 May 2015 01:55:29 +0000 (20:55 -0500)]
Add fmincore to return an fd's mincore data

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
8 years agoRevert "Avoid fadvise (since it doesn't work as expected)"
Rob Browning [Tue, 26 May 2015 01:55:32 +0000 (20:55 -0500)]
Revert "Avoid fadvise (since it doesn't work as expected)"

On some systems (the reported system had 2GB), not forcing out all of
the data traversed during save dramatically slows down save operations,
possibly due to competition with access to the indexes, etc.  So restore
the use of fadvise_done() for now.

This reverts commit db68c4fd4dc3087eb3f0b6e5846629cbf02d0b27.

Thanks to Tilo Schwarz for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoAdd offset argument to fadvise_done
Rob Browning [Sat, 30 May 2015 16:18:13 +0000 (11:18 -0500)]
Add offset argument to fadvise_done

...and make it private for now.

Thanks to Tilo Schwarz for pointing out that an earlier version ignored
an offset of zero.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest.sh: separate index and split/join tests
Rob Browning [Sun, 14 Jun 2015 14:58:32 +0000 (09:58 -0500)]
test.sh: separate index and split/join tests

Move the index tests to test-index.sh and the split/join tests to
test-split-join.sh in order to increase the potential parallelism (and
modularity/isolation).

Here, this brings the "make -j check" time down quite a bit.  Before
test.sh was always the last thing running, and the index tests took most
of the time.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoTagDir._mksubs: remove duplicate FakeSymlink arg
Rob Browning [Sun, 14 Jun 2015 15:12:36 +0000 (10:12 -0500)]
TagDir._mksubs: remove duplicate FakeSymlink arg

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
8 years agotest-fuse: format save name with python, not bash
Rob Browning [Sat, 13 Jun 2015 17:54:21 +0000 (12:54 -0500)]
test-fuse: format save name with python, not bash

Some versions of bash don't support the date expansion we used.

Thanks to pspdevel for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
Tested-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: add comment above savename()]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoHACKING: fix format-patch example dir mismatch
Ben Wiederhake [Sun, 7 Jun 2015 20:23:48 +0000 (22:23 +0200)]
HACKING: fix format-patch example dir mismatch

Resolve disagreement over how to name an example directory.

Signed-off-by: Ben Wiederhake <Ben.Wiederhake@gmail.com>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit summary]

8 years agobup midx: fix --output when used with --auto or --force
Ben Kelly [Thu, 4 Jun 2015 16:47:27 +0000 (12:47 -0400)]
bup midx: fix --output when used with --auto or --force

This fixes an issue where --output is properly respected only when
neither of these options are used.

Signed-off-by: Ben Kelly <btk@google.com>
[rlb@defaultvalue.org: rebased onto e25363fc58cd906337ecee28d715af8f355fd921]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agodo_midx_group: don't rely on global path variable
Rob Browning [Sat, 6 Jun 2015 20:42:21 +0000 (15:42 -0500)]
do_midx_group: don't rely on global path variable

Right now path does happen to end up set to the same value as the outdir
argument, but we definitely shouldn't rely on that.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agoUpdate definition lists for pandoc 1.13
Rob Browning [Sat, 23 May 2015 16:30:36 +0000 (11:30 -0500)]
Update definition lists for pandoc 1.13

It appears that pandoc 1.13 requires a blank line between definition
list items, so add it.  See "compact_definition_lists" in the pandoc
README for more information.

Thanks to Robert Edmonds for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
8 years agowvtest: add watch/report subcmds for parallel runs
Rob Browning [Sun, 3 May 2015 02:10:40 +0000 (21:10 -0500)]
wvtest: add watch/report subcmds for parallel runs

See "./wvtest --man" for more information.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
8 years agowvtest: move top-level code to a run() function
Rob Browning [Sat, 2 May 2015 16:31:37 +0000 (11:31 -0500)]
wvtest: move top-level code to a run() function

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
8 years agowvtestrun: move to wvtest and add "run" argument
Rob Browning [Sat, 9 May 2015 16:40:01 +0000 (11:40 -0500)]
wvtestrun: move to wvtest and add "run" argument

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
8 years agoAvoid fadvise (since it doesn't work as expected)
Rob Browning [Sun, 10 May 2015 21:33:16 +0000 (16:33 -0500)]
Avoid fadvise (since it doesn't work as expected)

Currently, it appears that at least on Linux posix_fadvise() always
purges the cache given POSIX_FADV_DONTNEED, which is what bup uses, and
does nothing for POSIX_FADV_NOREUSE, which means that before this patch,
a bup save would completely clear the filesystem cache of any file data
traversed during the run.  Aside from being completely unintended, this
meant that active VM images, large databases, etc. would probably be
purged with every save.

Since it also looks like at least NetBSD doesn't do anything for
DONTNEED, and tools like tar, cpio, and duplicity don't use it, let's
just drop it.  That's simpler, and we can always add it back if/when
someone discovers it helps somewhere relevant.

Thanks to Nimen Nacnamme for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Acked-by: Greg Troxel <gdt@lexort.com>
8 years agoREADME: prefer "init -r" to "ssh ... bup init"
Tadej Janež [Fri, 1 May 2015 16:02:09 +0000 (18:02 +0200)]
README: prefer "init -r"  to "ssh ... bup init"

Recommend 'bup init -r SERVERNAME:PATH' instead of 'ssh SERVENAME bup
init'.

Update the example of making a backup to a remote server in README.md.
Replace 'ssh SERVENAME bup init' with 'bup init -r SERVERNAME'. The
latter doesn't only initialize the remote repository, but also the local
one (if it doesn't exist).  Augment 'bup {init,save} -r SERVERNAME'
commands with the path specifier to show the ability to specify the
remote path.

Signed-off-by: Tadej Janež <tadej.j@nez.si>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: shorten/adjust commit summary; adjust and change
 tense of commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agoSign off on d612d9a599590cb53a76711754f9e031f66a330a
Rob Browning [Sun, 26 Apr 2015 17:05:12 +0000 (12:05 -0500)]
Sign off on d612d9a599590cb53a76711754f9e031f66a330a

This commit represents my "Signed-off-by:" for commit

  d612d9a599590cb53a76711754f9e031f66a330a

which I forgot to include earlier.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoREADME.md: consistently refer to "make test"
Rob Browning [Sun, 26 Apr 2015 17:03:05 +0000 (12:03 -0500)]
README.md: consistently refer to "make test"

Thanks to Patrick Rouleau for reporting the inconsistency.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoHACKING: update for 0.27 release 0.27
Rob Browning [Sun, 26 Apr 2015 16:38:57 +0000 (11:38 -0500)]
HACKING: update for 0.27 release

9 years agoMakefile: no really, run test.sh (fix subst too) 0.27-rc7
Rob Browning [Sat, 25 Apr 2015 16:02:38 +0000 (11:02 -0500)]
Makefile: no really, run test.sh (fix subst too)

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoREADME.md: mention workaround for pwd test issue 0.27-rc6
Rob Browning [Sat, 25 Apr 2015 15:30:30 +0000 (10:30 -0500)]
README.md: mention workaround for pwd test issue

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMakefile: fix test pattern to include t/test.sh
Rob Browning [Sat, 25 Apr 2015 15:22:33 +0000 (10:22 -0500)]
Makefile: fix test pattern to include t/test.sh

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agotest-xdev: show test skip messages via WVSTART
Rob Browning [Sat, 25 Apr 2015 15:13:14 +0000 (10:13 -0500)]
test-xdev: show test skip messages via WVSTART

Otherwise they're invisible via "make check", etc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoReject invalid string in --date argument
Johannes Berg [Thu, 23 Apr 2015 20:41:45 +0000 (22:41 +0200)]
Reject invalid string in --date argument

As parse_date_or_fatal() currently uses atof(), which just returns 0
if the string isn't a valid number, it can never actually be fatal
and will just use "1970-01-01 00:00:00" as the time if the string is
specified wrong.

Fix that by using float() directly so ValueError() is raised.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[rlb@defaultvalue.org: adjust commit summary]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoIgnore lchmod() ENOSYS (i.e. function not implemented) 0.27-rc5
Rob Browning [Thu, 11 Sep 2014 18:52:04 +0000 (13:52 -0500)]
Ignore lchmod() ENOSYS (i.e. function not implemented)

When restoring symlink permissions, assume that ENOSYS means that it's
not possible to lchmod().

For comparison, it looks like tar doesn't handle lchmod() at all yet.
From the Debian tar 1.27.1 TODO:

  * Add support for restoring the attributes of symbolic links, for
    OSes like FreeBSD that have the lutimes and lchmod functions.

Thanks to Xiao LIU for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoconfigure-sampledata: remove vestigial etc too
Rob Browning [Sat, 11 Apr 2015 17:10:38 +0000 (12:10 -0500)]
configure-sampledata: remove vestigial etc too

Thanks to Mark J Hewitt for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoDon't use "cp -a"
Rob Browning [Sun, 29 Mar 2015 16:47:45 +0000 (11:47 -0500)]
Don't use "cp -a"

It's not portable -- use portable cp options, or a new t/sync-tree
instead.  Thanks to Greg Troxel for reporting the problem after testing
on NetBSD 5.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoGet TZ offset from C localtime, given tm_gmtoff 0.27-rc4
Rob Browning [Sat, 28 Mar 2015 20:09:47 +0000 (15:09 -0500)]
Get TZ offset from C localtime, given tm_gmtoff

If we detect that struct tm contains tm_gmtoff, use the system
localtime() to compute timezone offsets.  This may help fix problems on
platforms where Python strftime "%z" doesn't report accurate timzeone
information.

Thanks to Patrick Rouleau for reporting just such a problem on Cygwin.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMerge --sparse restore fix and test improvements
Rob Browning [Sat, 28 Mar 2015 17:56:28 +0000 (12:56 -0500)]
Merge --sparse restore fix and test improvements

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAdjust sparse restore tests for test fs block size
Rob Browning [Sat, 28 Mar 2015 17:48:19 +0000 (12:48 -0500)]
Adjust sparse restore tests for test fs block size

Change test-sparse-files.sh to detect the test fs block size (when
possible) and adjust its behavior accordingly.  If the block size can't
be determined, use a block size of 3MB, which is hoped to be larger than
any block sizes we'll encounter anytime soon.

Previously the tests might fail on filesystems with relatively large
block sizes, like those on the current Debian powerpc and ppc64el build
daemons (64k).

Thanks to Goswin Brederlow for mentioning that the Lucene block size is
1MB, to Robert Edmonds for running a build through the Debian buildds,
which revealed the problem, and to Julien Cristau for reporting the
block size on the failing buildds.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoRework write_sparsely() to fix in-buffer zero runs
Rob Browning [Sun, 15 Mar 2015 21:43:47 +0000 (16:43 -0500)]
Rework write_sparsely() to fix in-buffer zero runs

Fix the sparse restoration of buffers that have non-zero bytes, followed
by a run of zero bytes that's longer than the minimum sparse run
length (currently 512), followed by non-zero bytes.

Previously, the initial non-zero bytes would be *lost*.

In the new code, don't unconditionally output previous zero bytes --
merge them with any leading zeros in the current block.

And allow arbitrarily large sparse regions; use append_sparse_region()
to break up runs that are too large for off_t into a sequence of seeks
of no more than INT_MAX bytes each.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoTest sparse restore of short in-buffer zero run
Rob Browning [Sun, 15 Mar 2015 21:38:34 +0000 (16:38 -0500)]
Test sparse restore of short in-buffer zero run

Test that sparse --restore handles the case where within one call to
write_sparsely() (one buffer) we have non-zero bytes, followed by a run
of zero bytes that's longer than the minimum sparse run
length (currently 512), followed by non-zero bytes.

Currently, the initial non-zero bytes will be lost, and this test will
fail.

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