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>
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>
Fix id-other-than usage message.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Add "bup cat-file [--meta|--bupm] /branch/revision/[path]".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
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>
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>
Ignore atime when testing bup cat-file --meta.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
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>
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>
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>
Remove misleading -1 from BUP_WINDOWSIZE definition.

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Reviewed-by: Gabriel Filion <gabster@lelutin.ca>
meta-cmd.py: actually respond to recursion options.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
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>
Add /t/tmp/ to .gitignore.

Signed-off-by: Phil Hord <hordp@cisco.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
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>
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>
Fix ACL tests, and the bugs revealed thereby.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
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>
Remove all of the remaining test-related "set -e" usage.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Don't use "set -e" in import-rdiff-backup.sh.

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