Skip to content
Commits on Feb 20, 2011
  1. o.fatal(): print error after, not before, usage message.

    git prints the error *before* the usage message, but the more I play with
    it, the more I'm annoyed by that behaviour.  The usage message can be pretty
    long, and the error gots lost way above the usage message.  The most
    important thing *is* the error, so let's print it last.
    Signed-off-by: Avery Pennarun <>
Commits on Feb 13, 2011
  1. fix whitespace in the usage string.

    Signed-off-by: Avery Pennarun <>
  2. use execvp() instead of subprocess.Popen() when possible.

    This avoids an extra process showing up in the 'ps' listing if we're not
    going to be using bup-newliner anyhow.
    Signed-off-by: Avery Pennarun <>
Commits on Sep 8, 2010
  1. cmd/restore: embarrassingly slow implementation of 'bup restore'

    Well, that was easy, since already existed and is doing most of the
    hard work.  Only 103 lines including all the log message handling and
    Only one catch: the restoring code is definitely not optimized.  Among other
    things (like the probably-excessive-for-our-restoring-needs layering in, we're still calling into 'git cat-file --stdin' to retrieve our
    objects.  This involves lots and lots of context switches, plus it can't use
    midx files for its lookups.  The result is that restoring takes much more
    CPU time and memory than it really should.  But oh well, we have to start
    Signed-off-by: Avery Pennarun <>
  2. get the real tty width for word wrapping purposes.

    Previously we just assumed it was 70 chars, which was safe enough, but not
    as elegant as actually reading the real value and adjusting the word wrap of
    the usage string accordingly.
    Signed-off-by: Avery Pennarun <>
Commits on Sep 7, 2010
  1. Introduce BUP_DEBUG, --debug, and tone down the log messages a lot.

    There's a new global bup option, --debug (-D) that increments BUP_DEBUG.  If
    BUP_DEBUG >=1, debug1() prints; if >= 2, debug2() prints.
    We change a bunch of formerly-always-printing log() messages to debug1 or
    debug2, so now a typical bup session should be a lot less noisy.
    This affects midx in particular, which was *way* too noisy now that 'bup
    save' and 'bup server' were running it automatically every now and then.
    Signed-off-by: Avery Pennarun <>
  2., run 'bup midx -a' automatically sometimes.

    Now that 'bup midx -a' is smarter, we should run it automatically after
    creating a new index file.  This should remove the need for running it by
    Thus, we also remove 'bup midx' from the lists of commonly-used subcommands.
    (While we're here, let's take out 'split' and 'join' too; you should be
    using 'index' and 'save' most of the time.)
    Signed-off-by: Avery Pennarun <>
Commits on Sep 6, 2010
  1. Rename 'bup rbackup' to 'bup on'

    'rbackup' was a dumb name but I couldn't think of anything better at the
    time.  This works nicely in a grammatical sort of way:
       bup on myserver save -n myserver-backup /etc
    Now that we've settled on a name, also add some documentation for the
    Signed-off-by: Avery Pennarun <>
Commits on Apr 24, 2010
  1. cmd/version, etc: fix version number detection stuff.

    Gabriel Filion pointed out that bup's version number (which we added to the
    man pages automatically) was not detected when you used a bup tarball
    generated from 'git archive' (or more likely, you let GitHub call 'git
    archive' for you).  That makes sense, since our version detection was based
    on having a .git directory around, which the tarball doesn't.
    Instead, let's create a .gitattributes file and have it auto-substitute some
    version information during 'git archive'.  Of course, if we actually *do*
    have a .git directory, continue to use that.
    While we're here, add a new 'bup version' command and alias "bup --version"
    and "bup -V" to call it, since those options are pretty standard.
Commits on Apr 23, 2010
  1. cmd/ftp: 'ls' command should print filenames in columns.

    We use the columnate() function from for this, now moved into
Commits on Apr 1, 2010
  1. Add a 'make install' target.

    Also change to search around in appropriate places for the installed
    library files.  By default, if your bup is in /usr/bin/bup, it'll look in
    /usr/lib/bup.  (It drops two words off the end of the filename and adds
    /lib/bup to the end.)
    This also makes the Debian packager at
    actually produce a usable package.
Commits on Mar 21, 2010
  1. don't leak a file descriptor.

    subprocess.Popen() is a little weird about when it closes the file
    descriptors you give it.  In this case, we have to dup() it because if
    stderr=2 (the default) and stdout=2 (because fix_stderr), it'll close fd 2.
    But if we dup it first, it *won't* close the dup, because stdout!=stderr.
    So we have to dup it, but then we have to close it ourselves.
    This was apparently harmless (it just resulted in an extra fd#3 getting
    passed around to subprocesses as a clone of fd#2) but it was still wrong.
Commits on Mar 14, 2010
  1. main: even more fixes for signal handling.

    If the child doesn't die after the first SIGINT and the user presses ctrl-c
    one more time, the main bup process would die instead of forwarding it on to
    the child.  That's no good; we actually have to loop forwarding signals
    until the child is really good and dead.
    And if the child refuses to die, well, he's the one with the bug, not  So should stay alive too in the name of not losing track
    of things.
Commits on Mar 13, 2010
  1. Correctly pass along SIGINT to child processes.

    Ever since we introduced bup newliner, signal handling has been a little
    screwy.  The problem is that ctrl-c is passed to *all* processes in the
    process group, not just the parent, so everybody would start terminating at
    the same time, with very messy results.
    Two results were particularly annoying: git.PackWriter()'s destructor
    wouldn't always get called (so half-finished packs would be lost instead of
    kept so we don't need to backup the same stuff next time) and bup-newliner
    would exit, so the stdout/stderr of a process that *did* try to clean up
    would be lost, usually resulting in EPIPE, which killed the proces while
    attempting to clean up.
    The fix is simple: when starting a long-running subprocess, give it its own
    session by calling os.setsid().  That way ctrl-c is only sent to the
    toplevel 'bup' process, who can forward it as it should.
    Next, fix bup's signal forwarding to actually forward the same signal as it
    received, instead of always using SIGTERM.
Commits on Mar 4, 2010
  1. main: fix problem when redirecting to newliner on MacOS X.

    It's probably just a bug in python 2.4.2, which is the version on my old
    MacOS machine.  But it seems that if you use subprocess.Popen with stdout=1
    and/or stderr=2, it ends up closing the file descriptors instead of passing
    them along.  Since those are the defaults anyway, just use None instead.
Commits on Mar 3, 2010
  1. main: initialize 'p' before the try/finally that uses it.

    Otherwise, if we fail to run the subprocess, the finally section doesn't
    work quite right.
  2. 'make stupid' stopped working when I moved subcommands into their own…

    … dir.
    Remote server mode tries to add the directory of argv[0] (the
    currently-running program) to the PATH on the remote server, just in case
    bup isn't installed in the PATH there, so that it can then run 'bup server'.
    However, now that bup-save is in a different place than bup, argv[0] is the
    wrong place to look.  Instead, have the bup executable export an environment
    variable containing its location, and can use that instead of
    argv[0].  Slightly gross, but it works.
Commits on Mar 2, 2010
  1. Add man pages for random, newliner, help, memtest, ftp.

    Also add a 'help' command to ftp, and fix up some minor help messages.
  2. bup random: fix progress output and don't print to a tty.

    We were printing output using a series of dots, which interacted badly with
    bup newliner (and for good reason).  Change it to actually display the
    number of megabytes done so far.
    Also, don't print random binary data to a tty unless -f is given.  It's
    just more polite that way.
  3. clean up subprocesses dying on signal.

    CTRL-C didn't abort 'bup random' properly, and possibly others as well.
Commits on Mar 1, 2010
  1. main: list common commands before other ones.

    When you just type 'bup' or 'bup help', we print a list of available
    commands.  Now we improve this list by:
    1) Listing the common commands (with one-line descriptions) before listing
    the automatically-generated list.
    2) Printing the automatically-generated list in columns, so it takes up less
    vertical space.
    This whole concept was stolen from how git does it.  I think it should be a
    bit more user friendly for beginners this way.
Commits on Feb 28, 2010
  1. Add a 'bup help' command.

    It works like 'git help xxx', ie. it runs 'man bup-xxx' where xxx is the
    command name.
  2. Move cmd-*.py to cmd/*

    The bup-* programs shouldn't need to be installed into /usr/bin; we should
    search for them in /usr/lib somewhere.
    I could have left the names as cmd/cmd-*.py, but the cmd-* was annoying me
    because of tab completion.  Now I can type cmd/ran<tab> to get
  3. Move python library files to lib/bup/

    ...and update other programs so that they import them correctly from their
    new location.
    This is necessary so that the bup library files can eventually be installed
    somewhere other than wherever the 'bup' executable ends up.  Plus it's
    clearer and safer to say 'from bup import options' instead of just 'import
    options', in case someone else writes an 'options' module.
    I wish I could have named the directory just 'bup', but I can't; there's
    already a program with that name.
    Also, in the name of sanity, rename to 'bup memtest' so that it
    can get the new paths automatically.
Something went wrong with that request. Please try again.