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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
cmd/fuse: tweak the wording of the import guard error message
"python-fuse" is not quite correct, since this is confusingly what Debian calls
(in order to conform to Debian Python package naming policy) the upstream
package actually called "fuse-python". Other distros do refer to the package as
fuse-python.
Tweak the wording slightly in order to avoid this ambiguity, and also to make it
congruous to the wording of a similar import guard I used in cmd/web.
Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
cmd/web: add an import guard like the one in cmd/fuse
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>