]> arthur.barton.de Git - bup.git/log
bup.git
11 years agoDisallow empty graft points.
Rob Browning [Sun, 12 Aug 2012 23:18:26 +0000 (18:18 -0500)]
Disallow empty graft points.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoUpdate README regarding metadata support.
Rob Browning [Sat, 28 Jul 2012 16:42:23 +0000 (11:42 -0500)]
Update README regarding metadata support.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoHandle the possibility of a sgid/suid parent dir in one of the meta tests.
Rob Browning [Fri, 27 Jul 2012 17:04:35 +0000 (12:04 -0500)]
Handle the possibility of a sgid/suid parent dir in one of the meta tests.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoQuote EXIT cleanup trap properly in test-meta.sh.
Rob Browning [Wed, 18 Jul 2012 02:26:23 +0000 (21:26 -0500)]
Quote EXIT cleanup trap properly in test-meta.sh.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoUse python, not groups to grab a user group in t/test-meta.sh.
Rob Browning [Tue, 11 Sep 2012 01:53:45 +0000 (20:53 -0500)]
Use python, not groups to grab a user group in t/test-meta.sh.

Group names may actually contain spaces, and since the groups commmand
only reports a space-delimited list of groups on stdout, we had
a problem.

Thanks to "Oei, Yung-Chin" <yungchin@yungchin.nl> and Gabriel Filion
<lelutin@gmail.com> for tracking this down.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agot/test.sh: fix test failure when $top_dir has a dot-name
Oei, Yung-Chin [Mon, 3 Sep 2012 16:50:30 +0000 (17:50 +0100)]
t/test.sh: fix test failure when $top_dir has a dot-name

Fix the admittedly rare case where we're running tests from a tree
that has a dot-name at its base, which only 'bup ls -a' will print.
This problem was originally encountered on a system that keeps mounts
under '/.autofs/'.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoRestore any metadata during "bup restore"; add "bup meta --edit".
Rob Browning [Sun, 27 Nov 2011 20:39:47 +0000 (14:39 -0600)]
Restore any metadata during "bup restore"; add "bup meta --edit".

Use "bup meta --edit" to test "bup restore" and the new tar/rsync-like
restoration behaviors.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Tested-by: Alexander Barton <alex@barton.de>
11 years agoSave metadata during "bup save".
Rob Browning [Sat, 1 Oct 2011 17:24:36 +0000 (12:24 -0500)]
Save metadata during "bup save".

Record metadata in a hidden/mangled file named .bupm in each
directory, so that the metadata for /foo/ is stored in /foo/.bupm,
with the first entry being the metadata for foo/ itself.

Record an empty index file for each special file so that index entries
and .bupm entries correspond correctly.

Rework the strip/graft functions to return both the save-name, and the
underlying filesystem path to the save-name (when there is one) for
each component.  There may not be corresponding filesystem paths if
graft options rewrite the path prefix.

For now, record "/" metadata only when there are no strip/graft
options.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Tested-by: Alexander Barton <alex@barton.de>
11 years agoUnmount and remove testfs instances correctly during make clean.
Rob Browning [Sun, 3 Jun 2012 17:18:18 +0000 (12:18 -0500)]
Unmount and remove testfs instances correctly during make clean.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoSince 'latest' is computed by revs[0], it must exist, so don't test it.
Rob Browning [Fri, 23 Nov 2012 20:32:39 +0000 (14:32 -0600)]
Since 'latest' is computed by revs[0], it must exist, so don't test it.

Remove the unnecessary "if latest:" conditional from
BranchList._mksubs().  Given the fact that latest used to be computed
via max(revs), and is now computed by revs[0], there's no way it
wouldn't exist.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoUse branch tip, not newest date to choose 'latest' in BranchList._mksubs().
Rob Browning [Fri, 23 Nov 2012 20:18:52 +0000 (14:18 -0600)]
Use branch tip, not newest date to choose 'latest' in BranchList._mksubs().

Previously 'latest' was chosen in the VFS by taking max(revs), which
would pick the most recent commit by rev_list date, which only has a
resolution of integer seconds.

That approach could fail if two commits (i.e. two "bup save" runs)
executed close enough together that both commits ended up with the
same rev_list date.  In that case, the sort order was determined by
the commit hash, which is effectively random.

Since I couldn't think of a case where you wouldn't want 'latest' to
refer to the most recent commit (save) to the relevant branch,
'latest' is now computed as revs[0], i.e. the first commit returned by
rev_list.

Thanks to Zoran and Gabriel for some helpful sanity checks while
tracking this down.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd _open_noatime() and use it bup_get_linux_file_attr().
Rob Browning [Sat, 20 Oct 2012 17:55:27 +0000 (12:55 -0500)]
Add _open_noatime() and use it bup_get_linux_file_attr().

Reported-by: Yung-Chin Oei <yungchin@yungchin.nl>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Yung-Chin Oei <yungchin@yungchin.nl>
11 years agoDepend on the kernel headers, not the ext2 headers, for Linux attr support.
Rob Browning [Sat, 20 Oct 2012 17:35:39 +0000 (12:35 -0500)]
Depend on the kernel headers, not the ext2 headers, for Linux attr support.

Switch to the kernel FS_* defines (in linux/ext2_fs.h) instead of the
EXT* defines (in ext2fs/ext2_fs.h -- from the ext2fs headers).

Also add FS_NOCOW_FL to the "modifiable flags" mask whenever it's
available.

Reported-by: Yung-Chin Oei <yungchin@yungchin.nl>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Yung-Chin Oei <yungchin@yungchin.nl>
11 years agoAlways run metadata tests; disable root-level tests when not on Linux.
Rob Browning [Sun, 3 Jun 2012 20:18:01 +0000 (15:18 -0500)]
Always run metadata tests; disable root-level tests when not on Linux.

Disable the root-level test-meta.sh tests when the uname output
doesn't match Linux since they're not likely to work elsewhere right
now.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoConvert BUP_DIR to an absolute path so chdir() won't cause trouble.
Rob Browning [Sat, 18 Aug 2012 19:56:05 +0000 (14:56 -0500)]
Convert BUP_DIR to an absolute path so chdir() won't cause trouble.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoDefault to stdin/stdout in bup meta when -f is not specified.
Rob Browning [Mon, 26 Dec 2011 19:51:45 +0000 (13:51 -0600)]
Default to stdin/stdout in bup meta when -f is not specified.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoChange metadata "owner" to "user" everywhere to match stat(2), tar, etc.
Rob Browning [Sat, 24 Dec 2011 16:48:37 +0000 (10:48 -0600)]
Change metadata "owner" to "user" everywhere to match stat(2), tar, etc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoFix metadata._set_up_path() to allow restoration of top-level files.
Rob Browning [Sat, 31 Dec 2011 02:40:27 +0000 (20:40 -0600)]
Fix metadata._set_up_path() to allow restoration of top-level files.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoDon't attempt to remove the Linux attr extents flag (see chattr(1)).
Rob Browning [Sat, 10 Dec 2011 19:24:58 +0000 (13:24 -0600)]
Don't attempt to remove the Linux attr extents flag (see chattr(1)).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoMake "bup meta -tv" output look somewhat like "ls -l" output.
Rob Browning [Sun, 7 Aug 2011 17:04:49 +0000 (18:04 +0100)]
Make "bup meta -tv" output look somewhat like "ls -l" output.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoMake "bup meta -tvv" output identical to "bup xstat".
Rob Browning [Sun, 7 Aug 2011 17:01:08 +0000 (18:01 +0100)]
Make "bup meta -tvv" output identical to "bup xstat".

Move the bits of xstat-cmd.py that generate the detailed metadata
representation to metadata.py and xstat.py to support their use from
both "bup xstat" and "bup meta -tvv".

Add size to detailed metadata description when available.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoAdd symbolic mode information to xstat output, i.e. (drwxr-xr-x).
Rob Browning [Sun, 7 Aug 2011 16:26:28 +0000 (17:26 +0100)]
Add symbolic mode information to xstat output, i.e. (drwxr-xr-x).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoDon't try to restore read-only chattr(1) attributes.
Rob Browning [Sat, 11 Jun 2011 16:39:23 +0000 (11:39 -0500)]
Don't try to restore read-only chattr(1) attributes.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoFix typo in _create_via_common_rec() exception message.
Rob Browning [Wed, 29 Jun 2011 03:09:49 +0000 (22:09 -0500)]
Fix typo in _create_via_common_rec() exception message.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoRecord the file size as Metadata.size when possible.
Rob Browning [Wed, 29 Jun 2011 03:07:10 +0000 (22:07 -0500)]
Record the file size as Metadata.size when possible.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoFix types and add missing elements to Entry.__repr__() format string.
Rob Browning [Tue, 28 Jun 2011 23:52:29 +0000 (18:52 -0500)]
Fix types and add missing elements to Entry.__repr__() format string.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoOn ENOTTY or ENOSYS, assume filesystem doesn't support Linux attributes.
Rob Browning [Sun, 12 Jun 2011 16:33:57 +0000 (11:33 -0500)]
On ENOTTY or ENOSYS, assume filesystem doesn't support Linux attributes.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
11 years agoRectify bup-split documentation for the fanout option.
Gabriel Filion [Tue, 9 Oct 2012 03:52:35 +0000 (23:52 -0400)]
Rectify bup-split documentation for the fanout option.

The --fanout option is no longer the maximum number of objects in a
tree, but an average. The documentation, however was never updated and
this can lead to misunderstandings.

Also add a "bold" delimiter that was forgotten in the command summary in
its documentation page.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoDocumentation: Protect file extensions from start of line.
Gabriel Filion [Mon, 1 Oct 2012 07:13:53 +0000 (03:13 -0400)]
Documentation: Protect file extensions from start of line.

In the documentation files, we use file extensions as words to simplify
the text. When compiling man pages from the Markdown files, it is
possible that an extension lands at the beginning of a line.

In such a case, the extension is mistakenly identified as a Groff macro.
It seems as though Groff simply ignores it since it is not a known
macro, but emits a warning about the syntax.

This was caught thanks to the debian package's lintian output at:

http://lintian.debian.org/maintainer/jmtd@debian.org.html#bup

Since we're putting highlighting on file extensions, we should add it to
all cases, even though there's not risk of it landing at the beginning
of a line. This way, the documentation looks better standardized.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoMake import-rdiff-backup's output more verbose
Zoran Zaric [Mon, 24 Sep 2012 22:30:15 +0000 (00:30 +0200)]
Make import-rdiff-backup's output more verbose

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
11 years agoCatch ^C in import-rdiff-backup
Zoran Zaric [Mon, 24 Sep 2012 22:30:14 +0000 (00:30 +0200)]
Catch ^C in import-rdiff-backup

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
11 years agoAdd a testcase for the import-rdiff-backup command
Zoran Zaric [Mon, 24 Sep 2012 22:30:13 +0000 (00:30 +0200)]
Add a testcase for the import-rdiff-backup command

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
11 years agoAdd documentation for import-rdiff-backup
Zoran Zaric [Mon, 24 Sep 2012 22:30:12 +0000 (00:30 +0200)]
Add documentation for import-rdiff-backup

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
11 years agoImplement a import-rdiff-backup command
Zoran Zaric [Mon, 24 Sep 2012 22:30:11 +0000 (00:30 +0200)]
Implement a import-rdiff-backup command

Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
11 years agogit.py: avoid repeated string-copying in tree_decode()
Yung-Chin Oei [Wed, 26 Sep 2012 19:35:45 +0000 (20:35 +0100)]
git.py: avoid repeated string-copying in tree_decode()

git.tree_decode showed bad perfomance when dealing with large trees,
because it required string-copying quadratically in the number of tree
elements. By removing unnecessary copying, performance is improved at
all tree sizes, and significantly so for larger trees.

The problem became particularly apparent in combination with another bug
in bup (patch for which forthcoming), that allowed trees to grow without
bound when backing up sparse files.

Reported-by: trebor <robert.rebstock@tempelhof-projekt.de>
Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoEnable the reflog when initializing the repository.
Zoran Zaric [Thu, 27 Sep 2012 13:15:55 +0000 (15:15 +0200)]
Enable the reflog when initializing the repository.

Avery noticed that this wasn't being done for bare repositories, so
ask for it explicitly.

Reported-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoChange a few Makefile vars using ${} to use $() to match the rest.
Rob Browning [Wed, 26 Sep 2012 18:53:58 +0000 (13:53 -0500)]
Change a few Makefile vars using ${} to use $() to match the rest.

Also get rid of one annoying bright pink (in emacs) orphaned tab.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoFix GNU make detection and usage.
Thomas Klausner [Mon, 24 Sep 2012 12:45:33 +0000 (14:45 +0200)]
Fix GNU make detection and usage.

BSD make errors out since the Makefiles use GNU make specific code.
However, on BSD systems, 'make' is BSD make and not GNU make.

make(1) does set ${MAKE} to argv[0], so use this to pass the correct
make executable name down.

Also, prefer gmake to make, if it exists, since we want GNU make.

Signed-off-by: Thomas Klausner <tk@giga.or.at>
Tested-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoCalling bup-server with "-r host:" fails to activate dumb mode.
Oei, Yung-Chin [Tue, 18 Sep 2012 13:13:13 +0000 (14:13 +0100)]
Calling bup-server with "-r host:" fails to activate dumb mode.

When no remote directory is supplied to the -r option, no set-dir
command is sent to the server. This has the weird side effect that the
server actually does not check whether it needs to be in "smart" or
"dumb" mode.

By forcing all commands to make that verification, we'll ensure that the
server mode is correct.

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Gabriel Filion <lelutin@gmail.com>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoChange userfullname() default back to "user%d" for the moment.
Rob Browning [Mon, 24 Sep 2012 00:08:38 +0000 (19:08 -0500)]
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>
11 years agoFallbacks for missing GECOS data; this solves a test issue.
Michael Witten [Mon, 18 Jun 2012 06:06:36 +0000 (06:06 +0000)]
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>
11 years agot/test.sh: add "-a" to ls invocation when testing for .bup exclusion.
Yung-Chin Oei [Mon, 3 Sep 2012 17:10:09 +0000 (18:10 +0100)]
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>
11 years agoAdd BUP_DIR to the subprocess environment during set-dir on the server.
Gabriel Filion [Sat, 28 Jul 2012 03:02:10 +0000 (23:02 -0400)]
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>
11 years agoRemove useless code in main.py around the -d option
Gabriel Filion [Sat, 28 Jul 2012 04:54:12 +0000 (00:54 -0400)]
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>
11 years agoChange --strip-prefix to --strip-path in the bup save manpage.
Gabriel Filion [Sun, 22 Jul 2012 04:10:40 +0000 (23:10 -0500)]
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>
11 years agoMention DESIGN in the README.
Rob Browning [Sun, 22 Jul 2012 04:07:35 +0000 (23:07 -0500)]
Mention DESIGN in the README.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoResolve bup argv[0] symlinks.
Daniel Hahler [Sat, 12 May 2012 19:28:22 +0000 (14:28 -0500)]
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>
11 years agoFix and regularize "<>-" escaping in Documentation/*.md.
Rob Browning [Sun, 8 Apr 2012 17:42:45 +0000 (12:42 -0500)]
Fix and regularize "<>-" escaping in Documentation/*.md.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd a bup "tick" before indexing to avoid timestamp race.
Rob Browning [Sat, 24 Mar 2012 16:47:09 +0000 (11:47 -0500)]
Add a bup "tick" before indexing to avoid timestamp race.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agolib/bup/bloom.py: fix minor documentation typos.
Rob Browning [Sat, 18 Feb 2012 00:50:53 +0000 (18:50 -0600)]
lib/bup/bloom.py: fix minor documentation typos.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoDocumentation/bup-save.md: change --strip-prefix to --strip-path.
Jakob Matthes [Tue, 17 Jan 2012 20:10:12 +0000 (21:10 +0100)]
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>
11 years agoDocumentation/bup-save.md: document --date option.
Jakob Matthes [Sat, 4 Feb 2012 15:08:05 +0000 (16:08 +0100)]
Documentation/bup-save.md: document --date option.

Signed-off-by: Jakob Matthes <jakob.matthes@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
11 years agoExtend README for NetBSD.
Greg Troxel [Fri, 16 Dec 2011 14:53:47 +0000 (09:53 -0500)]
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>
11 years agocmd/drecurse: correctly pass excluded_paths to recursive_dirlist
Aneurin Price [Thu, 12 Jan 2012 16:15:23 +0000 (16:15 +0000)]
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>
11 years agoAdd "xstat" itself to the xstat optspec usage message.
Rob Browning [Sat, 14 Jan 2012 18:16:49 +0000 (12:16 -0600)]
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>
11 years agoSet python-mode python-indent to 4 in .dir-locals.el.
Rob Browning [Sat, 31 Dec 2011 00:53:38 +0000 (18:53 -0600)]
Set python-mode python-indent to 4 in .dir-locals.el.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoMention that option values will be converted to integers when possible.
Rob Browning [Wed, 28 Dec 2011 01:41:40 +0000 (19:41 -0600)]
Mention that option values will be converted to integers when possible.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
11 years agoAdd test for "child named after parent" bug.
Yung-Chin Oei [Tue, 13 Dec 2011 01:51:27 +0000 (19:51 -0600)]
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>
11 years agoAdjust Node.__cmp__() to compare full paths.
Gabriele Santilli [Thu, 15 Dec 2011 01:04:56 +0000 (19:04 -0600)]
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>
11 years agoImport new wvtest.py.
Avery Pennarun [Tue, 14 Aug 2012 07:16:09 +0000 (03:16 -0400)]
Import new wvtest.py.

From wvtest project commit c2197e2caeda8dd8c2dc3dbe5df1eaa7cd177aa1.

11 years agoshquote: add docstrings and a new quotify_list() function.
Avery Pennarun [Mon, 5 Sep 2011 03:06:02 +0000 (23:06 -0400)]
shquote: add docstrings and a new quotify_list() function.

And associated tests.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agooptions.py: get rid of end-of-line whitespace.
Avery Pennarun [Tue, 20 Mar 2012 00:48:29 +0000 (20:48 -0400)]
options.py: get rid of end-of-line whitespace.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agooptions.py: clean up handling of --no-* options.
Avery Pennarun [Mon, 19 Mar 2012 18:58:45 +0000 (14:58 -0400)]
options.py: clean up handling of --no-* options.

The particular bug that triggered this (in a project other than bup) was of
the form:

n,no-stupid       don't be stupid

Where it would actually end up setting stupid=1 by accident, and -n would
mean --stupid, not --no-stupid.  As part of fixing it, you can now also do
this:

n,no-stupid,smart   don't be stupid (ie. be smart)

and it'll work as it should: n == smart == no-stupid == not stupid.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agooptions.py: don't crash given semi-invalid optspecs.
Avery Pennarun [Mon, 19 Mar 2012 18:34:51 +0000 (14:34 -0400)]
options.py: don't crash given semi-invalid optspecs.

It's kind of weird to provide an argument without a description, but it's
not crash-worthy (especially when the crash was a totally unhelpful
exception stack trace).  While we're here, test for a couple of other ones
that didn't cause a crash, but we want to keep it that way.

And fix the copyright message; actually options.py started in 2010.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agocmd/ftp: don't do MacOS readline bindings on non-MacOS.
Avery Pennarun [Wed, 22 Feb 2012 19:33:22 +0000 (14:33 -0500)]
cmd/ftp: don't do MacOS readline bindings on non-MacOS.

I thought it was harmless, but apparently it makes the 'b' command not work
on Linux machines.  Oops.

Thanks to Gabriel Filion and gernot on IRC for reporting this.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agocmd/ftp: fix tab completion on MacOS.
Avery Pennarun [Thu, 19 Jan 2012 23:36:13 +0000 (15:36 -0800)]
cmd/ftp: fix tab completion on MacOS.

MacOS doesn't use the "real" readline, and the clone it uses is slightly
incompatible in its bindings.  Just bind both and it seems to work on both
MacOS and Linux.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agooptions.py: relicense to 2-clause BSD license.
Avery Pennarun [Fri, 4 Nov 2011 17:55:15 +0000 (13:55 -0400)]
options.py: relicense to 2-clause BSD license.

At the request of a few people who would like to us it in their own
projects.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agobupsplit.c: remove extra-large stack-allocated array from selftest().
Avery Pennarun [Mon, 31 Oct 2011 21:49:55 +0000 (17:49 -0400)]
bupsplit.c: remove extra-large stack-allocated array from selftest().

In some rare cases involving userspace threads (where you're running the
selftest function for some reason?) this could cause stack overflow or
excess memory usage.  Let's just do it with plain malloc().

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agoDisable t/test-meta.sh in 'make test' unless TEST_META=1 bup-0.25-rc1
Avery Pennarun [Thu, 9 Jun 2011 03:18:17 +0000 (23:18 -0400)]
Disable t/test-meta.sh in 'make test' unless TEST_META=1

In other words:

make test                # doesn't run metadata tests
TEST_META=1 make test    # does run metadata tests

The metadata tests still fail randomly on some people's computers, but we're
falling too far behind and it's time to make a release.  The metadata stuff
isn't used anywhere critical in bup yet, so it's okay to leave it in but not
test it for now.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agoMerge branch 'meta'
Avery Pennarun [Thu, 9 Jun 2011 03:15:48 +0000 (23:15 -0400)]
Merge branch 'meta'

* meta:
  Add utimes/lutimes implementations of _helpers utime() and lutime().
  Replace _helpers.utimensat() with utime() and lutime().
  Test for available nanosecond stat timestamp members.
  Add config.h dependency to _helpers in csetup.py.
  Add -*-shell-script-*- to configure.inc.
  Use FS_IOC_GETFLAGS/FS_IOC_SETFLAGS directly as the preprocessor guards.
  Verify the expected length of saved_errors in tmetadata.py.
  Don't use xstat.lutime() in test-meta.sh when xstat.utime() will do.
  Add meta support for restoring filesystem sockets.
  Add _recognized_file_types(); defer error for unrecognized restore.
  index.py: new format (V3), with inodes, link counts, and 64-bit times.
  Cap timestamps in index to avoid needing to worry about fractional parts.
  index.py: factor out an Entry._fixup_time method.
  Rely on options.parse() for more of the meta and xstat argument processing.
  Remove vestigal clean target comment regarding pybuptest.tmp permissions.
  Add initial timespec behavior tests.
  Return None from bup_set_linux_file_attr() and bup_utimensat().
  Replace os.*stat() with xstat.*stat(); use integer ns for all fs times.
  Drop xstat floating point timestamp support -- use integer ns.
  xstst-cmd.py: test for _have_utimensat rather than _have_ns_fs_timestamps.

12 years agoAdd utimes/lutimes implementations of _helpers utime() and lutime().
Rob Browning [Wed, 1 Jun 2011 00:58:46 +0000 (19:58 -0500)]
Add utimes/lutimes implementations of _helpers utime() and lutime().

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoReplace _helpers.utimensat() with utime() and lutime().
Rob Browning [Wed, 1 Jun 2011 00:49:33 +0000 (19:49 -0500)]
Replace _helpers.utimensat() with utime() and lutime().

Rework utimensat() handling in preparation for the addition of
utimes/lutimes based fallbacks.

Publish lutime() and utime() at the Python level from _helpers.c
rather than utimensat() itself.

Drop the _have_utimensat tests in favor of testing xstat.lutime which
will be false when xstat.lutime() is not available.

Move bup_utimensat() Python argument parsing to
bup_parse_xutime_args() and use it to implement bup_utime_ns() and
bup_lutime_ns().  This argument parsing will eventually be shared by
the utimes/lutimes based fallbacks.

Remove _helpers.AT_FDCWD and _helpers.AT_SYMLINK_NOFOLLOW since
utimensat is no longer published on the Python side.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoTest for available nanosecond stat timestamp members.
Rob Browning [Wed, 1 Jun 2011 00:49:32 +0000 (19:49 -0500)]
Test for available nanosecond stat timestamp members.

Use st_atim, st_mtim, and st_ctim when available, and fall back to
st_atimensec, st_mtimensec, and st_ctimensec.  If neither are
available, return 0 ns values.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoAdd config.h dependency to _helpers in csetup.py.
Rob Browning [Wed, 1 Jun 2011 00:49:31 +0000 (19:49 -0500)]
Add config.h dependency to _helpers in csetup.py.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoAdd -*-shell-script-*- to configure.inc.
Rob Browning [Wed, 1 Jun 2011 00:49:30 +0000 (19:49 -0500)]
Add -*-shell-script-*- to configure.inc.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoUse FS_IOC_GETFLAGS/FS_IOC_SETFLAGS directly as the preprocessor guards.
Rob Browning [Wed, 1 Jun 2011 00:49:29 +0000 (19:49 -0500)]
Use FS_IOC_GETFLAGS/FS_IOC_SETFLAGS directly as the preprocessor guards.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoVerify the expected length of saved_errors in tmetadata.py.
Rob Browning [Wed, 1 Jun 2011 00:49:28 +0000 (19:49 -0500)]
Verify the expected length of saved_errors in tmetadata.py.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoDon't use xstat.lutime() in test-meta.sh when xstat.utime() will do.
Rob Browning [Wed, 1 Jun 2011 00:49:27 +0000 (19:49 -0500)]
Don't use xstat.lutime() in test-meta.sh when xstat.utime() will do.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoAdd meta support for restoring filesystem sockets.
Rob Browning [Wed, 1 Jun 2011 00:49:26 +0000 (19:49 -0500)]
Add meta support for restoring filesystem sockets.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agoAdd _recognized_file_types(); defer error for unrecognized restore.
Rob Browning [Wed, 1 Jun 2011 00:49:25 +0000 (19:49 -0500)]
Add _recognized_file_types(); defer error for unrecognized restore.

Defer an error if an unrecognized file type is encountered during
metadata restoration -- whether during path creation
(i.e. --start-extract) or metadata application
(i.e. --finish-extract).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
12 years agomake clean: Remove dlls from child directories
Aneurin Price [Wed, 1 Jun 2011 16:23:33 +0000 (17:23 +0100)]
make clean: Remove dlls from child directories

Fix the 'clean' makefile rule to remove .dll files from subdirectories,
to match .so files.

Signed-off-by: Aneurin Price <aneurin.price@gmail.com>
12 years agoconfigure.inc: strip trailing characters from 'uname -s' output
Aneurin Price [Wed, 1 Jun 2011 16:20:36 +0000 (17:20 +0100)]
configure.inc: strip trailing characters from 'uname -s' output

On Cygwin, 'uname -s' includes the version of the underlying operating
system; here it is 'CYGWIN_NT-6.0'. The configure script attempts to
define this in config/config.h, but '#define OS_CYGWIN_NT-6.0 1' is an
invalid macro definition.

This truncates the value to just 'CYGWIN', to match $OS in the Makefile.

Signed-off-by: Aneurin Price <aneurin.price@gmail.com>
12 years agoUpdate bupsplit.[ch] to have a less restrictive BSD-style license.
Avery Pennarun [Tue, 7 Jun 2011 02:09:39 +0000 (22:09 -0400)]
Update bupsplit.[ch] to have a less restrictive BSD-style license.

Nobody else owns any copyright on those files, so I can do this without
asking anyone else for permission :)

Some people have asked to use these files in their own non-GPL/LGPL
projects, and although the LGPL permits this, the files are so small that
there's no reason to be obnoxious about it.  So let's just let them do it
the easy way.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agoMerge branch 'master' into meta
Avery Pennarun [Tue, 31 May 2011 04:31:50 +0000 (00:31 -0400)]
Merge branch 'master' into meta

* master:
  Improve formatting of error and warning messages.

12 years agoindex.py: new format (V3), with inodes, link counts, and 64-bit times.
Aaron M. Ucko [Mon, 30 May 2011 23:03:01 +0000 (19:03 -0400)]
index.py: new format (V3), with inodes, link counts, and 64-bit times.

To allow unambiguous preservation of hard-link structure, index device
numbers, inode numbers (new) and link counts (new) at 64 bits apiece
per GNU libc, which uses uint64_t, uint64_t, and unsigned long respectively.

Take the opportunity to use 64 bits for mtime and ctime as well, both
to be ready for Y2038 and to handle NTFS's zero value (Y1600).

12 years agoCap timestamps in index to avoid needing to worry about fractional parts.
Aaron M. Ucko [Mon, 30 May 2011 23:03:00 +0000 (19:03 -0400)]
Cap timestamps in index to avoid needing to worry about fractional parts.

Avoid a potential race condition by which bup's use of whole-second
granularity for timestamps in the index could let it theoretically
miss some last-second changes by capping timestamps to at most one
second before the start of indexing per a newly introduced mandatory
parameter to bup.index.Writer.

12 years agoindex.py: factor out an Entry._fixup_time method.
Aaron M. Ucko [Mon, 30 May 2011 23:02:59 +0000 (19:02 -0400)]
index.py: factor out an Entry._fixup_time method.

Factor Entry._fixup_time out of Entry._fixup to reduce (minor) logic
duplication and prepare for upcoming tweaks to timestamp indexing.

12 years agoImprove formatting of error and warning messages.
Aaron M. Ucko [Mon, 30 May 2011 23:02:35 +0000 (19:02 -0400)]
Improve formatting of error and warning messages.

log() trailing newlines as appropriate.  Fix a format string typo in
lib/bup/git.py encountered when verifying that exceptions' string
values already end with newlines.

12 years agoMerge branch 'master' into meta
Avery Pennarun [Mon, 30 May 2011 00:50:25 +0000 (20:50 -0400)]
Merge branch 'master' into meta

* master: (27 commits)
  t/test.sh: 'ls' on NetBSD sets -A by default as root; work around it.
  README: add a list of binary packages
  README: rework the title hierarchy
  Clarify the message when the BUP_DIR doesn't exist.
  Refactor: unify ls/ftp-ls code
  ftp/ls: Adjust documentation
  ls: include hidden files when explicitly requested
  ftp: implement ls -s (show hashes)
  ftp/ls: columnate output attached to a tty, else don't
  ftp: don't output trailing line for 'ls'
  ftp: output a newline on EOF when on a tty
  config: more config stuff to config/ subdir, call it from Makefile.
  cmd/{split,save}: support any compression level using the new -# feature.
  options.py: add support for '-#' style compression options.
  Add documentation for compression levels
  Add test case for compression level
  Add compression level options to bup save and bup split
  Make zlib compression level a parameter for Client
  Make zlib compression level a parameter of git.PackWriter
  Use is_superuser() rather than checking euid directly
  ...

Conflicts:
lib/bup/metadata.py

12 years agot/test.sh: 'ls' on NetBSD sets -A by default as root; work around it.
Avery Pennarun [Mon, 30 May 2011 00:31:43 +0000 (20:31 -0400)]
t/test.sh: 'ls' on NetBSD sets -A by default as root; work around it.

We have to undo it by grepping out any dotfiles.  (Normal OSes don't
auto-set -A, but this is harmless there.)

Reported by Thomas Klausner.  Fix suggested by Gabriel Filion.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agoMerge branch 'config'
Avery Pennarun [Mon, 30 May 2011 00:02:29 +0000 (20:02 -0400)]
Merge branch 'config'

* config:
  config: more config stuff to config/ subdir, call it from Makefile.
  Initial import of configure.sh

12 years agoREADME: add a list of binary packages
Gabriel Filion [Mon, 16 May 2011 05:13:28 +0000 (01:13 -0400)]
README: add a list of binary packages

Debian/Ubuntu are known to have bup packages in their archives, thanks
to Jon Dowland.

Also, a NetBSD package is currently being built, as was shared by Thomas
Klausner. However, it is still not found in the official NetBSD packages
search engine.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agoREADME: rework the title hierarchy
Gabriel Filion [Mon, 16 May 2011 05:13:27 +0000 (01:13 -0400)]
README: rework the title hierarchy

In Markdown, a line underlining another one with '=' characters
represents a first level title, while a line underlining another one
with '-' characters represents a second level title.

Rework the title levels to gain visibility on the different sections and
to allow to split "Getting started" more easily (see my next commit for
additions to this section).

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agoClarify the message when the BUP_DIR doesn't exist.
Avery Pennarun [Sun, 29 May 2011 23:34:30 +0000 (19:34 -0400)]
Clarify the message when the BUP_DIR doesn't exist.

Now it reminds you to run 'bup init'.  Problem reported by Thomas Klausner.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
12 years agoRefactor: unify ls/ftp-ls code
Gabriel Filion [Mon, 16 May 2011 04:27:24 +0000 (00:27 -0400)]
Refactor: unify ls/ftp-ls code

Both the 'ls' command and the 'ls' subcommand of the 'ftp' command use
some code that is very similar. Modifications must be done in two places
instead of one and this can lead to inconsistencies.

Refactor code so that both paths use the same function with the same opt
spec.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agoftp/ls: Adjust documentation
Gabriel Filion [Mon, 16 May 2011 04:27:23 +0000 (00:27 -0400)]
ftp/ls: Adjust documentation

Now that 'bup ftp ls' and 'bup ls' have the same features, adjust both
commands' man pages.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agols: include hidden files when explicitly requested
Gabriel Filion [Mon, 16 May 2011 04:27:22 +0000 (00:27 -0400)]
ls: include hidden files when explicitly requested

The current code of 'bup ls' insists on hiding a file from its listing
even if the file was explicitly requested as an argument. This is not
what users would expect. Remove the condition and always list files
(not directories) starting with a dot when they were given in the
argument list.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agoftp: implement ls -s (show hashes)
Gabriel Filion [Mon, 16 May 2011 04:27:21 +0000 (00:27 -0400)]
ftp: implement ls -s (show hashes)

'bup ls' has a -s flag that can be used to show file hashes on the left
of each file name. 'bup ftp ls' doesn't have that feature.

Implement the feature by copying code from 'bup ls'. This is the last
feature difference between 'bup ls' and 'bup ftp ls' and bringing them
to the same level will make it possible to unify the code that is used
by both.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agoftp/ls: columnate output attached to a tty, else don't
Gabriel Filion [Mon, 16 May 2011 04:27:20 +0000 (00:27 -0400)]
ftp/ls: columnate output attached to a tty, else don't

'bup ftp ls' and 'bup ls' currently behave in a different manner.

'bup ftp ls' always formats its output in columns regardless of whether
the program's stdout is a tty or not.

'bup ls' always prints one name on each line.

Make both of those commands behave the same. By using lib/bup/helpers'
istty1 variable, decide to format in columns when outputting to a tty,
and to output one file name per line when the output is not a tty.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
12 years agoftp: don't output trailing line for 'ls'
Gabriel Filion [Mon, 16 May 2011 04:27:19 +0000 (00:27 -0400)]
ftp: don't output trailing line for 'ls'

'ls' is currently the only 'ftp' subcommand that outputs a trailing
newline before the prompt is re-displayed. This is cause by the use of
"print" to output a string that already contains an ending newline.

For a matter of consistency of output, make 'ls' output without that
extra trailing newline.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>