]> arthur.barton.de Git - bup.git/log
bup.git
10 years agoRemove all of the remaining test-related "set -e" usage.
Rob Browning [Sun, 27 Oct 2013 22:42:39 +0000 (17:42 -0500)]
Remove all of the remaining test-related "set -e" usage.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix xattr tests and bugs revealed (fully remove set -e from test-meta.sh).
Rob Browning [Sun, 27 Oct 2013 18:23:20 +0000 (13:23 -0500)]
Fix xattr tests and bugs revealed (fully remove set -e from test-meta.sh).

Fixing the xattr tests to run correctly pointed out that bup stops
trying to apply metadata after the first failure (i.e. after any
metadata record application fails).  Change it so that bup always
tries every metadata record.  Otherwise, bup may skip some forms of
metadata without any notification -- and it shouldn't.  For example,
it shouldn't skip ACLs just because the current filesystem doesn't
support xattrs.

Fix two additional problems that were exposed by the changes described
above.

Check for EACCES when trying to apply an attr record, and properly
convert it to an ApplyError.  This problem was revealed by
test_apply_to_path_restricted_access.

Check for EACCES when trying to read the current filesystem xattrs
during the process of applying the metadata xattrs, and when
encountered, convert it to an ApplyError.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix ACL tests, and the bugs revealed thereby.
Rob Browning [Sun, 27 Oct 2013 18:02:08 +0000 (13:02 -0500)]
Fix ACL tests, and the bugs revealed thereby.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoRemove more of the "set -e" dependency from test-meta.sh.
Rob Browning [Sun, 27 Oct 2013 16:25:53 +0000 (11:25 -0500)]
Remove more of the "set -e" dependency from test-meta.sh.

Remove the "set -e" dependency from the remaining code where doing so
doesn't reveal any bugs.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix the "set -e" problem in the test-meta.sh chattr tests.
Rob Browning [Sat, 26 Oct 2013 20:03:12 +0000 (15:03 -0500)]
Fix the "set -e" problem in the test-meta.sh chattr tests.

Start fixing the "set -e" problem, beginning with the test-meta.sh
chattr tests, and add support to the test filesystem for options
needed by the chattr calls.

To allow us to produce a more digestable sequence of patches for the
broader "set -e" problem, temporarily establish BUP_SKIP_BROKEN_TESTS
which will do what it says when set, and until we finish repairing
everything, it must be set during any testing:

  BUP_SKIP_BROKEN_TESTS=1 make check

The fundamental issue with "set -e" is that it has some unexpected
(but documented) semantics.  For example:

  set -e
  foo() { false; rm -rf /; }

  # Effectively harmless
  foo

  # Erase the filesystem
  foo || true

If nothing else, this behavior appears to have been masking test
failures.  Better to just avoid "set -e" altogether.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd /t/tmp/ to .gitignore.
Phil Hord [Fri, 1 Nov 2013 21:25:01 +0000 (17:25 -0400)]
Add /t/tmp/ to .gitignore.

Signed-off-by: Phil Hord <hordp@cisco.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoREADME.md: fix typo; cited article is about 'git'.
Phil Hord [Fri, 1 Nov 2013 21:25:00 +0000 (17:25 -0400)]
README.md: fix typo; cited article is about 'git'.

Signed-off-by: Phil Hord <hordp@cisco.com>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agometa-cmd.py: actually respond to recursion options.
Rob Browning [Thu, 31 Oct 2013 16:57:01 +0000 (11:57 -0500)]
meta-cmd.py: actually respond to recursion options.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoRemove misleading -1 from BUP_WINDOWSIZE definition.
Aidan Hobson Sayers [Sun, 20 Oct 2013 19:32:15 +0000 (20:32 +0100)]
Remove misleading -1 from BUP_WINDOWSIZE definition.

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
10 years agoCorrect DESIGN to refer to 64 byte rolling window.
Aidan Hobson Sayers [Sun, 20 Oct 2013 19:32:14 +0000 (20:32 +0100)]
Correct DESIGN to refer to 64 byte rolling window.

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
10 years agoHACKING: correct output folder in the format-patch example
Aidan Hobson Sayers [Thu, 24 Oct 2013 19:57:31 +0000 (20:57 +0100)]
HACKING: correct output folder in the format-patch example

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix top-level non-dir metadata restoration with /foo/latest/target/ syntax.
Rob Browning [Tue, 22 Oct 2013 17:06:56 +0000 (12:06 -0500)]
Fix top-level non-dir metadata restoration with /foo/latest/target/ syntax.

Previously something like "bup restore -C dest /foo/latest/bar/" would
fail to restore metadata for top-level, non-directory paths inside
bar.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoIgnore atime when testing bup cat-file --meta.
Rob Browning [Wed, 23 Oct 2013 20:43:38 +0000 (15:43 -0500)]
Ignore atime when testing bup cat-file --meta.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoDon't create ACL objects until they're needed.
Rob Browning [Mon, 21 Oct 2013 20:57:40 +0000 (15:57 -0500)]
Don't create ACL objects until they're needed.

Previously bup would store the POSIX1e ACL information in metadata
objects as pylibacl objects.  That meant bup would have to be able to
create those objects immediately when loading the metadata record.

Aside from being unnecessary, that was causing top-level crashes in
cases where the ACL object creation failed.  That's because bup would
throw an exception (deferred via add_error()) without skipping the ACL
metadata record content.  After that, all metadata reads would be out
of sync, resulting in erroneous reads, and an eventual EOFError.

To fix the problem, don't convert the encoded ACL data to pylibacl
objects until necessary (i.e. unless trying to apply the ACLs to the
filesystem via bup restore).  With that change bup should no longer
get out of sync when reading the metadata, and in cases where it would
be impossible to create the pylibacl objects (i.e. the local machine's
user/groups won't allow it), bup won't just drop the metadata.  For
example,

  bup meta --edit --set-user rlb < metadata.old > metadata.new

will no longer silently drop ACL information in metadata.old on error.

Thanks to Anton Eliasson <devel@antoneliasson.se> for reporting the
problem and helping track it down.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agometadata_file(): don't load metadata objects for all the files in a dir.
Rob Browning [Fri, 18 Oct 2013 23:30:01 +0000 (18:30 -0500)]
metadata_file(): don't load metadata objects for all the files in a dir.

When only asked for the .bupm via metdata_file(), don't also parse the
.bupm and create all the metadata objects for the dir.  Aside from
being potentially wasteful, that may also make it impossible to
retrieve a broken .bupm via "cat-file --bupm" (for analysis).

Thanks to Anton Eliasson <devel@antoneliasson.se> for helping find the
problem and test the fix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd "bup cat-file [--meta|--bupm] /branch/revision/[path]".
Rob Browning [Tue, 15 Oct 2013 02:29:45 +0000 (21:29 -0500)]
Add "bup cat-file [--meta|--bupm] /branch/revision/[path]".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix id-other-than usage message.
Rob Browning [Tue, 22 Oct 2013 15:56:19 +0000 (10:56 -0500)]
Fix id-other-than usage message.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoOnly forward signals when appropriate; on SIGTSTP suspend parent too.
Rob Browning [Fri, 18 Oct 2013 18:46:05 +0000 (13:46 -0500)]
Only forward signals when appropriate; on SIGTSTP suspend parent too.

Finish the main.py work, started in
aa6f2c87e6f1292f1fa22f618532b65a5565d604, which began forwarding
SIGTSTP and SIGCONT to the child process so that it would
suspend/resume with the parent.

Only forward signals to the child when appropriate -- guarded by p and
forward_signals.  After forwarding SIGTSTP (as SIGSTOP) to the child,
reset the SIGTSTP handler to its default behavior and re-send SIGTSTP
to the parent so that it will actually suspend too.

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoUpdate version extraction for _version.py to work with the new tag syntax.
Patrick Rouleau [Mon, 30 Sep 2013 04:10:50 +0000 (00:10 -0400)]
Update version extraction for _version.py to work with the new tag syntax.

The version tag used to be in the form "bup-<version>".

The syntax is now just "<version>" to allow github to produce
reasonable archives (i.e. not bup-bup-VERSION).

Signed-off-by: Patrick Rouleau <prouleau72@gmail.com>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agobloom-cmd.py: close open file object for tfname before attempting a rename.
Rob Browning [Sun, 6 Oct 2013 19:33:35 +0000 (14:33 -0500)]
bloom-cmd.py: close open file object for tfname before attempting a rename.

Ben Kelly reported a an IOException (permission denied) during "bup
bloom" on Cygwin.  The exception was caused by the attempt to
os.rename(tfname, outfilename) in do_bloom().

This appears to be because Cygwin doesn't allow you to rename a file
while it's still open.  At first, we thought this might be because
bloom.py create() opens tfname, passes the resulting file to ShaBloom,
and then no one ever explicitly closes it.  So if the gc hasn't
collected the ShaBloom object before the rename, we're in trouble.

However, the problem may also have been caused by an unrelated process
scanning the file at the same time.

In any case, for the moment, explicitly close the ShaBloom object
before the rename.  That shouldn't hurt, and may help.

Thanks to Ben Kelly <btk@google.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFall back from mknod() to socket()/bind() on EPERM for SOCK_STREAM.
Rob Browning [Tue, 8 Oct 2013 16:18:00 +0000 (11:18 -0500)]
Fall back from mknod() to socket()/bind() on EPERM for SOCK_STREAM.

Apparently OS X is throwing EPERM for mknod(... SOCK_STREAM), and the
current OS X manpage does state that mknod() requires superuser
privileges.

Thanks to Zoran Zaric <zz@zoranzaric.de> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoHandle EOPNOTSUPP as an indicator that Linux attrs are not supported.
Rob Browning [Sat, 5 Oct 2013 18:01:37 +0000 (13:01 -0500)]
Handle EOPNOTSUPP as an indicator that Linux attrs are not supported.

Add EOPNOTSUPP to the set of errno values in _add_linux_attr() that
indicate Linux attrs are not supported by the target filesystem.  The
problem was observed on ZFS-on-Linux, 0.6.2.

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoBe more careful when testing that repeated saves can produce the same tree.
Rob Browning [Sat, 5 Oct 2013 01:58:07 +0000 (20:58 -0500)]
Be more careful when testing that repeated saves can produce the same tree.

Previously, test.sh would run multiple saves with no intervening
modifications, and check to see that the top-level "save -t" hash
didn't change, but with the addition of metadata this may fail on some
platforms where the test process itself (the save runs, etc.) affects
atime values.  That's because save is pulling the metadata for
unindexed parent directories directly from the filesystem.  And note
that atime is only special here because the test itself may
incidentally alter it -- we would see the same problem if any of the
other metdata for one of the unindexed parent directories changed
during the test run (i.e. mtime, uid, gid, ...).

To fix this, move the relevant test code from test.sh to
test-redundant-saves.sh, and use a newly added subdir-hash tool so
that we can compare the hashes of the roots of the indexed subtrees
instead of the top-level "save -t" hashes, ignoring the unindexed
parents entirely.

Thanks to Robert Edmonds <edmonds@debian.org> for running rc3 through
the Debian buildds which lead to the kFreeBSD test failure that
demonstrated the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMove _helper.c's Python.h back up (now to the top), because Python. 0.25-rc3
Rob Browning [Mon, 23 Sep 2013 00:18:24 +0000 (19:18 -0500)]
Move _helper.c's Python.h back up (now to the top), because Python.

Move the Python.h include in _helper.c to the top because Python says
so:

  http://docs.python.org/2/c-api/intro.html#include-files

Though according to this, it's been fixed upstream:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=206805

Which might explain why I didn't see the problem here.

Thanks to Chandan Kumar <chandank.kumar@gmail.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMove non-system includes after system includes in _helpers.c.
Rob Browning [Fri, 20 Sep 2013 18:33:02 +0000 (13:33 -0500)]
Move non-system includes after system includes in _helpers.c.

Having Python.h before assert.h was apparently causing trouble on
OpenBSD:

  _helpers.c: In function 'bup_xutime_ns':
  _helpers.c:842: warning: implicit declaration of function 'utimensat'
  _helpers.c:842: error: 'AT_FDCWD' undeclared (first use in this function)
  _helpers.c:842: error: (Each undeclared identifier is reported only once
  _helpers.c:842: error: for each function it appears in.)
  _helpers.c:843: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
  error: command 'cc' failed with exit status 1

...and moving the non-sytem includes lower is reasonable anyway.

Thanks to Ryan Hinton <iobass@email.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoconfigure: since the *BSDs have GNU make as gmake, look for that too.
Rob Browning [Fri, 20 Sep 2013 17:14:09 +0000 (12:14 -0500)]
configure: since the *BSDs have GNU make as gmake, look for that too.

Thanks to Ryan Hinton <iobass@email.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoIgnore unimplemented metadata record during read (_rec_tag_nfsv4_acl).
Rob Browning [Wed, 18 Sep 2013 17:20:28 +0000 (12:20 -0500)]
Ignore unimplemented metadata record during read (_rec_tag_nfsv4_acl).

Don't test for _rec_tag_nfsv4_acl and then try to call an
unimplemented method in Metadata.read().  Otherwise, if/when we do add
support, older versions of bup will choke on it.

Thanks to Alexander Barton <alex@barton.de> for pointing this out.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoQuash stat(2) st_rdev unless we're going to need it for mknod().
Rob Browning [Tue, 17 Sep 2013 01:47:28 +0000 (20:47 -0500)]
Quash stat(2) st_rdev unless we're going to need it for mknod().

On some platforms (i.e. kFreeBSD), the st_rdev value isn't completely
stable.  For example, given "date > foo; cp -a foo foo-2", the st_rdev
value may differ between the two files.

Since we only need the st_rdev value for the call to mknod() when
restoring character and block special files, set it to zero for
anything else.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agowrite_idx: make filename char* non-const (fixes python 2.6.6 compatibility).
Rob Browning [Tue, 17 Sep 2013 22:17:55 +0000 (17:17 -0500)]
write_idx: make filename char* non-const (fixes python 2.6.6 compatibility).

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMention --git-ids in bup split -h output sample commands.
Rob Browning [Tue, 17 Sep 2013 21:33:49 +0000 (16:33 -0500)]
Mention --git-ids in bup split -h output sample commands.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoUpdate bup split -h output (optspec) to distinguish between split "modes".
Gabriel Filion [Sun, 8 Sep 2013 03:26:16 +0000 (23:26 -0400)]
Update bup split -h output (optspec) to distinguish between split "modes".

Split it into three lines to clearly show that some modes don't fare
well with others.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoUpdate bup-split(1); document -d, clarify the split "modes", and reorganize.
Gabriel Filion [Sun, 8 Sep 2013 03:26:15 +0000 (23:26 -0400)]
Update bup-split(1); document -d, clarify the split "modes", and reorganize.

Update the synopsis, document the "-d DATE" option, and make a clearer
distinction between normal options and the options that select the
split "mode".

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
[rlb@defaultvalue.org: add dashes to seconds-since-epoch; adjust the
 MODES text a bit and move -b down; make a few other edits and adjust
 commit message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix ./configure handling of OS_* for GNU/kFreeBSD.
Rob Browning [Tue, 17 Sep 2013 02:11:09 +0000 (21:11 -0500)]
Fix ./configure handling of OS_* for GNU/kFreeBSD.

Thanks to Robert Edmonds <edmonds@debian.org> for the initial report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix path ownership restoration problems on Cygwin.
Rob Browning [Sat, 14 Sep 2013 18:47:23 +0000 (13:47 -0500)]
Fix path ownership restoration problems on Cygwin.

It turns out that Cygwin won't allow you to chown() a path to an
unknown uid or gid, even when "root".

For now, make that a deferred error on Cygwin, rework the tests to
avoid it when possible, and disable the tests (on Cygwin) that require
it.

For the record, it appears that tar doesn't normally hit this problem
on Cygwin because it uses "geteuid() == 0" to detect super-user
status, which won't be true in the normal case, even if the user is an
administrator.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoTreat ENOSYS like EOPNOTSUPP in _add_posix1e_acl().
Rob Browning [Mon, 16 Sep 2013 21:47:53 +0000 (16:47 -0500)]
Treat ENOSYS like EOPNOTSUPP in _add_posix1e_acl().

Thanks to Robert Edmonds <edmonds@debian.org> for reporting the
relevant failure on a Debian kFreeBSD buildd.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoFix minor typo in Metadata.read() in metadata.py.
Rob Browning [Mon, 16 Sep 2013 18:07:15 +0000 (13:07 -0500)]
Fix minor typo in Metadata.read() in metadata.py.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAlways fall back to socket()/bind() when os.mknod(...S_IFSOCK) fails.
Rob Browning [Mon, 16 Sep 2013 17:56:27 +0000 (12:56 -0500)]
Always fall back to socket()/bind() when os.mknod(...S_IFSOCK) fails.

Previously bup would use socket()/bind() instead of os.mknod(... |
stat.S_IFSOCK) on Cygwin, but this issue isn't Cygwin specific.
Remove the platform conditionalization, and fall back to
socket()/bind() any time mknod() fails with EINVAL.

Thanks to Robert Edmonds <edmonds@debian.org> for reporting the
relevant failure on a Debian kFreeBSD buildd.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoDon't try to load POSIX1e ACLs when the library isn't installed.
Rob Browning [Mon, 16 Sep 2013 17:55:12 +0000 (12:55 -0500)]
Don't try to load POSIX1e ACLs when the library isn't installed.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agobup-init.md: update after dropping automatic ~/.bup init.
Zoran Zaric [Tue, 13 Aug 2013 06:01:39 +0000 (08:01 +0200)]
bup-init.md: update after dropping automatic ~/.bup init.

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message; remove escape from
 BUP\_DIR after list discussion; remove additional "bup init" from
 README.md example.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoStop interleaving stream and mmap IO operations when writing the index.
Rob Browning [Fri, 23 Aug 2013 03:57:03 +0000 (22:57 -0500)]
Stop interleaving stream and mmap IO operations when writing the index.

Previously bup would write the index via a simultaneous combination of
stream operations and mmap writes to non-overlapping, but adjacent
regions of the same file.  This was causing index corruption in some
cases.

Instead, make an extra pass over the data in memory to precompute the
size of the final index section, which contains any 31+-bit offsets.
Then mmap and write the entire set of tables directly, avoiding the
need for simultaneous stream operations.

Reported-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Greg Troxel <gdt@lexort.com>
Reviewed-by: Greg Troxel <gdt@lexort.com>
10 years agoMention tmp/review/ branches in HACKING.
Zoran Zaric [Wed, 28 Aug 2013 14:56:48 +0000 (16:56 +0200)]
Mention tmp/review/ branches in HACKING.

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: make minor wording changes.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoPreserve filesystem timestamps during "make install".
Christopher Meng [Sun, 25 Aug 2013 14:32:27 +0000 (10:32 -0400)]
Preserve filesystem timestamps during "make install".

A good idea regardless, and recommended by the Fedora and Debian
packaging guidelines.

From debian-policy:

  The rationale is that there is some information conveyed by knowing
  the age of the file, for example, you could recognize that some
  documentation is very old by looking at the modification time, so it
  would be nice if the modification time of the upstream source would
  be preserved.

It should also help prevent unnecessary backup churn after upgrades.

Signed-off-by: Christopher Meng <cickumqt@gmail.com>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd -l and --human-readable options to "bup ls".
Kumar Appaiah [Sun, 25 Aug 2013 19:02:18 +0000 (15:02 -0400)]
Add -l and --human-readable options to "bup ls".

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

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

Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message; adjust newlines; squash
 two of Kumar's patches into this one.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoAdd --human-readable option to "bup web".
Kumar Appaiah [Sun, 25 Aug 2013 19:02:16 +0000 (15:02 -0400)]
Add --human-readable option to "bup web".

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

Signed-Off-By: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjust commit message; squash two of Kumar's
 patches into this one.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agosave-cmd.py: don't write an irrelevant and incomplete .bupm fragment.
Rob Browning [Sun, 25 Aug 2013 22:33:42 +0000 (17:33 -0500)]
save-cmd.py: don't write an irrelevant and incomplete .bupm fragment.

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

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

Reported-by: Zoran Zaric <zz@zoranzaric.de>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agomain.py: forward SIGTSTP/SIGCONT so "C-z" will actually suspend everything.
Rob Browning [Fri, 23 Aug 2013 17:23:17 +0000 (12:23 -0500)]
main.py: forward SIGTSTP/SIGCONT so "C-z" will actually suspend everything.

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

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

Thanks to Kalle for the report.

Reported-by: krichter722@aol.de
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agosplit-cmd.py: change -N to --noop (which actually exists) in error messages.
Gabriel Filion [Fri, 2 Aug 2013 20:31:03 +0000 (16:31 -0400)]
split-cmd.py: change -N to --noop (which actually exists) in error messages.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: adjusted commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoREADME.md: add a "bup init" step to "Using bup" since we killed auto-init.
Rob Browning [Sat, 17 Aug 2013 19:59:45 +0000 (14:59 -0500)]
README.md: add a "bup init" step to "Using bup" since we killed auto-init.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agogit.py: don't automatically initialize ~/.bup if it doesn't exist.
Zoran Zaric [Mon, 12 Aug 2013 14:20:12 +0000 (16:20 +0200)]
git.py: don't automatically initialize ~/.bup if it doesn't exist.

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

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

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

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: edit commit message; fix test ("set +e" during
 init run).]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agofuse-cmd.py: match the style of the import failure message in web-cmd.py.
Rob Browning [Sat, 17 Aug 2013 19:14:42 +0000 (14:14 -0500)]
fuse-cmd.py: match the style of the import failure message in web-cmd.py.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoweb-cmd.py: accommodate HTTPServer s/_socket/_sockets/ in newer versions.
Rob Browning [Sat, 17 Aug 2013 19:07:10 +0000 (14:07 -0500)]
web-cmd.py: accommodate HTTPServer s/_socket/_sockets/ in newer versions.

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

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoweb-cmd.py: add a tornado import guard like the one for fuse in fuse-cmd.py.
Robert S. Edmonds [Sat, 10 Aug 2013 20:01:57 +0000 (16:01 -0400)]
web-cmd.py: add a tornado import guard like the one for fuse in fuse-cmd.py.

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

Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
[rlb@defaultvalue.org: edited commit and error message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agotest-meta.sh: use the more portable "touch -t" instead of "touch -d".
Rob Browning [Fri, 16 Aug 2013 01:23:20 +0000 (20:23 -0500)]
test-meta.sh: use the more portable "touch -t" instead of "touch -d".

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

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoDESIGN: fix typo.
Rob Browning [Sun, 11 Aug 2013 20:05:41 +0000 (15:05 -0500)]
DESIGN: fix typo.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years ago_helpers.c: be careful about memory alignment in bloom operations.
Julien Cristau [Thu, 8 Aug 2013 22:30:26 +0000 (18:30 -0400)]
_helpers.c: be careful about memory alignment in bloom operations.

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

Signed-off-by: Julien Cristau <jcristau@debian.org>
[rlb@defaultvalue.org: adjust commit message.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoDocumentation/bup-tag.md: fix spelling error "retreive"
Robert S. Edmonds [Fri, 9 Aug 2013 01:12:48 +0000 (21:12 -0400)]
Documentation/bup-tag.md: fix spelling error "retreive"

Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
Reviewed-by Zoran Zaric <zz@zoranzaric.de>

10 years agoSkip test_handling_of_incorrect_existing_linux_xattrs() when under fakeroot.
Robert S. Edmonds [Fri, 9 Aug 2013 00:31:38 +0000 (20:31 -0400)]
Skip test_handling_of_incorrect_existing_linux_xattrs() when under fakeroot.

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

Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
[rlb@defaultvalue.org: adjust commit message]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agot/compare-trees: check rsync capability support correctly.
Rob Browning [Sun, 4 Aug 2013 18:39:55 +0000 (13:39 -0500)]
t/compare-trees: check rsync capability support correctly.

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

Handle ACL and xattr support independently.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
10 years agoconfig/configure: ignore utimensat on GNU/kFreeBSD.
Gonéri Le Bouder [Thu, 8 Aug 2013 22:30:28 +0000 (18:30 -0400)]
config/configure: ignore utimensat on GNU/kFreeBSD.

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

See also:

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

Signed-off-by: Gonéri Le Bouder <goneri@rulezlan.org>
[rlb@defaultvalue.org: adjust indentation, comments, and message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years ago_apply_linux_attr_rec: treat ENOSYS like EOPNOTSUPP (seen via sshfs). bup-0.25-rc2
Rob Browning [Wed, 31 Jul 2013 16:34:29 +0000 (11:34 -0500)]
_apply_linux_attr_rec: treat ENOSYS like EOPNOTSUPP (seen via sshfs).

After reports that set_linux_file_attr() produces ENOSYS on sshfs,
raise raise ApplyError for ENOSYS too.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years ago_create_via_common_rec: treat rmdir() EEXIST like ENOTEMPTY.
Rob Browning [Wed, 31 Jul 2013 16:32:17 +0000 (11:32 -0500)]
_create_via_common_rec: treat rmdir() EEXIST like ENOTEMPTY.

See rmdir(2):

       ENOTEMPTY
              pathname contains entries other than .  and ..  ; or,
              pathname has ..  as its final component.  POSIX.1-2001
              also allows EEXIST for this condition.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoCurrently bup only indexes physical parent paths; adjust tests.
Zoran Zaric [Mon, 29 Jul 2013 17:23:10 +0000 (19:23 +0200)]
Currently bup only indexes physical parent paths; adjust tests.

Fix tests that fail on systems where components of the parent path are
symlinks (like /tmp on OS X).  i.e. if you run:

  bup index /x/y/z

bup might actually store

  /a/z...

if y is a symlink to a.  See index-cmd.py and index.reduce_paths().

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
[rlb@defaultvalue.org: handle test.sh fix differently; add realpath();
 adjust commit message.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoMakefile: add any environmental CFLAGS to the end of the effective CFLAGS.
Rob Browning [Fri, 5 Jul 2013 17:06:16 +0000 (12:06 -0500)]
Makefile: add any environmental CFLAGS to the end of the effective CFLAGS.

For now, just do the simplest thing.

Thanks to Greg Troxel <gdt@ir.bbn.com> for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoCompletely disable ACL support on OS X for now.
Rob Browning [Thu, 4 Jul 2013 20:32:07 +0000 (15:32 -0500)]
Completely disable ACL support on OS X for now.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoconfig/configure: add and use bup_find_prog; remove unused MF_PATH_INCLUDEs.
Rob Browning [Thu, 4 Jul 2013 19:12:22 +0000 (14:12 -0500)]
config/configure: add and use bup_find_prog; remove unused MF_PATH_INCLUDEs.

Pull all the common program search code into bup_find_prog() and use
it everywhere.  This also makes configure's output a bit more
consistent in style/content.

Make it obvious that at the moment bup doesn't pay any attention to a
PYTHON or GIT environment variable value. i.e. bup currently ignores a
setting like PYTHON=python2.7.

Bup also doesn't use MF_PATH_INCLUDE settings yet, so remove them.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agogit.py: flush idx_map before close so FILE* operations will see changes.
Rob Browning [Sat, 8 Jun 2013 15:25:33 +0000 (10:25 -0500)]
git.py: flush idx_map before close so FILE* operations will see changes.

Flush idx_map (msync()) before closing it, since it doesn't look like
POSIX guarantees that a matching FILE* (i.e. idx_f) will see the
parallel changes if we don't.

From the original report:

  After `bup save`, `git fsck` would show messages like
  "Packfile index for %s SHA1 mismatch"
  This indicated a bad trailing checksum on the pack index file.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reported-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Reviewed-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
Tested-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
10 years agoFix completely broken invocations of t/root-status.
Rob Browning [Fri, 7 Jun 2013 05:22:58 +0000 (00:22 -0500)]
Fix completely broken invocations of t/root-status.

No idea what I was thinking.

Thanks to Sascha Silbe <sascha-ml-reply-to-2013-2@silbe.org> for the
report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoSkip the large bloom filter test if mmap fails on 32-bit archtectures.
Rob Browning [Sat, 25 May 2013 20:25:11 +0000 (15:25 -0500)]
Skip the large bloom filter test if mmap fails on 32-bit archtectures.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agot/test.sh: skip two "tree SHA1 didn't change" tests on Cygwin for now.
Rob Browning [Mon, 27 May 2013 16:51:23 +0000 (11:51 -0500)]
t/test.sh: skip two "tree SHA1 didn't change" tests on Cygwin for now.

Apparently Cygwin has some unusual behaviors with respect to access
times, so disable these two tests for now.

Possibly related: http://cygwin.com/ml/cygwin/2007-06/msg00436.html

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoREADME.md: add Cygwin dependencies.
Rob Browning [Mon, 27 May 2013 16:35:07 +0000 (11:35 -0500)]
README.md: add Cygwin dependencies.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agot/compare-trees: don't check ACLs on Cygwin (no support).
Rob Browning [Mon, 27 May 2013 16:15:40 +0000 (11:15 -0500)]
t/compare-trees: don't check ACLs on Cygwin (no support).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoRemove lib.sh actually-root in favor of t/root-status.
Rob Browning [Sun, 26 May 2013 17:16:40 +0000 (12:16 -0500)]
Remove lib.sh actually-root in favor of t/root-status.

Create a t/root-status command that outputs root, fake, or none and
that uses the same cross-platform logic as helpers.py is_superuser().
Use it everywhere.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agometadata.py: use socket() instead of mknod(...IF_SOCK) on Cygwin.
Rob Browning [Sun, 26 May 2013 16:05:56 +0000 (11:05 -0500)]
metadata.py: use socket() instead of mknod(...IF_SOCK) on Cygwin.

Apparently os.mknod(...IF_SOCK) fails on Cygwin, but our t/mksock tool
(which uses socket()) works just fine, so use that in
_create_via_common_rec() when on Cygwin.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoUse sys.platform instead of platform.system().
Rob Browning [Mon, 27 May 2013 15:27:51 +0000 (10:27 -0500)]
Use sys.platform instead of platform.system().

If nothing else, the former is computed at compile time, and so should
be more efficient.  Use the recommended "startswith()" idiom.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agometa-cmd.py: mention --list in the invocation summary.
Rob Browning [Mon, 27 May 2013 17:26:30 +0000 (12:26 -0500)]
meta-cmd.py: mention --list in the invocation summary.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoREADME.md: describe mmap problems with limited address spaces.
Rob Browning [Sat, 25 May 2013 21:24:58 +0000 (16:24 -0500)]
README.md: describe mmap problems with limited address spaces.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
10 years agoCatch errors when restoring Linux attrs into xfs or btrfs
Yung-Chin Oei [Mon, 15 Apr 2013 14:34:08 +0000 (15:34 +0100)]
Catch errors when restoring Linux attrs into xfs or btrfs

Both xfs and btrfs turn out to return EOPNOTSUPP, rather than ENOTTY,
when we try to apply Linux attrs that they do not support.  This patch
improves matters in that it ensures we can restore into these file
systems without crashing, but does not quite address all issues yet:

- if any of the attributes we try to apply is not supported, none of
  them will be applied to the file at all
- the user will typically drown in error output; eg. for a backup
  originating from an ext4 file system, we can expect endless error
  output relating to the extents-flag not being supported on xfs/btrfs

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
10 years agoDocumentation: replace ~/.bup with $BUP_DIR in bup-index.md and bup-save.md.
Gabriel Filion [Tue, 14 May 2013 06:53:05 +0000 (02:53 -0400)]
Documentation: replace ~/.bup with $BUP_DIR in bup-index.md and bup-save.md.

When one is not using the default bupdir placement, then those files
aren't found inside ~/.bup, but wherever "-d /path.." or $BUP_DIR are
pointing to.

Thanks to krichter722@aol.de for mentioning this.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agofsck-cmd.py: simplify do_pack() else clause.
Rob Browning [Sun, 5 May 2013 21:29:35 +0000 (16:29 -0500)]
fsck-cmd.py: simplify do_pack() else clause.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agofsck-cmd.py: add par2_exists as a do_pack() argument.
Rob Browning [Sun, 5 May 2013 21:26:27 +0000 (16:26 -0500)]
fsck-cmd.py: add par2_exists as a do_pack() argument.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoRework "bup fsck" output; allow less verbosity.
Rob Browning [Sat, 27 Apr 2013 15:48:45 +0000 (10:48 -0500)]
Rework "bup fsck" output; allow less verbosity.

Only print debug messages when verbose > 1 (i.e. -vv).

Use log() to print error messages to stderr instead of stdout.

When verbose level is at least 1, print a single descriptive line to
stdout.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agorm-between-index-and-save.sh: fix race condition.
Tim Riemenschneider [Mon, 15 Apr 2013 19:54:18 +0000 (21:54 +0200)]
rm-between-index-and-save.sh: fix race condition.

Fix a timing issue that often caused the test to fail -- the (removed)
file "foo" was marked as invalid in the index when it shouldn't have
been because it was modified less than tmax before the index run.

Insert a "bup tick" just before "bup index" so that foo won't be
marked invalid by the second run.

Don't expect the second "bup save" to fail since foo will now be valid
in the index (and hence ignored), even though it is no longer
available.  The removal will be noticed by the next index+save.

When removing directories, the outcome is different: since metadata is
saved per directory, "bup save" notices that the directory is missing
and logs an "errno 2" error, but does not crash, which is what the
tested patch is concerned with.  A third index+save run completes
without error.

This also means that without a "bup tick" before an index run, calls,
"bup save" might exit with non-zero exitcode when files/directories
are removed after bup index, but bup is not guaranteed to notice
missing files.

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agobup-save.md: note that restoration requires --name or the commit/tree id.
Rob Browning [Sat, 27 Apr 2013 16:35:35 +0000 (11:35 -0500)]
bup-save.md: note that restoration requires --name or the commit/tree id.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agotgit.py: set BUP_MAIN_EXE and BUP_DIR in testpacks().
Rob Browning [Sun, 14 Apr 2013 19:02:15 +0000 (14:02 -0500)]
tgit.py: set BUP_MAIN_EXE and BUP_DIR in testpacks().

Set these variables in testpacks(), just as we do for
test_pack_name_lookup(), since it also depends on path.exe().

This was causing 'make check' to fail on Cygwin, and could be
reproduced on Linux by explicitly invoking tgit.py via "./wvtest.py
lib/bup/t/tgit.py".

Reported-by: Will Rouesnel <w.rouesnel@gmail.com>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years ago.dir-locals: rename python-indent (obsolete) to python-indent-offset.
Rob Browning [Sat, 13 Apr 2013 22:43:33 +0000 (17:43 -0500)]
.dir-locals: rename python-indent (obsolete) to python-indent-offset.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd tests for file and dir removal between index and save.
Tim Riemenschneider [Wed, 6 Mar 2013 13:33:22 +0000 (14:33 +0100)]
Add tests for file and dir removal between index and save.

Make sure the removals don't cause bup save to immediately abort.

Signed-off-by: Tim Riemenschneider <git@tim-riemenschneider.de>
[rlb@defaultvalue.org: move tests to their own file.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agosave-cmd.py: don't crash when a path disappears between index and save.
Damien Robert [Tue, 20 Nov 2012 20:52:45 +0000 (21:52 +0100)]
save-cmd.py: don't crash when a path disappears between index and save.

Protect calls to metadata.from_path() with a try/catch and defer
errors via add_error() instead of just crashing.

Signed-off-by: Damien Robert <damien.olivier.robert@gmail.com>
[git@tim-riemenschneider.de: rebase to current tmp/pending/meta: since
 metadata is (now) stored in the index, only 1 of 2 hunks still
 applies (race condition between reading the file for its content and
 stat-ing it for metadata).]
[rlb@defaultvalue.org: edit commit message; squash file and dir
 removal fixes into this commit; limit the scope of the try/catch to
 the from_path() call, and put the remaining code in an else clause.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd support for "bup restore --exclude-rx <pattern> ...".
Rob Browning [Sat, 18 Aug 2012 20:35:23 +0000 (15:35 -0500)]
Add support for "bup restore --exclude-rx <pattern> ...".

When --exclude-rx <pattern> is provided to bup restore, don't restore
any path matching <pattern>, which must be a Python regular expression
(http://docs.python.org/library/re.html).  The pattern will be
compared against the full path, without anchoring, so "x/y" will match
"ox/yard" or "box/yards".  To exclude the contents of /tmp, but not
the directory itself, use "^/tmp/.".

You may check the behavior at runtime by setting BUP_DEBUG=2 in the
environment.

Thanks to Zoran Zaric <zz@zoranzaric.de> for reporting a bug in an
earlier version of this patch.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoAdd support for "bup index --exclude-rx <pattern> ...".
Rob Browning [Sat, 21 Jul 2012 20:09:47 +0000 (15:09 -0500)]
Add support for "bup index --exclude-rx <pattern> ...".

When --exclude-rx <pattern> is provided to bup index, exclude any path
matching <pattern>, which must be a Python regular expression
(http://docs.python.org/library/re.html).  The pattern will be
compared against the full path, without anchoring, so "x/y" will match
"ox/yard" or "box/yards".  To exclude the contents of /tmp, but not
the directory itself, use "^/tmp/.".

You may check the behavior at runtime by setting BUP_DEBUG=2 in the
environment.

Thanks to Zoran Zaric <zz@zoranzaric.de> for reporting a bug in an
earlier version of this patch.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agot/test.sh: work around NetBSD setting -A for 'ls' when root (again).
Zoran Zaric [Sat, 23 Mar 2013 20:36:17 +0000 (21:36 +0100)]
t/test.sh: work around NetBSD setting -A for 'ls' when root (again).

Apply the same workaround for the "compression9" tests that was
applied in commit 51bd5832b391f4c128cc42a3a5970733775f1ba7.

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoLICENSE: mention the lib/tornado license in lib/tornado/README.
Rob Browning [Sat, 23 Mar 2013 19:41:08 +0000 (14:41 -0500)]
LICENSE: mention the lib/tornado license in lib/tornado/README.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agowvtest.py: add a fallback definition of relpath() for Python < 2.6.
Thomas Haller [Sun, 3 Mar 2013 19:31:57 +0000 (20:31 +0100)]
wvtest.py: add a fallback definition of relpath() for Python < 2.6.

Since bup still supports Python 2.5 and relpath was added to Python in
2.6, add an os.path.relpath replacement, adapted from CPython source
(tag v2.6, file Lib/posixpath.py, hg-commit 95fff5a6a276).

Signed-off-by: Thomas Haller <thom311@gmail.com>
[rlb@defaultvalue.org: update LICENSE and add comment to code about
 updating LICENSE.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agorestore-cmd.py: make sure restore paths have at least two components.
Rob Browning [Sat, 16 Mar 2013 21:50:18 +0000 (16:50 -0500)]
restore-cmd.py: make sure restore paths have at least two components.

Reported-by: Tim Riemenschneider <t.riemenschneider@detco.de>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd tests for index --no-check-device, and support for t/mnt.
Rob Browning [Sun, 17 Feb 2013 03:20:50 +0000 (21:20 -0600)]
Add tests for index --no-check-device, and support for t/mnt.

Add support for t/mnt; anything mounted there will be cleaned up
during "make clean".

Thanks to Zak Wilcox <iwilcox@iwilcox.me.uk> for an earlier version of
these tests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd index --no-check-device to the index manpage.
Rob Browning [Sun, 17 Feb 2013 04:05:24 +0000 (22:05 -0600)]
Add index --no-check-device to the index manpage.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd a --no-check-device option to bup index (cf. tar).
Zak Wilcox [Fri, 1 Jun 2012 09:10:36 +0000 (10:10 +0100)]
Add a --no-check-device option to bup index (cf. tar).

Ignore stat.st_dev when comparing files against existing index entries, like
git does without #define USE_STDEV:

  http://www.kernel.org/pub/software/scm/git/docs/v1.7.10.1/technical/racy-git.txt

See also: "info tar".

Signed-off-by: Zak Wilcox <iwilcox@iwilcox.me.uk>
[rlb@defaultvalue.org: change original --ignore-dev to --no-check-device to match tar.
 Adjust code to work with current master.
 Remove tests -- will be reintroduced shortly.]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoIgnore artefacts from sampledata
Gabriel Filion [Sun, 17 Mar 2013 22:24:08 +0000 (18:24 -0400)]
Ignore artefacts from sampledata

9b5ae5f53e introduced the creation of some symlinks to avoid issues on
Cygwin. "make" now leaves the repository in a dirty state since we
forgot to exclude those symlinks.

The symlinks in question are products of the build/test process so we
need to avoid commiting them.

Signed-off-by: Gabriel Filion <gabster@lelutin.ca>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoconfigure-sampledata: test -h before -e when appropriate in --clean.
Rob Browning [Sun, 17 Mar 2013 18:03:03 +0000 (13:03 -0500)]
configure-sampledata: test -h before -e when appropriate in --clean.

Use "test -h" before "test -e" for items that might be dangling
symlinks since "test -e" returns false in that case.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoCreate symlinks in t/configure-sampledata; remove them from git.
Rob Browning [Sat, 9 Mar 2013 20:27:34 +0000 (14:27 -0600)]
Create symlinks in t/configure-sampledata; remove them from git.

Since git doesn't always handle symlinks the way bup expects (Cygwin),
don't keep them in git, create them via "t/configure-sampledata
--setup".

This also provides a place to handle anything else that falls outside
git's purview that we might want to add.

Integrate configure-sampledata into the makefile clean and all
targets.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd "set -eo pipefail" to "exclude" and "exclude-from" tests.
Rob Browning [Sun, 17 Mar 2013 17:23:32 +0000 (12:23 -0500)]
Add "set -eo pipefail" to "exclude" and "exclude-from" tests.

Don't allow non-tests to silently fail (i.e. mkdir, touch, echo, rm,
etc.).  Eventually all test code should have similar behavior.

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