]> arthur.barton.de Git - bup.git/log
bup.git
9 years agoOnly silence ENOENT in helpers.unlink
Nathan Bird [Fri, 8 Aug 2014 16:59:20 +0000 (09:59 -0700)]
Only silence ENOENT in helpers.unlink

This is what it is documented as doing and what makes sense in this
case.

Signed-off-by: Nathan Bird <ecthellion@gmail.com>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoatomically_replaced_file: ensure error leaves original
Rob Browning [Wed, 6 Aug 2014 02:01:08 +0000 (21:01 -0500)]
atomically_replaced_file: ensure error leaves original

Make sure an exception inside the body leaves the original file
content.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMerge work on atomic writes
Rob Browning [Tue, 5 Aug 2014 17:41:49 +0000 (12:41 -0500)]
Merge work on atomic writes

9 years agothelpers.py: use t/tmp as the tmpdir parent
Rob Browning [Tue, 5 Aug 2014 17:33:43 +0000 (12:33 -0500)]
thelpers.py: use t/tmp as the tmpdir parent

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAdjust atomically_replaced_file documentation.
Rob Browning [Tue, 5 Aug 2014 17:29:31 +0000 (12:29 -0500)]
Adjust atomically_replaced_file documentation.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAdd atomically_replaced_file for safer output
Nathan Bird [Thu, 17 Jul 2014 22:27:40 +0000 (18:27 -0400)]
Add atomically_replaced_file for safer output

Use `tempfile.mkstemp` to write files safely and then rename them
atomically to the target filename at the end. This guarantees that two
concurrent processes trying to write the same target file will result
in one process "winning" with a consistent version.

Use this to protect:
 * midx writing
 * .idx cache writing

Previously both of these processes `open(destination + '.tmp', 'w')`
which would lead to concurrent processes writing the same tmp file at
the same time.

See also https://groups.google.com/d/msg/bup-list/qdPUaXGO1cI/g8K2aFaaXz0J

Signed-off-by: Nathan Bird <ecthellion@gmail.com>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agotest-fuse.sh: make ls output locale independent
Tim Riemenschneider [Wed, 30 Jul 2014 18:39:47 +0000 (20:39 +0200)]
test-fuse.sh: make ls output locale independent

Call "ls" with LC_ALL set to "C".

(Otherwise it reports "total" for English, "insgesamt" for German;
other locales would be similar.)

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoOmit htonll when already #defined
R. Andrew Ohana [Tue, 29 Jul 2014 20:38:49 +0000 (13:38 -0700)]
Omit htonll when already #defined

OS X 10.10 Yosemite defines it as a macro.

Signed-off-by: R. Andrew Ohana <andrew.ohana@gmail.com>
[rlb@defaultvalue.org: adjust comments; adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoCorrect author for 497505901824dd7382d1d80e152f6b6d810a2844
Nick Alcock [Sun, 20 Jul 2014 22:52:05 +0000 (17:52 -0500)]
Correct author for 497505901824dd7382d1d80e152f6b6d810a2844

The author for 497505901824dd7382d1d80e152f6b6d810a2844 was incorrect.
It should have been "Nick Alcock <nick.alcock@oracle.com>", matching
the Signed-off-by.

[rlb@defaultvalue.org: add correction on behalf of author]

9 years agoJust log when skipping a large file during save
Nix [Sat, 19 Jul 2014 22:01:58 +0000 (23:01 +0100)]
Just log when skipping a large file during save

If bup-save --smaller= is specified, the user *expects* large files
to be skipped.  Having bup report errors and return exitcode 1 in this
case hides real errors.  Instead, log it when running verbosely, but
not otherwise.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
[rlb@defaultvalue.org: adjust commit summary; simplify opt.verbose >= 1
 to opt.verbose]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoFix HEAD request handling in bup-web
Will Rouesnel [Thu, 12 Jun 2014 17:58:49 +0000 (03:58 +1000)]
Fix HEAD request handling in bup-web

HEAD requests to files did not set self.finished(). This causes problems
with user-agents that expect some type of request since it never closes
(OpenOffice/LibreOffice will notably stall opening files from a URL).

This patch stands alone from WebDAV but also fixes the problem there.

The problem can be demonstrated like this:

    bup web
    curl -I 'http://127.0.0.1:8080/some/file'

Signed-off-by: Will Rouesnel <w.rouesnel@gmail.com>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agotest-fuse.sh: use invariant test data
Rob Browning [Tue, 15 Jul 2014 15:44:18 +0000 (10:44 -0500)]
test-fuse.sh: use invariant test data

Thanks to Tim Riemenschneider <t.riemenschneider@detco.de> for
reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoUpdate README.md
Fabian Bakkum [Wed, 9 Jul 2014 12:50:08 +0000 (14:50 +0200)]
Update README.md

Make a backup to a remote server instead of Make a backup ON a remote server.

Was very missleading.

9 years agoHACKING: update to reflect 0.26 release 0.26
Rob Browning [Tue, 8 Jul 2014 19:25:40 +0000 (14:25 -0500)]
HACKING: update to reflect 0.26 release

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agotest-fuse.sh: set TZ=UTC for ls dates
Rob Browning [Sun, 6 Jul 2014 18:26:45 +0000 (13:26 -0500)]
test-fuse.sh: set TZ=UTC for ls dates

Thanks to Mark J Hewitt <mjh@idnet.com> and Scott Sugar
<scottsugar@outlook.com> for reporting the problem, and Patrick
Rouleau <prouleau72@gmail.com> for helping test the solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAvoid uid/gid 0 metadata tests when ids don't exist 0.26-rc2
Patrick Rouleau [Thu, 3 Jul 2014 00:58:39 +0000 (20:58 -0400)]
Avoid uid/gid 0 metadata tests when ids don't exist

Cygwin may not have a 0 uid/gid, so skip the relevant tests whenever
it doesn't.

We have to explicitly exclude the gid 0 from other_group, because
/etc/group may define a group named root with the same id as
Administrators. We cannot use "root" instead of 0, because root may
not be defined.

Cygwin users: If you want to define the root group, add this line
at the begining of /etc/group:
  root:S-1-5-32-544:0:

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agotest-meta.sh: use user's uid/gid, not 0
Patrick Rouleau [Thu, 3 Jul 2014 00:58:38 +0000 (20:58 -0400)]
test-meta.sh: use user's uid/gid, not 0

Cygwin does not fully support uid and gid of 0. Instead, use the
current user's ids to avoid portability problems. Since this test is
not run for ordinary users, the result is the same.

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoformat-subst.pl: check for subcommand failure
Rob Browning [Mon, 30 Jun 2014 19:11:10 +0000 (14:11 -0500)]
format-subst.pl: check for subcommand failure

Thanks to karl.richter722@gmail.com for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoparse_excludes: drop empty --exclude-from paths
Rob Browning [Mon, 30 Jun 2014 18:33:05 +0000 (13:33 -0500)]
parse_excludes: drop empty --exclude-from paths

Empty paths shouldn't match during drecurse, but there's no point in
including them.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoIgnore empty lines in --exclude-rx-from files
Rob Browning [Mon, 30 Jun 2014 18:15:58 +0000 (13:15 -0500)]
Ignore empty lines in --exclude-rx-from files

Thanks to Daniel Hahler Daniel Hahler <git@thequod.de> for suggesting
the change.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agosave-cmd.py: don't test for meta index via access()
Rob Browning [Sat, 28 Jun 2014 18:59:19 +0000 (13:59 -0500)]
save-cmd.py: don't test for meta index via access()

Instead just try to open the metadata index and catch any EACCES.
There may be an issue with access on Cygwin
(http://bugs.python.org/issue2528), and even if not, this approach
removes a potential race between access() and open().

Thanks to Mark J Hewitt <mjh@idnet.com> for reporting the problem and
helping track down the cause.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoInitialize _file in MetaStoreReader before open
Rob Browning [Sat, 28 Jun 2014 18:58:01 +0000 (13:58 -0500)]
Initialize _file in MetaStoreReader before open

So that __del__() will work properly if open fails.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAvoid using incomplete utimensat implementations.
Greg Troxel [Tue, 3 Jun 2014 14:59:56 +0000 (10:59 -0400)]
Avoid using incomplete utimensat implementations.

At least NetBSD 6 has partial support for utimensat, implementing the
function but not providing needed definitions via sys/stat.h as POSIX
requires.  Check for needed defines, and if missing, undefine
HAVE_UTIMENSAT.

Signed-Off-By: Greg Troxel <gdt@ir.bbn.com>
Tested-By: Greg Troxel <gdt@ir.bbn.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agoweb-cmd.py: open browser from ioloop callback
Rob Browning [Fri, 6 Jun 2014 01:59:24 +0000 (20:59 -0500)]
web-cmd.py: open browser from ioloop callback

Assuming the callback won't be called until tornado is ready to
receive requests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoweb-cmd.py: add --browser option to open the site
Holger Dell [Thu, 5 Jun 2014 23:04:10 +0000 (18:04 -0500)]
web-cmd.py: add --browser option to open the site

Signed-off-by: Holger Dell <github@holgerdell.com>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agofuse-cmd.py: given --meta, report original metadata
Rob Browning [Fri, 30 May 2014 02:54:49 +0000 (21:54 -0500)]
fuse-cmd.py: given --meta, report original metadata

Add a new --meta option to "bup fuse", and when specified, report the
original mode, uid, gid, atime, mtime, and ctime for the mounted
paths.

Since negative timestamps cause access errors, and cause "ls -l" to
report question marks for the stat values, set a floor of 0 for all
timestamps reported to python-fuse.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMakefile: add missing t/test-save-creates-no-unrefs.sh
Holger Dell [Wed, 4 Jun 2014 05:16:43 +0000 (00:16 -0500)]
Makefile: add missing t/test-save-creates-no-unrefs.sh

Signed-off-by: Holger Dell <github@holgerdell.com>
[rlb@defaultvalue.org: adjust commit summary]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agomangle_path: verify chunked name refers to git dir
Holger Dell [Wed, 4 Jun 2014 05:16:47 +0000 (00:16 -0500)]
mangle_path: verify chunked name refers to git dir

Before returning the mangled name.bup for a chunked item, ensure that
the name really does refer to a dir in the git tree via asssert.

Signed-off-by: Holger Dell <github@holgerdell.com>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agogit.py: fix minor typos in comments
Holger Dell [Wed, 4 Jun 2014 05:16:46 +0000 (00:16 -0500)]
git.py: fix minor typos in comments

Signed-off-by: Holger Dell <github@holgerdell.com>
[rlb@defaultvalue.org: adjust commit summary]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agoimport-rdiff-backup-cmd: invoke mktemp more portably
Rob Browning [Mon, 2 Jun 2014 16:36:27 +0000 (11:36 -0500)]
import-rdiff-backup-cmd: invoke mktemp more portably

This should fix a problem on NetBSD 6, reported by Greg Troxel
<gdt@lexort.com>.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Greg Troxel <gdt@lexort.com>
Tested-by: Greg Troxel <gdt@lexort.com>
9 years agoUS/Central is not a common timezone, use America/Chicago
Brandon Smith [Fri, 30 May 2014 21:34:56 +0000 (14:34 -0700)]
US/Central is not a common timezone, use America/Chicago

Signed-off-by: Brandon Smith <freedom@reardencode.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agot/force-delete: bash is not always at /bin/bash
Brandon Smith [Fri, 30 May 2014 21:34:55 +0000 (14:34 -0700)]
t/force-delete: bash is not always at /bin/bash

Signed-off-by: Brandon Smith <freedom@reardencode.com>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMerge fixes for orphaned midx files on Cygwin
Rob Browning [Wed, 28 May 2014 16:55:37 +0000 (11:55 -0500)]
Merge fixes for orphaned midx files on Cygwin

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoKeep PackMidx pointers until finished with mmap
Rob Browning [Thu, 22 May 2014 19:12:54 +0000 (14:12 -0500)]
Keep PackMidx pointers until finished with mmap

Now that PackMidx objects close their mmap, don't drop the pointers to
them in midx-cmd.py until finished with the mmaps.

The isinstance() call may need revisiting later.  i.e. should all
indexes support close()?

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agomidx: close the mmap before erasing an midx file
Patrick Rouleau [Thu, 22 May 2014 03:36:27 +0000 (23:36 -0400)]
midx: close the mmap before erasing an midx file

Linux allows erasing a file even if it is still memory mapped, but
Windows does not. However, Cygwin tries to emulate Linux and, under
certain conditions, it silently moves the file to $RECYCLED.BIN/, but
not in a way where Windows takes care of it when we use the "empty the
recycled bin" command. The erased midx ends up comsuming more and more
disk space.

To solve this, we have to close the midx's mmap before erasing
the midx.

Cygwin users: you can use this command to clean up your
$RECYCLE.BIN/ directories:
find /cygdrive/?/\$RECYCLE.BIN/ -name "\.???[[:xdigit:]]*" -print -delete

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
[rlb@defaultvalue.org: adjust commit message]

9 years agoDon't call _mksubs() in VFS Node nlink()
Rob Browning [Fri, 23 May 2014 22:02:11 +0000 (17:02 -0500)]
Don't call _mksubs() in VFS Node nlink()

The VFS Node nlink() code calls _mksubs(), but then just returns 1.
It looks like that may be unnecessary work, so stop doing it.

Thanks to William Stein <wstein@gmail.com> for pointing it out.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoUse CatPipe, not show, in git_commit_dates()
Rob Browning [Sun, 18 May 2014 05:51:34 +0000 (00:51 -0500)]
Use CatPipe, not show, in git_commit_dates()

Import the commit parser from the experimental bup-get branch and use
it along with CatPipe to produce the git commit dates in
git_commit_dates().

This appears to resolve the performance problem with real archives
that was introduced by the use of "git show -s --pretty=format:%ct
..." (cf. 00ba9fb811e71bb6182b9379461bc6b493e3b7a4), and is still much
faster than 0.25 for at least a 1000 branch synthetic repository here.

Thanks to Gabriel Filion <gabster@lelutin.ca> for reporting the
problem, and to him and Patrick Rouleau <prouleau72@gmail.com> for
helping test the solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMove VFS cp() to git.py; handle repodir changes
Rob Browning [Wed, 21 May 2014 02:40:51 +0000 (21:40 -0500)]
Move VFS cp() to git.py; handle repodir changes

Move the VFS's cp() to git.py and reset the cp() CatPipe whenever the
global repodir changes.

Previously, if two different lib/bup/t/ tests (for example) needed to
use two different repositories, and both happened to indirectly call
cp(), the second test would end up with a CatPipe() connected to the
wrong repository.

In the longer run, we may want to consider further cleanup here, but
this should fix the immediate problem without too much risk.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoFix git_commit_dates() to handle (obvious) duplicates
Rob Browning [Sat, 17 May 2014 20:34:32 +0000 (15:34 -0500)]
Fix git_commit_dates() to handle (obvious) duplicates

Since git show will suppress duplicate results, change
git_commit_dates() to detect that situation and repair the damage.

Though currently, it can only handle cases where the duplicates are
obvious, i.e. have the same exact string in the argument list.  It
won't be able to handle cases where two arguments differ, but resolve
to the same underlying hash.  For our current purposes, that should be
fine since we only pass in hashes.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoInitialize MetaStoreWriter self._file to None
Rob Browning [Wed, 14 May 2014 17:01:10 +0000 (12:01 -0500)]
Initialize MetaStoreWriter self._file to None

Without this, if something goes wrong in the constructor self._file
may not be initialized, which causes close(), invoked via __del__(),
to crash.

Thanks to Fabian Bakkum <fabianbakkum@hotmail.com> for reporting the
problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoRe-allow backup set names containing "/"
Rob Browning [Wed, 14 May 2014 15:24:00 +0000 (10:24 -0500)]
Re-allow backup set names containing "/"

Revert the prohibition because all releases up to now have allowed
"/", and so that's nothing new.  Disabling "/" in 0.26 would be a
regression, and one we're not ready to commit to -- in fact, we may
eventually do the opposite, and add comprehensive support for "/".

This reverts commit 52a98179490c6ccb990e221bbdeb511f1de59de4.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMove unshared version code from helpers to version-cmd.py 0.26-rc1
Gabriel Filion [Sat, 10 May 2014 22:45:37 +0000 (18:45 -0400)]
Move unshared version code from helpers to version-cmd.py

While this is relatively "harmless", the import * directive brings in a
whole lot of unused code into the version subcommand.

At the same time, the three version_* functions are only used in the
version subcommand, so their place inside helpers.py is unjustified. The
same goes for the _version module.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoReturn integers, not strings from get_commit_dates()
Rob Browning [Wed, 30 Apr 2014 01:16:54 +0000 (20:16 -0500)]
Return integers, not strings from get_commit_dates()

Returning strings broke bup fuse (surprising that it worked
elsewhere), and since we have no fuse tests, it wasn't immediately
apparent.

So fix the bug and add some initial (trivial) fuse tests so that at
least this particular problem doesn't happen again.

To cleanup after the fuse tests, detect fuse mounts in
t/cleanup-mounts-under, and try to unmount them.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAlways line-buffer bup restore stdout
Simon Persson [Sun, 11 May 2014 09:06:34 +0000 (17:06 +0800)]
Always line-buffer bup restore stdout

Flush stdout after every line, even when stdio is not a tty, to
provide more regular progress information.  Useful for progress
monitoring by a parent process or when watching a logfile with "tail".

Signed-off-by: Simon Persson <simonpersson1@gmail.com>
[rlb@defaultvalue.org: adjust commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoFind SC_ARG_MAX via C sysconf().
Rob Browning [Sat, 10 May 2014 23:02:52 +0000 (18:02 -0500)]
Find SC_ARG_MAX via C sysconf().

Apparently os.sysconf('SC_ARG_MAX') returns -1, even in some common
cases.

Thanks to Alexander Barton <alex@barton.de> for reporting that at
least when run under make 3.81, os.sysconf('SC_ARG_MAX') was just
returning -1.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoRead ARG_MAX directly via os.sysconf('SC_ARG_MAX').
Rob Browning [Sat, 10 May 2014 20:51:38 +0000 (15:51 -0500)]
Read ARG_MAX directly via os.sysconf('SC_ARG_MAX').

For now, this code also adds an optional arg_max parameter to
batchpipe(), exclusively for testing.

There appears to be an issue with wvtest at the moment that causes
assignments to something like helpers.arg_max to have no effect from
the importers perspective.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoRevert "Write the system ARG_MAX to an autogenerated config.py..."
Rob Browning [Sat, 10 May 2014 18:23:00 +0000 (13:23 -0500)]
Revert "Write the system ARG_MAX to an autogenerated config.py..."

Prepare to try a more direct approach.

This reverts commit b72365ad597edbc528da5b93528fc3a67a18d58e.

9 years agoRetrieve the dates for all branches with one bulk git call in the VFS.
Rob Browning [Thu, 8 May 2014 19:01:57 +0000 (14:01 -0500)]
Retrieve the dates for all branches with one bulk git call in the VFS.

Instead of calling "git rev-list" once per branch to get the branch
tip dates for the VFS branch list, make a single call to "git show"
using a suitable pretty format, and pass all the branch refs as
arguments.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoAdd a batchpipe() command to helpers that behaves somewhat like xargs(1).
Rob Browning [Thu, 8 May 2014 18:52:25 +0000 (13:52 -0500)]
Add a batchpipe() command to helpers that behaves somewhat like xargs(1).

Add batchpipe(), which will yield the output produced by calling a
given external command with a given list of arguments.

The resulting output may be provided in chunks, from multiple
invocations of the command, if the limits imposed by ARG_MAX make that
necessary.

See http://www.in-ulm.de/~mascheck/various/argmax/ for details, but
note that batchpipe() takes the additional precaution of adding room
for the argv pointers in addition to the envp pointers.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoWrite the system ARG_MAX to an autogenerated config.py at configure time.
Rob Browning [Thu, 8 May 2014 18:44:11 +0000 (13:44 -0500)]
Write the system ARG_MAX to an autogenerated config.py at configure time.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoMerge work to make helpers.next() match the newer Python next().
Rob Browning [Thu, 8 May 2014 17:47:57 +0000 (12:47 -0500)]
Merge work to make helpers.next() match the newer Python next().

9 years agoOnly define helpers.next() if Python's isn't new enough.
Rob Browning [Thu, 8 May 2014 16:50:29 +0000 (11:50 -0500)]
Only define helpers.next() if Python's isn't new enough.

Since helpers.next() now matches the Python built-in's semantics
(since Python 2.6), just rely on the built-in when it's new enough.
Otherwise, set up a matching replacement.

Borrow the fallback next documentation string from Python.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoDrop helpers.next() and just use Python's built-in.
Aidan Hobson Sayers [Thu, 12 Dec 2013 20:29:22 +0000 (20:29 +0000)]
Drop helpers.next() and just use Python's built-in.

The python built-in 'next' function has an optional second parameter
that specifies what to return instead of excepting with StopIteration.
There is therefore no need for the function in helpers.py.

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
9 years agohelpers.py: use returncode to get the subprocess exit code in readpipe().
Rob Browning [Fri, 2 May 2014 17:32:07 +0000 (12:32 -0500)]
helpers.py: use returncode to get the subprocess exit code in readpipe().

Hello?  It's returncode, not retcode -- and how about a test?

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agoUse the author date, not committer date for the bup save date.
Rob Browning [Mon, 10 Feb 2014 19:03:09 +0000 (13:03 -0600)]
Use the author date, not committer date for the bup save date.

Since it's the author date that indicates when the save was made, use
that instead of the committer date to represent saves.

Doing so means that any operations on branches (like rebase,
cherry-pick, etc.) won't change the "save date" as far as bup is
concerned.

This should have no effect with respect to backward compatibility
because until now, bup always used the same date for the author and
committer.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
9 years agohelpers.py: check subprocess exit status in readpipe().
Rob Browning [Sun, 23 Mar 2014 22:52:59 +0000 (17:52 -0500)]
helpers.py: check subprocess exit status in readpipe().

Checking the exit status seems like a good idea.  Note that we can't
just use check_output() because it wasn't added until Python 2.7.

Thanks to Alexander Barton <alex@barton.de> for reporting the version
incompatibility with respect to an earlier version of this patch.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-ls.sh: handle Cygwin's coupling of timestamp/permission modifications.
Patryck Rouleau [Sun, 30 Mar 2014 15:04:49 +0000 (11:04 -0400)]
test-ls.sh: handle Cygwin's coupling of timestamp/permission modifications.

In Cygwin, the file's modification date is updated when its
permissions are modified. To make the tests compatible with Cygwin,
create the files first, set their permissions, then set the date.

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd VFS Node release() and release nodes during restore, after traversal.
Rob Browning [Sat, 12 Apr 2014 19:17:48 +0000 (14:17 -0500)]
Add VFS Node release() and release nodes during restore, after traversal.

Add a release() method to Node that will drop resources that can (and
will) be automatically restored when required -- though restoring the
resources may have a non-trivial cost.  For now, drop the node's
metadata and its children.

Call node.release() in restore-cmd.py after restoring a node.  This
substantially decreases the memory required by a restore because the
whole tree is no longer retained in RAM.

Thanks to Patrick Rouleau <prouleau72@gmail.com> for helping track
down the problem, and proposing a slightly different initial patch to
fix it.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Patrick Rouleau <prouleau72@gmail.com>
10 years agosave-cmd.py: hashsplit .bupm metadata files.
Rob Browning [Fri, 4 Apr 2014 19:29:24 +0000 (14:29 -0500)]
save-cmd.py: hashsplit .bupm metadata files.

Previously the metdata for each directory's content was being written
as a single blob, with no deduplication -- probably not what we want.
Fix it.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMerge work to have "bup split" produce a top-level VFS file.
Rob Browning [Thu, 10 Apr 2014 21:06:17 +0000 (16:06 -0500)]
Merge work to have "bup split" produce a top-level VFS file.

10 years agoAlways name the top-level split file "data", instead of the branch basename.
Rob Browning [Sun, 6 Apr 2014 19:59:44 +0000 (14:59 -0500)]
Always name the top-level split file "data", instead of the branch basename.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMake bup-split commits appear as files to the vfs layer.
Yung-Chin Oei [Mon, 8 Oct 2012 14:08:34 +0000 (15:08 +0100)]
Make bup-split commits appear as files to the vfs layer.

When viewing branches that were generated by bup-split through bup-fuse
(or any other frontend relying on vfs.py), these are presented as trees
of the hashsplitted blobs. This means that bup-split output is only
usefully accessible through bup-join.

This change makes bup-split store named commits such that they appear as
files, named with the last component of their branch name(*). That is,
from the vfs layer, they now appear like so:
    branch_name/latest/branch_basename

(*) While bup doesn't currently handle slashes in branch names, patches
    to this end are on the mailing list, so this patch should handle
    them, in anticipation of their general support in bup.

To address potential concerns: the storage format is changed in subtle
ways, in that the top level tree now contains a "normally" named object,
rather than byte-offset names.  However, bup-join doesn't care about
this, and as bup-join was previously the only way to use these commits,
the user experience is not affected.

We also add a test for the new functionality. (The test uses an empty
string as input data, because this is the second way in which this patch
changes the behaviour of bup-split: previously, passing empty strings to
bup-split would make it generate an empty git tree, whereas now it
relies on hashsplit.split_to_blob_or_tree() to make a blob for the empty
string. This is meaningful because vfs.py chokes on empty git trees.)

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
[rlb@defaultvalue.org: rebase to current master; adjust code indentation.]

10 years agovfs.py: don't redundantly _populate_metadata for Dir()s.
Rob Browning [Fri, 4 Apr 2014 20:55:37 +0000 (15:55 -0500)]
vfs.py: don't redundantly _populate_metadata for Dir()s.

This fix should significantly improve performance.  Without it, every
call to node.metadata() caused the VFS to read the entire .bupm file
in order to (re)initialize the metadata for every entry in the
directory.  Don't do that.

I thought I'd already implemented this, but apparently only in my
head.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd initial support for ls(1) style "-d" argument to "bup ls".
Rob Browning [Sat, 22 Mar 2014 05:20:20 +0000 (00:20 -0500)]
Add initial support for ls(1) style "-d" argument to "bup ls".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoindex.py: fix typo in Writer._add.
Rob Browning [Thu, 3 Apr 2014 18:20:45 +0000 (13:20 -0500)]
index.py: fix typo in Writer._add.

Thanks to bk <b.karran@gmail.com> for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoindex-cmd: prevent a division by zero while computing paths_per_second.
Patryck Rouleau [Mon, 31 Mar 2014 01:21:31 +0000 (21:21 -0400)]
index-cmd: prevent a division by zero while computing paths_per_second.

Signed-off-by: Patryck Rouleau <prouleau72@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agot/tmetadata.py: accommodate changes to xattr.set error message.
Mark J Hewitt [Fri, 28 Mar 2014 14:46:18 +0000 (14:46 +0000)]
t/tmetadata.py: accommodate changes to xattr.set error message.

Correct the expected error string for xattr.set (changed in
21eab6b52fcf65827e21ca33fd3349157993053c).

Signed-off-by: Mark J Hewitt <m.hewitt@computer.org>
[rlb@defaultvalue.org: adjust commit message, and include a leading
 single quote in what we're looking for, to match
 c8c1f0341c82f4abf4d3f8eed1fe4ddfa4a48493.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agot/test-meta.sh: fix xattr.set test broken by path output on error.
Rob Browning [Wed, 26 Mar 2014 23:47:59 +0000 (18:47 -0500)]
t/test-meta.sh: fix xattr.set test broken by path output on error.

This was broken by 21eab6b52fcf65827e21ca33fd3349157993053c, and I
(obviously) didn't test as root before pushing.

Thanks to Mark J Hewitt <mjh@idnet.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoPass any VFS Dir() constructor keywords on to Node().
Rob Browning [Sat, 22 Mar 2014 18:44:55 +0000 (13:44 -0500)]
Pass any VFS Dir() constructor keywords on to Node().

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agowvtest.sh: add WVDIE().
Rob Browning [Sat, 22 Mar 2014 19:32:17 +0000 (14:32 -0500)]
wvtest.sh: add WVDIE().

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agometadata.py: xattr exception strings don't have path information; add it.
Rob Browning [Sun, 23 Mar 2014 16:19:31 +0000 (11:19 -0500)]
metadata.py: xattr exception strings don't have path information; add it.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-ls.sh: don't check the symlink file size on NetBSD for now.
Rob Browning [Sun, 23 Mar 2014 15:39:25 +0000 (10:39 -0500)]
test-ls.sh: don't check the symlink file size on NetBSD for now.

NetBSD appears to be returning varying file sizes for symlinks at the
moment, so just ignore the size there for now.

Thanks to Thomas Klausner <tk@giga.or.at> for reporting the problem
and to him and Greg Troxel <gdt@ir.bbn.com> for help with the
workaround.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-ls.sh: get the group and gid from the filesystem.
Rob Browning [Sat, 22 Mar 2014 15:25:32 +0000 (10:25 -0500)]
test-ls.sh: get the group and gid from the filesystem.

Get the expected gid from the filesystem, not "id", because on some
platforms (BSDs, etc.) a new path's gid is taken from the parent
directory, not the effective gid.

Thanks to Thomas Klausner <tk@giga.or.at> for reporting the problem
and to him and Greg Troxel <gdt@ir.bbn.com> for helping craft the
solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years ago_helpers.c: use "unsigned long long" in ASSIGN_PYLONG_TO_INTEGRAL().
Rob Browning [Fri, 21 Mar 2014 20:13:27 +0000 (15:13 -0500)]
_helpers.c: use "unsigned long long" in ASSIGN_PYLONG_TO_INTEGRAL().

The result of PyLong_AsUnsignedLongLong() was being assigned to an
"unsigned long".  Don't do that.

Thanks to Alexander Barton <alex@barton.de> for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agowvtest.sh: print a backtrace on failure when running under bash.
Rob Browning [Thu, 20 Mar 2014 18:52:06 +0000 (13:52 -0500)]
wvtest.sh: print a backtrace on failure when running under bash.

Very handy when there are nested WV* calls, i.e.

  foo() { ... WVPASS bar; ... }
  ...
  WVPASS foo

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agowvtest.sh: declare non-global variables to be local.
Rob Browning [Thu, 20 Mar 2014 15:29:43 +0000 (10:29 -0500)]
wvtest.sh: declare non-global variables to be local.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoReport paths/s in index progress information.
Rob Browning [Sat, 15 Feb 2014 02:52:30 +0000 (20:52 -0600)]
Report paths/s in index progress information.

Tested-by: Alexander Barton <alex@barton.de>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoUse "EXAMPLES" consistently in the manpages.
Rob Browning [Thu, 20 Mar 2014 22:01:20 +0000 (17:01 -0500)]
Use "EXAMPLES" consistently in the manpages.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agowvtest.sh: add "Local Variables" for file's current code style.
Rob Browning [Thu, 20 Mar 2014 15:22:18 +0000 (10:22 -0500)]
wvtest.sh: add "Local Variables" for file's current code style.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agowvtest.sh: remove unused LVL variable.
Rob Browning [Thu, 20 Mar 2014 15:18:22 +0000 (10:18 -0500)]
wvtest.sh: remove unused LVL variable.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoDisable -Wtautological-compare for INTEGER_TO_PY() calls for clang.
Rob Browning [Tue, 18 Mar 2014 16:19:41 +0000 (11:19 -0500)]
Disable -Wtautological-compare for INTEGER_TO_PY() calls for clang.

Without this, INTEGER_TO_PY() produces clang errrors like this on some
platforms:

  _helpers.c:1019:41: error: comparison of unsigned expression >= 0 is always true
  [-Werror,-Wtautological-compare]
                           (((st->st_uid) >= 0) ? PyLong_FromUnsignedLongLong(st->st_uid) :
  PyLong_FromLongLong(st->st_uid)),
                             ~~~~~~~~~~~~ ^  ~

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-on.sh: add some simple "bup on" tests.
Rob Browning [Mon, 17 Mar 2014 17:59:12 +0000 (12:59 -0500)]
test-on.sh: add some simple "bup on" tests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-ls.sh: take only the first 10 chars from ls -l's mode string.
Rob Browning [Tue, 18 Feb 2014 18:30:31 +0000 (12:30 -0600)]
test-ls.sh: take only the first 10 chars from ls -l's mode string.

Since ls -l's mode string may not be separated from the next field by
a space (i.e. when ACLs, etc. are involved), take only the first 10
characters for now when retrieving the symlink mode string (cf.
30d9027cc5444f038d38927219dc59e3b69fa219).

Thanks to Mark J Hewitt <mjh@idnet.com> for pointing out the problem
and testing the solution.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-compression.sh: use "tar ... | wc -c" instead of du.
Rob Browning [Mon, 17 Feb 2014 18:39:05 +0000 (12:39 -0600)]
test-compression.sh: use "tar ... | wc -c" instead of du.

This test was failing on a ZFS system with compression enabled because
du wasn't summing the actual file sizes.  To fix that, use tar/wc so
that we'll calculate the actual tree size without having to worry
about the portability of du's --apparent-size argument.

Thanks to Björn Seifert <seifert@oern.de> for reporting the problem
and Greg Troxel <gdt@lexort.com> for suggesting this fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-ls.sh: get the symlink mode from the host ls; test for subcmd failure.
Rob Browning [Mon, 17 Feb 2014 18:22:58 +0000 (12:22 -0600)]
test-ls.sh: get the symlink mode from the host ls; test for subcmd failure.

This should fix a failure on OS X where symlinks don't have a
"rwxrwxrwx" mode like they do on Linux.

Thanks to Sashka Will <will.sashka@gmail.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd acl and attr to Debian/Ubuntu build deps and default to python-2.7.
Dmitry Polushkin [Tue, 11 Feb 2014 01:50:47 +0000 (01:50 +0000)]
Add acl and attr to Debian/Ubuntu build deps and default to python-2.7.

This fixes a "make test" failure on Ubuntu 12.04.

Signed-off-by: Dmitry Polushkin <dmitry.polushkin@gmail.com>
[rlb@defaultvalue.org: adjust commit message; fix trailing whitespace.]

10 years agoAlways return a level 0 blob from _splitbuf() for BLOB_MAX sized blobs.
Aidan Hobson Sayers [Sat, 23 Nov 2013 17:23:04 +0000 (17:23 +0000)]
Always return a level 0 blob from _splitbuf() for BLOB_MAX sized blobs.

Previously if _splitbuf() returned an offset anywhere in the buffer we
would always use the 'level' of the offset for the resulting blob.  So
when the offset was greater than BLOB_MAX, we'd still use the offset's
level, even though we'd be returning a blob that didn't reach that
offset.  In some cases, this could cause bup to generate a sequence of
BLOB_MAX sized blobs, each in their own own chunk group.

To fix that, set the level of all BLOB_MAX sized blobs to 0, which
makes those blobs behave just as they would have before this patch,
whenever they were found at the end of the buffer.

Test the new behavior -- the last two of these four new tests will
fail if run before the changes, as they check that blobs split by
enforcing BLOB_MAX do not 'inherit' the value of level from a split
later in the buffer.

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
[rlb@defaultvalue.org: squash tests commit into _splitbuf() changes commit;
 adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agosave-cmd.py, split-cmd.py: end the commit message with a newline.
Rob Browning [Fri, 14 Feb 2014 18:08:47 +0000 (12:08 -0600)]
save-cmd.py, split-cmd.py: end the commit message with a newline.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agosplit-cmd.py: respect --compress for remote repos too.
Rob Browning [Wed, 12 Feb 2014 18:10:27 +0000 (12:10 -0600)]
split-cmd.py: respect --compress for remote repos too.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMove Client compression spec from constructor to new_packwriter().
Rob Browning [Wed, 12 Feb 2014 18:09:03 +0000 (12:09 -0600)]
Move Client compression spec from constructor to new_packwriter().

This makes remote usage match local usage, where the compression is
per-PackWriter.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agometadata.summary_str(): don't ignore a size of 0 (i.e. print "0", not "-").
Rob Browning [Thu, 6 Feb 2014 18:01:05 +0000 (12:01 -0600)]
metadata.summary_str(): don't ignore a size of 0 (i.e. print "0", not "-").

Thanks to Karl Kiniger <karl.kiniger@med.ge.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-ls.sh: eliminate timezone dependencies; test dates in two timezones.
Rob Browning [Thu, 6 Feb 2014 00:34:32 +0000 (18:34 -0600)]
test-ls.sh: eliminate timezone dependencies; test dates in two timezones.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoRestore ls -l item sizes, and add initial tests for them.
Rob Browning [Wed, 5 Feb 2014 20:19:12 +0000 (14:19 -0600)]
Restore ls -l item sizes, and add initial tests for them.

Thanks to Karl Kiniger <karl.kiniger@med.ge.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix the ls -laAF options with respect to the VFS synthetic directories.
Rob Browning [Thu, 30 Jan 2014 22:26:44 +0000 (16:26 -0600)]
Fix the ls -laAF options with respect to the VFS synthetic directories.

Before this, they wouldn't work in various cases where the VFS was
creating synthetic data (like the top-level branch and commit-list
trees).

Oh, and how about some tests?

Thanks to Gabriel Filion <gabster@lelutin.ca> for reporting the
problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agometadata.py: add a more meaningful repr() to Metadata.
Rob Browning [Wed, 29 Jan 2014 21:27:37 +0000 (15:27 -0600)]
metadata.py: add a more meaningful repr() to Metadata.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd --exclude-rx and --exclude-rx-from support to "bup drecurse".
Rob Browning [Fri, 31 Jan 2014 00:56:05 +0000 (18:56 -0600)]
Add --exclude-rx and --exclude-rx-from support to "bup drecurse".

Thanks to nicolas.pouillard@gmail.com for the reminder.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix drecurse relative --excludes, quash duplicates, and add tests.
Rob Browning [Fri, 31 Jan 2014 00:49:36 +0000 (18:49 -0600)]
Fix drecurse relative --excludes, quash duplicates, and add tests.

Previously "bup drecurse --exclude bar foo" wouldn't work because bar
would be expanded to an absolute path, but drecurse would traverse
(and attempt to match against) relative paths.

Have parse_excludes() remove duplicates and sort its result.

Add some initial drecurse tests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agobup-index.md: remove misleading --exclude expansion comment.
Rob Browning [Fri, 31 Jan 2014 00:25:33 +0000 (18:25 -0600)]
bup-index.md: remove misleading --exclude expansion comment.

This comment was originally added in reference to some confusion over
globbing, but the text was misleading because bup does apply
realpath() to all of the --exclude paths, arguably a form of
expansion.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agovfs.py: replace "X" placeholder with the instance id in Node.__repr__().
Rob Browning [Wed, 29 Jan 2014 21:19:42 +0000 (15:19 -0600)]
vfs.py: replace "X" placeholder with the instance id in Node.__repr__().

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agogit.py: remove unused home_repodir variable.
Rob Browning [Tue, 21 Jan 2014 23:06:16 +0000 (17:06 -0600)]
git.py: remove unused home_repodir variable.

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