Adjust Node.__cmp__() to compare full paths.

The function now returns immediately if the two arguments are the same
Python object, otherwise it compares the full path name (rather than
just the file name).

Discussion: https://groups.google.com/group/bup-list/browse_thread/thread/1afc33b26394d69e/1a7a8155a1005600

Signed-off-by: Gabriele Santilli <gabriele@colellachiara.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Add test for "child named after parent" bug.

The added test shows that saving a node with the same name as the root
of the tree fails.

Changing Node.__cmp__() to compare by full paths should fix the
problem.

Signed-off-by: Yung-Chin Oei <oei.yungchin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Mention that option values will be converted to integers when possible.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Set python-mode python-indent to 4 in .dir-locals.el.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Add "xstat" itself to the xstat optspec usage message.

Thanks to Jean-Baptiste <jbd@jbdenis.net> for pointing it out.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/drecurse: correctly pass excluded_paths to recursive_dirlist

The excluded_paths argument was being passed as a positional argument,
but its position actually corresponded to the 'bup_dir' argument, so
'bup drecurse --exclude=/foo/bar /foo' has never worked.

Signed-off-by: Aneurin Price <aneurin.price@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Extend README for NetBSD.

Add NetBSD to the list of systems on which bup is known to work.  Give
hints for bup usage on NetBSD, including the location of the fuse
bindings and the pkgsrc entry.  Caution about incorrect cycle
detection on fuse mounts.  Add pkgsrc URLs.

Signed-off-by: Greg Troxel <gdt@lexort.com>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Documentation/bup-save.md: document --date option.

Signed-off-by: Jakob Matthes <jakob.matthes@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Documentation/bup-save.md: change --strip-prefix to --strip-path.

Signed-off-by: Jakob Matthes <jakob.matthes@gmail.com>
Reviewed-by: Zoran Zaric <lists@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/bloom.py: fix minor documentation typos.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Add a bup "tick" before indexing to avoid timestamp race.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Fix and regularize "<>-" escaping in Documentation/*.md.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Resolve bup argv[0] symlinks.

Resolve any symlinks in argv[0] so that the subsequent PYTHONPATH
adjustment will work properly.

Signed-off-by: Daniel Hahler <git@thequod.de>
Acked-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Mention DESIGN in the README.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Change --strip-prefix to --strip-path in the bup save manpage.

Thanks to Stefan Buller <stefan.buller@gmail.com> for pointing out the
problem.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Remove useless code in main.py around the -d option

While debugging another problem with BUP_DIR, I saw a part of the
code that looked kinda suspicious (not in itself, but in the context of
the file):

  115 subcmd_env = os.environ
  116 if dest_dir:
  117     subcmd_env.update({"BUP_DIR" : dest_dir})

the subcmd_env variable is never used in main.py. However, when I
removed that part, the -d option stopped working and bup used ~/.bup
instead: so it _is_ doing what we want it to.

The reason why it's working is that line 115 is actually not creating a
copy of the dict, but rather simply pointing to the same dict. so the
call to update() actually changes the environment for the main program,
which is actually quite alright (e.g. it supercedes the environment
variable and ensures that the path given to -d is inherited into
subprocesses)

Now the problem is that this code is very not obvious about what it
does. Plus, it's a couple of useless lines that we need to maintain.
Let's just remove any extraneous work and make the addition to the
environment triggered by the -d option as obvious and concise as
possible.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Add BUP_DIR to the subprocess environment during set-dir on the server.

In the normal flow of a remote backup, the client indicates to the
server end where it wants to save data (e.g. where the bup repository
is) by issuing a "set-dir path" command.

This command on the server end records the path in a global variable.
But it doesn't place it in the environment. This causes any subprocess
forked on the server end to be ignorant about the location of the
bup repository and causes errors such as this one:

Traceback (most recent call last):
  File "/usr/lib/bup/cmd/bup-midx", line 231, in <module>
    git.check_repo_or_die()
  File "/usr/lib/bup/bup/git.py", line 851, in check_repo_or_die
    init_repo()
  File "/usr/lib/bup/bup/git.py", line 828, in init_repo
    _git_wait('git init', p)
  File "/usr/lib/bup/bup/git.py", line 887, in _git_wait
    raise GitError('%s returned %d' % (cmd, rv))
bup.git.GitError: git init returned 1
['/usr/bin/bup', 'midx', '--auto', '--dir',
'/backup/test/objects/pack']: returned 1

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
t/test.sh: add "-a" to ls invocation when testing for .bup exclusion.

The bup-exclude test seems be to checking if .bup/ is properly
excluded from the backup, but 'bup ls' will only show this if given
the -a switch.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Fallbacks for missing GECOS data; this solves a test issue.

See the thread starting here:

  Subject: tests fail while trying to compile & install on arch linux
  Date: Sun, 20 May 2012 23:08:20 +0300
  From: Alper Kanat <tunix@raptiye.org>
  Message-ID: <CAPMuxnSmeHLcP=9M7uYPn6LQeCGNfZOF9DgCFQBHCzwR_DQ0Cg@mail.gmail.com>

When an entry for the current user has been successfully retrieved from the
Unix password database by the function:

  bup.helpers.usersfullname

then solely the GECOS field has been used to formulate an author's and
committer's full name for constructing a git commit object. Unfortunately,
this field may well be empty for a great many users; for such a user, the
result has been a full name that is the empty string.

This had not been a problem until the following commit was made in the course
of the development of `git' itself:

  commit 4b340cfab9c7a18e39bc531d6a6ffaffdf95f62d
  Author:     Junio C Hamano <gitster@pobox.com>
  AuthorDate: Sun Mar 11 01:25:43 2012 -0800
  Commit:     Junio C Hamano <gitster@pobox.com>
  CommitDate: Sun Mar 11 03:56:50 2012 -0700

      ident.c: add split_ident_line() to parse formatted ident line

      The commit formatting logic format_person_part() in pretty.c
      implements the logic to split an author/committer ident line into
      its parts, intermixed with logic to compute its output using these
      piece it computes.

      Separate the former out to a helper function split_ident_line() so
      that other codepath can use the same logic, and rewrite the function
      using the helper function.

      Signed-off-by: Junio C Hamano <gitster@pobox.com>

The new `split_ident_line()' function added by that commit is written
under the stricter assumption that the user's name is *not* the empty
string; clearly, this assumption is broken by what `bup' has been doing
when the user's GECOS field is empty.

Consequently, the easiest solution (as far as `bup' development is
concerned) is to make sure that the full name is never the empty
string. This is achieved by using fallbacks when the GECOS field
yields the empty string:

  0. The user's login name is tried.
  1. The string "user <uid>" is composed, where `<uid>' is the
     current process's user identifier.

Essentially, this seems to solve the problem, as it allows tests to
pass on my system. However, both:

  bup.helpers.username
  bup.helpers.usersfullname

still rely on Unix-specific functionality, which is not really acceptable.

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
Change userfullname() default back to "user%d" for the moment.

This was changed in the previous GECOS patch, but since username() has
the "user%d" fallback too, I think we should change both, or neither,
and should probably discuss it a bit more first.

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