]> arthur.barton.de Git - bup.git/log
bup.git
18 months agoUpdate base_version to 0.34~ for 0.34 development master
Rob Browning [Sun, 16 Oct 2022 22:03:05 +0000 (17:03 -0500)]
Update base_version to 0.34~ for 0.34 development

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
18 months agoUpdate base_version for 0.33 release
Rob Browning [Sun, 16 Oct 2022 17:18:23 +0000 (12:18 -0500)]
Update base_version for 0.33 release

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
18 months agoUpdate README, HACKING, and release notes for 0.33
Rob Browning [Sun, 16 Oct 2022 17:17:17 +0000 (12:17 -0500)]
Update README, HACKING, and release notes for 0.33

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
18 months agoFix typo in 0.32 release note header
Rob Browning [Sun, 16 Oct 2022 17:16:37 +0000 (12:16 -0500)]
Fix typo in 0.32 release note header

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
19 months agoSign off on a72b33964b0ff7b0fb6114c48fbda413871e0658
Rob Browning [Sun, 26 Apr 2015 17:05:12 +0000 (12:05 -0500)]
Sign off on a72b33964b0ff7b0fb6114c48fbda413871e0658

This commit represents my "Signed-off-by:" and "Tested-by:" for commit

  a72b33964b0ff7b0fb6114c48fbda413871e0658

which I forgot to include earlier.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
19 months agoRequire python 3.7+
Rob Browning [Sat, 25 Jun 2022 07:37:06 +0000 (02:37 -0500)]
Require python 3.7+

We've specified this requirement for a while; enforce it before the
release.

19 months agopylint: replace multiple errno comparisons with "in"
Rob Browning [Sun, 11 Sep 2022 20:03:33 +0000 (15:03 -0500)]
pylint: replace multiple errno comparisons with "in"

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
20 months agolib/cmd/bup.c: Accomodate historical realpath
Greg Troxel [Tue, 12 Jul 2022 19:08:46 +0000 (19:08 +0000)]
lib/cmd/bup.c: Accomodate historical realpath

realpath(3) originally required a non-NULL 2nd argument.  POSIX
extended it to allow NULL, but some old BSD versions still have the
as-first-introduced-in-4.4BSD implementation that does not accept the
2nd argument being NULL.

Define bup_realpath, which collapses to just system realpath for most
systems, and on systems known to have historic realpath, use a buffer,
and strdup the results, to match the POSIX-with-NULL semantics.

This should fix NetBSD and OpenBSD, and realpath isn't used on
FreeBSD.  This does not attempt to address Solaris.

Signed-off-by: Greg Troxel <gdt@lexort.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message]
[rlb@defaultvalue.org: change #define to BUP_HAVE_POSIX_REALPATH]
[rlb@defaultvalue.org: add OpenBSD version guard clause]
[rlb@defaultvalue.org: nest NetBSD checks so Prereq doesn't crash elsewhere]
[rlb@defaultvalue.org: reformat bup_realpath a bit]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
20 months agostat_result: specify __slots__
Rob Browning [Sun, 14 Aug 2022 18:29:59 +0000 (13:29 -0500)]
stat_result: specify __slots__

We're likely to have a lot of these, so might as well save the memory.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
20 months agoMetadata: specify __slots__
Rob Browning [Sun, 14 Aug 2022 18:29:59 +0000 (13:29 -0500)]
Metadata: specify __slots__

We're likely to have a lot of these, so might as well save the memory.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
20 months agoindex: restore print format of octal mode and gitmode
Rob Browning [Sun, 14 Aug 2022 18:29:09 +0000 (13:29 -0500)]
index: restore print format of octal mode and gitmode

Since python 3 changed oct() to add a 0o prefix.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
20 months agoPackWriter_remote: init remote_closed in __new__, not __init__
Rob Browning [Tue, 28 Jun 2022 21:34:57 +0000 (16:34 -0500)]
PackWriter_remote: init remote_closed in __new__, not __init__

So that it's always set during __del__.  Otherwise it might not exist
if (for example) __new__ or the superclass methods throw an exception
before we get to __init__.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
20 months agoio.mmap: init _bup_closed in __new__, not __init__
Rob Browning [Fri, 24 Jun 2022 21:14:43 +0000 (16:14 -0500)]
io.mmap: init _bup_closed in __new__, not __init__

So that it's always set during __del__.  Otherwise it might not exist
if (for example) __new__ or the superclass methods throw an exception
before we get to __init__.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoconfigure.inc: fix LDFLAGS validation
Rob Browning [Sat, 9 Jul 2022 18:15:53 +0000 (13:15 -0500)]
configure.inc: fix LDFLAGS validation

Change the CFLAGS validation to create ngc$$ instead of ngc$$.o since
it doesn't specify -c.

Change the LDFLAGS validation to create the .o file it needs.
Previously it relied on the CFLAGS test, which was optional, to do
that, and the CFLAGS test was actually creating an executable, not an
object file.

Thanks to Greg Troxel for reporting the omission.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoCapture ./configure CPPFLAGS for future, automatic runs
Rob Browning [Sat, 9 Jul 2022 17:49:23 +0000 (12:49 -0500)]
Capture ./configure CPPFLAGS for future, automatic runs

The value should now be captured in config/config.cmd alongside the
others.

Thanks to Greg Troxel for reporting the omission.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agotest-sparse-files: increase the test size for macos/afs
Rob Browning [Sun, 10 Jul 2022 22:44:43 +0000 (17:44 -0500)]
test-sparse-files: increase the test size for macos/afs

When the cirrus tests moved to monterey test-sparse-files started
failing in "sparse file restore --sparse (sparse middle)" because the
restore_size was 28 and so greater than the expected 20.

Guessing that this might just be due to higher fixed-costs, I doubled
the sparse region data_size, and that did allow the tests to pass.
While the diagnosis might or might not be correct, the change
shouldn't materially affect the tests' effectiveness.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agocirrus: update freebsd python, debian to bullseye, macos to monterey
Rob Browning [Sat, 9 Jul 2022 22:17:59 +0000 (17:17 -0500)]
cirrus: update freebsd python, debian to bullseye, macos to monterey

Move freebsd python to 3.9, and update the debian and macos images.
Don't install rsnapshot on debian since it's not in bullseye, and the
one test doesn't actually rely on it.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agocirrus: use apt-get, not apt to install bup
Rob Browning [Sun, 10 Jul 2022 18:25:06 +0000 (13:25 -0500)]
cirrus: use apt-get, not apt to install bup

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoGNUMakefile: Adjust cp invocation to what POSIX requires
Greg Troxel [Sat, 9 Jul 2022 23:52:29 +0000 (23:52 +0000)]
GNUMakefile: Adjust cp invocation to what POSIX requires

"cp -a" is nonportable, as POSIX does not specify -a:
  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
Use -R -p instead.

Signed-off-by: Greg Troxel <gdt@lexort.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agocmd/lib/bup.c: Don't use sysctl kern.proc.pathname on NetBSD
Greg Troxel [Wed, 6 Jul 2022 13:20:47 +0000 (09:20 -0400)]
cmd/lib/bup.c: Don't use sysctl kern.proc.pathname on NetBSD

This doesn't work, and I have no idea why the code asks for it.
Removing NetBSD from this ifdef branch makes executing bup within the
build tree work again.

Signed-off-by: Greg Troxel <gdt@lexort.com>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoAdd test-comparative-split-join to test against another bup
Rob Browning [Sun, 1 May 2022 19:17:27 +0000 (14:17 -0500)]
Add test-comparative-split-join to test against another bup

Add a test that will test the split/join behavior (including a
detailed repository/packfile comparison) with randomized data against
another version of bup, provided BUP_TEST_OTHER_BUP is set to the path
of a bup executable.

Among other things, this should provide a top-level backstop with
respect to changes in the hashsplitter.

Use this to test against the default debian and homebrew bup packages
in cirrus.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoAdd BUP_TEST_RANDOM_SEED
Rob Browning [Sun, 1 May 2022 19:06:53 +0000 (14:06 -0500)]
Add BUP_TEST_RANDOM_SEED

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agocompare-trees: add --times --no-times
Rob Browning [Sun, 1 May 2022 19:07:35 +0000 (14:07 -0500)]
compare-trees: add --times --no-times

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agocompare-trees: drop getopt to allow long opts and fix exits
Rob Browning [Sun, 1 May 2022 18:33:18 +0000 (13:33 -0500)]
compare-trees: drop getopt to allow long opts and fix exits

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agoEnsure "bup" invocations fail for all make targets
Rob Browning [Sun, 1 May 2022 17:24:03 +0000 (12:24 -0500)]
Ensure "bup" invocations fail for all make targets

Add a test/shadow-bin/bup that fails, and always include shadow-bin in
the PATH to prevent accidentally invoking a local version.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoPackWriter: respect umask/sgid/etc. when creating pack/idx
Rob Browning [Fri, 24 Jun 2022 21:36:04 +0000 (16:36 -0500)]
PackWriter: respect umask/sgid/etc. when creating pack/idx

Use atomically_replaced_file to ensure that the new packfile and index
respect the current umask, any directory sgid bit, etc., and use an
ExitStack to try to make sure all the corner cases are covered.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agohlinkdb: respect umask/sgid/etc. when creating new db
Rob Browning [Fri, 24 Jun 2022 21:36:04 +0000 (16:36 -0500)]
hlinkdb: respect umask/sgid/etc. when creating new db

Use atomically_replaced_file to ensure that the new db respects the
current umask, any directory sgid bit, etc., and use an ExitStack to
try to make sure all the corner cases are covered.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoindex.Writer: respect umask/sgid/etc. when creating new index
Rob Browning [Fri, 24 Jun 2022 21:18:33 +0000 (16:18 -0500)]
index.Writer: respect umask/sgid/etc. when creating new index

Use atomically_replaced_file to ensure that the new index respects the
current umask, any directory sgid bit, etc., and use an ExitStack to
try to make sure all the corner cases are covered.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoftp: clean up error handling
Johannes Berg [Sun, 24 Jan 2021 20:35:34 +0000 (21:35 +0100)]
ftp: clean up error handling

We don't want to abort on errors since this is an interactive
tool; while at it, also clean up duplicate error reporting on
errors in 'ls' and weird bytes formatting on errors.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: let unexpected exceptions propgate]
[rlb@defaultvalue.org: use str for exception messages]
[rlb@defaultvalue.org: render paths via path_msg()]
[rlb@defaultvalue.org: add match_rx_grp and test for expected output]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agowvpytest: add fail_value argument to wvpass and wvpasseq
Rob Browning [Tue, 28 Jun 2022 21:37:00 +0000 (16:37 -0500)]
wvpytest: add fail_value argument to wvpass and wvpasseq

This is analagous to the second, optional assert argument, although
unlike that one, it is of course always evaluated.

It can allow more informative failures:

  wvpasseq(re.split(r'[0-9]+', s), exp,
           "re.split(r'[0-9]+', %r) != %r" % (s, exp))

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agofuse: detect fusepy module
Johannes Berg [Mon, 3 Jan 2022 18:41:59 +0000 (19:41 +0100)]
fuse: detect fusepy module

When importing 'fuse', we might get either the libfuse or
the fusepy module, the latter doesn't have __version__ so
we just print

  error: fuse module is too old for fuse.__version__

but that's misleading. Detect if we have fuse.FUSE and in
that case instead print

  error: fuse module appears to be fusepy, not python-fuse
         please install https://github.com/libfuse/python-fuse

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message and error messages]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoREADME: describe fuse module requirements
Rob Browning [Tue, 28 Jun 2022 17:25:07 +0000 (12:25 -0500)]
README: describe fuse module requirements

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agogit: return guessed value from guess_repo()
Johannes Berg [Tue, 17 Dec 2019 23:07:39 +0000 (00:07 +0100)]
git: return guessed value from guess_repo()

Return the value instead of storing it in a global, that makes
it easier to use elsewhere in the future.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: rm guess_repo argument]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agogit.PackWriter: assert on no precalculated sha
Johannes Berg [Fri, 22 Oct 2021 19:10:22 +0000 (21:10 +0200)]
git.PackWriter: assert on no precalculated sha

We really don't have any code path getting here without
a sha, so don't try to make up for it if it's missing,
just assert.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoatomically_replaced_file: respect umask/sgid/etc. via tmpdir
Rob Browning [Fri, 24 Jun 2022 16:41:36 +0000 (11:41 -0500)]
atomically_replaced_file: respect umask/sgid/etc. via tmpdir

Don't create the tempfile via mkstemp because it always creates files
with restricted permissions, which is not what we want for a new
packfile (for example).  The replacement files should respect the
environment umask, directory sgid bits, etc.

Instead, create a normally open()ed file in a mkdtemp directory in the
same directory as the target path.  Don't use TemporaryDirectory
because it's a @contextmanager (see below).

Add a missing '+' to the midx open mode.  Without it mmap_readwrite's mmap
will fail with EACCES.  This wasn't an issue with the previous
implementation because mkstemp doesn't accept a full mode string.

Also drop @contextmanager.  Because it involves a generator,
@contextmanager creates managers that are incompatible with
ExitStack.pop_all() because they close during that call -- exactly
what pop_all() is intended to avoid.

cf. https://github.com/python/cpython/issues/88458

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoDrop @contextmanager from finalized() and buptest
Rob Browning [Fri, 24 Jun 2022 16:17:48 +0000 (11:17 -0500)]
Drop @contextmanager from finalized() and buptest

Because it involves a generator, @contextmanager creates managers that
are incompatible with ExitStack.pop_all() because they close during
that call -- exactly what pop_all() is intended to avoid.

So begin dropping @contextmanager in preference to explicit context
management classes/methods.

cf. https://github.com/python/cpython/issues/88458

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agoRespect/prefer/remember user specified CPPFLAGS/CFLAGS/LDFLAGS
Rob Browning [Sun, 22 May 2022 17:20:10 +0000 (12:20 -0500)]
Respect/prefer/remember user specified CPPFLAGS/CFLAGS/LDFLAGS

While we remembered a configure-time CC, we didn't do the same for
other common user specified build variables, i.e. CPPFLAGS, CFLAGS,
and LDFLAGS.  Fix that, and arrange for the user's values to come
last so that they can override the configuration values.

This matches expectations established by other tools, in particular
autoconf/automake, and avoids having to remember to specify overrides
to every invocation of make.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
21 months agoGNUMakefile: don't manipulate user CFLAGS
Rob Browning [Sat, 21 May 2022 22:18:03 +0000 (17:18 -0500)]
GNUMakefile: don't manipulate user CFLAGS

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agopwdgrp.Group: allow gr_passwd to be None
Muh Muhten [Thu, 26 May 2022 05:07:47 +0000 (01:07 -0400)]
pwdgrp.Group: allow gr_passwd to be None

I haven't looked into this too closely, but it seems that Android's
getgr* fill gr_passwd with a null pointer, mapped to python None, which
is not a bytes.

Since this assert seems to be 100% py3 sanity-checking and bup doesn't
actually use the gr_passwd anywhere, it should be safe to pass the None.

Signed-off-by: Muh Muhten <muh.muhten@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message; add origin comment]

21 months agoCopy python-proposed instead of hardlink to python
Muh Muhten [Thu, 26 May 2022 05:08:09 +0000 (01:08 -0400)]
Copy python-proposed instead of hardlink to python

In the unlikely event that we're building on a filesystem that doesn't
support hard links, ln fails gratuitously, while copying probably still
works. The python wrapper is normally pretty small.

Signed-off-by: Muh Muhten <muh.muhten@gmail.com>
21 months agochmod -x lib/bup/cmd/*.py
Rob Browning [Sun, 15 May 2022 20:07:45 +0000 (15:07 -0500)]
chmod -x lib/bup/cmd/*.py

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
21 months agofix unfinished read on tag commits found in vfs cache
Muh Muhten [Fri, 24 Jun 2022 03:45:41 +0000 (23:45 -0400)]
fix unfinished read on tag commits found in vfs cache

tag_item was not reading through repo.cat iterator after grabbing the
item type, leaving an in-progress read when listing tags after a
cached access to the commit referred by the tag.  This manifests as an
AssertionError on `bup ls branch .tag` or similar vfs-consuming
command, or the bup fuse fs becoming almost completely unusable after
this access pattern as it errors EINVAL upon any attempt to read new
data from the repo!  Resolve this by checking the cache up-front
before we do any reading.

Signed-off-by: Muh Muhten <muh.muhten@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
23 months agoDisallow argc < 1 (for now just crash)
Rob Browning [Tue, 3 May 2022 00:54:54 +0000 (19:54 -0500)]
Disallow argc < 1 (for now just crash)

Since argc is allowed to be zero, and it's possible that any number of
things haven't been written to handle it, just crash for now if we
encounter it.

cf. https://lwn.net/Articles/882799/

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
23 months agobup.c: drop python 2
Rob Browning [Tue, 3 May 2022 00:54:04 +0000 (19:54 -0500)]
bup.c: drop python 2

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
23 months agoUpdate base_version to 0.33~ for 0.33 development
Rob Browning [Sun, 20 Sep 2020 18:14:29 +0000 (13:14 -0500)]
Update base_version to 0.33~ for 0.33 development

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
23 months agoReplace use of index() with strchr
Muh Muhten [Thu, 27 Jan 2022 23:06:35 +0000 (18:06 -0500)]
Replace use of index() with strchr

index() is a legacy string function formerly "equivalent to strchr", now
omitted from POSIX. This fixes builds on some newer libcs.

Signed-off-by: Muh Muhten <muh.muhten@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop vestigial compat.items
Rob Browning [Sun, 9 Jan 2022 18:12:09 +0000 (12:12 -0600)]
Drop vestigial compat.items

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop vestigial comapt.int_types
Rob Browning [Sun, 9 Jan 2022 18:03:53 +0000 (12:03 -0600)]
Drop vestigial comapt.int_types

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop vestigial compat.str_type
Rob Browning [Sun, 9 Jan 2022 18:02:08 +0000 (12:02 -0600)]
Drop vestigial compat.str_type

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop vestigial compat.range
Rob Browning [Sun, 9 Jan 2022 17:58:24 +0000 (11:58 -0600)]
Drop vestigial compat.range

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop vestigial compat.input
Rob Browning [Sun, 9 Jan 2022 18:31:27 +0000 (12:31 -0600)]
Drop vestigial compat.input

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop vestigial compat.ModuleNotFound
Rob Browning [Sun, 9 Jan 2022 18:29:26 +0000 (12:29 -0600)]
Drop vestigial compat.ModuleNotFound

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDrop support for python 2
Rob Browning [Sat, 8 Jan 2022 18:04:59 +0000 (12:04 -0600)]
Drop support for python 2

Don't make broad, disruptive changes for now, but disallow python 2 in
./configure, adjust the docs, and remove code where it's unlikely to
cause conflicts with other pending changes.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agopylint: enable super-init-not-called
Johannes Berg [Fri, 27 Aug 2021 22:56:24 +0000 (00:56 +0200)]
pylint: enable super-init-not-called

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agotag: use git.update_ref()
Johannes Berg [Thu, 30 Dec 2021 20:31:55 +0000 (21:31 +0100)]
tag: use git.update_ref()

Even tag refs can be packed by git, so writing to a file
might cause issues. Call git update-ref for tags as well.

In order to do that properly (and allow 'bup tag' to keep
its ability to modify tags), change git.update_ref() to
take a 'force' argument that allows updating a ref even
if it already exists with an old value we don't know.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoFix all __del__ complaints; fail tests on AssertionErrors
Rob Browning [Sun, 16 Jan 2022 19:53:09 +0000 (13:53 -0600)]
Fix all __del__ complaints; fail tests on AssertionErrors

2 years agoFail the tests if we detect any AssertionErrors
Johannes Berg [Wed, 24 Nov 2021 20:42:34 +0000 (21:42 +0100)]
Fail the tests if we detect any AssertionErrors

This exposed various problems in the recent contextmanagement work,
e.g. the assertions in the __del__ methods had been failing.  Of
course this means that from now on, asserts should only be used to
detect fatal problems.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message]
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoDetect failures to explicitly close mmaps in py3 too
Rob Browning [Sat, 1 Jan 2022 19:33:21 +0000 (13:33 -0600)]
Detect failures to explicitly close mmaps in py3 too

...since they're expensive, and the wrapper has detected issues a
number of times.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoClient: make close durable; clean up partitial initializations
Rob Browning [Sat, 1 Jan 2022 17:13:41 +0000 (11:13 -0600)]
Client: make close durable; clean up partitial initializations

Always call close after any __init__ errors, and make sure close
always tries to clean up everything that's been initialized so far.
This fixes a __del__ complaint exposed when using the mmap wrapper in
py3.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agofmincore: fix mmap leak
Rob Browning [Sat, 1 Jan 2022 18:57:34 +0000 (12:57 -0600)]
fmincore: fix mmap leak

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoAdd compat.mmap.close to set _bup_closed and always inititalize it
Rob Browning [Sat, 1 Jan 2022 18:57:34 +0000 (12:57 -0600)]
Add compat.mmap.close to set _bup_closed and always inititalize it

Add a compat.mmap.close method that properly maintains the _bup_closed
value, and make sure it always exists.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoClient.__init__: clean up at the end, even if check_ok() fails
Johannes Berg [Thu, 30 Dec 2021 20:31:55 +0000 (21:31 +0100)]
Client.__init__: clean up at the end, even if check_ok() fails

By the time we reach the check_ok() at the end, there are resources
that should be released if that call fails.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message]
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoPackWriter._end: always try to release objcache and parentfd
Johannes Berg [Sun, 5 Dec 2021 20:19:52 +0000 (21:19 +0100)]
PackWriter._end: always try to release objcache and parentfd

Move the self.file guard inside the contextmanager.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: split from larger commit; adjust commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoContext manage connections (via BaseConn)
Johannes Berg [Sun, 5 Dec 2021 20:19:52 +0000 (21:19 +0100)]
Context manage connections (via BaseConn)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: split from larger commit; adjust commit message]
[rlb@defaultvalue.org: add pending_raise to exit handler]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoPackWriter_Remote.close: call parent close
Johannes Berg [Sun, 5 Dec 2021 20:19:52 +0000 (21:19 +0100)]
PackWriter_Remote.close: call parent close

We weren't explicitly closing the PackWriter, and __del__ no longer
does either.  Make PackWriter a "new style" object so that the super()
call will also work with python 2.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: split from larger commit; adjust commit message]
[rlb@defaultvalue.org: convert PackWriter to "new style" object]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoNoOpContextManager: fix init/close/__del__ logic
Johannes Berg [Sun, 5 Dec 2021 20:19:52 +0000 (21:19 +0100)]
NoOpContextManager: fix init/close/__del__ logic

Initialize self.closed, etc.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: split from larger commit; adjust commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoMetaStoreReader: protect __del__ against init failures
Rob Browning [Sun, 19 Dec 2021 21:11:28 +0000 (15:11 -0600)]
MetaStoreReader: protect __del__ against init failures

The previous code could crash in __del__ if init's open() threw.

Thanks to Johannes Berg for reporting the issue.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agotree_item_with_meta, test_long_index: add missing context managers
Johannes Berg [Sun, 5 Dec 2021 20:19:52 +0000 (21:19 +0100)]
tree_item_with_meta, test_long_index: add missing context managers

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[rlb@defaultvalue.org: split from larger commit; adjust commit message]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoindex.Reader.filter: throw when parent's missing (don't assert)
Johannes Berg [Sun, 5 Dec 2021 20:19:56 +0000 (21:19 +0100)]
index.Reader.filter: throw when parent's missing (don't assert)

...since we're planning to make the tests fail on assertion failures.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjust commit message]
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agotest_index: don't create an extra writer
Johannes Berg [Sun, 5 Dec 2021 20:32:14 +0000 (21:32 +0100)]
test_index: don't create an extra writer

This was erroneously left over when changing to
context management, and my (new?) version of pytest
started warning on it.

Fixes: f26a6a9ec9d7 ("index.Writer.__del__: replace with context management")
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agogit: PackIdxList: close extra packs when refreshing
Johannes Berg [Thu, 25 Nov 2021 10:12:27 +0000 (12:12 +0200)]
git: PackIdxList: close extra packs when refreshing

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: defer list/sort until after closes]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agotest-fuse: improve/broaden applicability checks
Johannes Berg [Sun, 28 Nov 2021 19:49:13 +0000 (20:49 +0100)]
test-fuse: improve/broaden applicability checks

The 'fuse' group doesn't exist on (most?) modern distros
anymore, so checking for it and membership results in not
being able to run the tests.

Additionally, on some systems (e.g. Fedora) the wrong fuse
module is installed (there are at least two competing ones
in python with the name 'fuse'), so run 'bup fuse -h' at
the beginning of the test just to do the import checks.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: rebase onto WVSKIP addition]
[rlb@defaultvalue.org: adjust commit summary]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoTeach pytest to handle WVSKIP and use it where we can
Rob Browning [Sat, 4 Dec 2021 18:32:50 +0000 (12:32 -0600)]
Teach pytest to handle WVSKIP and use it where we can

Have pytest scan the wvtest output for skip messages, and for now,
treat the whole test as skipped if we find any.  This means that
for now WVSKIP can only be used as an up-front guard, but that's all
we need in most cases.

This should help make it more likely that we'll notice when tests are
unexpectedly skipped.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agowvtest.sh: add a simplistic WVSKIP
Rob Browning [Sat, 4 Dec 2021 18:31:02 +0000 (12:31 -0600)]
wvtest.sh: add a simplistic WVSKIP

Upstream wvtest actually defines the syntax, so add a trivial WVSKIP
that just prints "! ... skip ok".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
2 years agopylint: enable syntax-error
Johannes Berg [Sun, 28 Nov 2021 20:03:01 +0000 (21:03 +0100)]
pylint: enable syntax-error

This could be useful to catch issues early, and only the
py2raise module has errors now, so ignore it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agorandom: use helpers.istty1
Johannes Berg [Tue, 30 Nov 2021 20:23:05 +0000 (21:23 +0100)]
random: use helpers.istty1

The helpers.istty1 variable can be used in place of the
same conditions open-coded here.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agomain: treat BUP_FORCE_TTY as bitmap
Johannes Berg [Tue, 30 Nov 2021 20:20:53 +0000 (21:20 +0100)]
main: treat BUP_FORCE_TTY as bitmap

We treat BUP_FORCE_TTY from the environment as a bitmap
all the time, so do the same in main. This requires an
update to one of the tests using it, but otherwise it's
supposed to be internal API, i.e. not documented in the
man page or such.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agomain: fix output string truncation
Johannes Berg [Mon, 22 Nov 2021 20:34:29 +0000 (21:34 +0100)]
main: fix output string truncation

There's a bug here that causes output to be cut off if it's
if the line was too long, in that case 'width' chars would
be removed at the beginning, rather than actually showing
'width' chars. Fix that.

Reported-by: Nix <nix@esperi.org.uk>
Fixes: 00fb1f1b2a53 ("Clean subprocess output without newliner")
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
2 years agomain: always put BUP_FORCE_TTY into the environment
Johannes Berg [Tue, 30 Nov 2021 20:26:22 +0000 (21:26 +0100)]
main: always put BUP_FORCE_TTY into the environment

Nix reports that progress output from midx/bloom while save
is running is no longer printed.

The reason turns out to be somewhat complicated:
 * midx/bloom progress output is printed directly from the C
   code, if stderr is known to be a tty from isatty(2) or the
   environment variable BUP_FORCE_TTY
 * save is a built-in command now, and so are midx/bloom (but
   the latter is less relevant)
 * a process inherits the environment that the parent has,
   unless otherwise specified

So with the _old_ setup (with save not a module but process),
when save is started, main would set both BUP_FORCE_TTY (and
BUP_TTY_WIDTH) in the environment for the subprocess, causing
save to obtain it, and further midx/bloom to inherit it from
save. One of the downsides of this setup is that the size of
the window is now fixed, so resizing doesn't update.

With the _new_ setup, where save is a module, we don't set
BUP_FORCE_TTY or BUP_TTY_WIDTH in the environment since the
redirection and fixing etc. all happens in the main, and the
code is directly accessing stdout/stderr via the filtering.

The problem now is the following:
 1) We create the filter thread, so that stdout/stderr are
    no longer pointing to the real tty fd, so that isatty()
    returns false. This is fine for save, or when we start
    bloom/midx directly, as the _helpers.c istty2 has been
    evaluated already before we redirect the fds.
 2) As described, we don't set the environment variables
    when we run the save code, since it's a module.

However, as a result, when save starts midx/bloom as a new
subprocess, they inherit the redirected fds, so that they're
not writing to the tty themselves, but also don't get the
environment variable BUP_FORCE_TTY since they're started by
save and that was a module.

The solution then is fairly simple: set both BUP_FORCE_TTY
and BUP_TTY_WIDTH in the environment unconditionally. The
latter is necessary so that options._tty_width() works in
the module-based commands as well.

This didn't just affect save -> midx/bloom, but also the ssh
calls that pass BUP_FORCE_TTY/BUP_TTY_WIDTH to the remote
process, so potentially the server's debug output was also
affected. Nix reported that the client debug output was not
shown ("Receiving index from server: %d/%d\r"), but I don't
have an explanation for that related to this commit, as that
code is actually running in the process of the save, thus
should be shown depending on helpers.istty2, which was
always correct in the main process.

Also, I'll note that we now always put BUP_FORCE_TTY into
the environment, which we avoided previously for some calls.
However, prior to the change to have most things be modules,
we were also doing that, since everything we called (git and
other tools like par2) would be started by a subprocess, so
this doesn't really seem to pose any danger.

Reported-by: Nix <nix@esperi.org.uk>
Fixes: 5dd0172dddb9 ("bup: filter stdout/stderr via thread/pipe for internal subcommands")
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: remove now unused merge_dict from imports]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agotest-fuse: show errors by running fuse in the foreground
Rob Browning [Sat, 27 Nov 2021 19:44:27 +0000 (13:44 -0600)]
test-fuse: show errors by running fuse in the foreground

When not run in the foreground, errors (e.g. exceptions) don't show up
on stderr.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoGNUmakefile: clean py2 .pyc files
Rob Browning [Fri, 26 Nov 2021 18:07:05 +0000 (12:07 -0600)]
GNUmakefile: clean py2 .pyc files

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agogit: close PackIdxList on init failures
Johannes Berg [Thu, 25 Nov 2021 10:56:10 +0000 (12:56 +0200)]
git: close PackIdxList on init failures

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: use pending_raise]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoGNUmakefile: clean mounts earlier to avoid later crashes
Rob Browning [Sat, 27 Nov 2021 19:38:51 +0000 (13:38 -0600)]
GNUmakefile: clean mounts earlier to avoid later crashes

Otherwise lingering mounts with unexpected/broken content (e.g. fuse)
can cause find, etc. to crash.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoconfigure/cleanup: support python 3.10
Johannes Berg [Thu, 25 Nov 2021 18:37:59 +0000 (19:37 +0100)]
configure/cleanup: support python 3.10

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
2 years agodev/validate-python: require >= 3.7 for python 3 matching README
Rob Browning [Wed, 24 Nov 2021 18:37:27 +0000 (12:37 -0600)]
dev/validate-python: require >= 3.7 for python 3 matching README

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
2 years agobloom.do_bloom: always close filter; fix None vs 0 tests
Rob Browning [Mon, 22 Nov 2021 20:03:26 +0000 (14:03 -0600)]
bloom.do_bloom: always close filter; fix None vs 0 tests

Running a "split -n" for a larger file caused the assertion in
ShaBloom.__del__ to fail, i.e. the filter hadn't been explicitly
closed.  Fix the logic in do_bloom to be careful about 0 vs None since
ShaBloom has a __len__ method, and add one missing explicit close().

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoCheck that all context managed objects are properly closed
Rob Browning [Sun, 24 Oct 2021 17:24:16 +0000 (12:24 -0500)]
Check that all context managed objects are properly closed

Ensure all of our context managed objects have a __del__ that asserts
that the instance has been properly closed so that we'll be more
likely to notice related oversights.

This will only work in cases where __del__ is called before shutdown,
but that should normally be the case for cpython.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoFully (and explicitly) close PackIdxLists
Rob Browning [Sat, 23 Oct 2021 19:06:01 +0000 (14:06 -0500)]
Fully (and explicitly) close PackIdxLists

And stop checking _mpi_count in __del__ since there are no guarantees
about if/when it will run (and so could run after another has been
opened).

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoPackMidx.__del__: replace with context management
Rob Browning [Fri, 1 Oct 2021 02:02:59 +0000 (21:02 -0500)]
PackMidx.__del__: replace with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agocompat: add ExitStack
Rob Browning [Thu, 28 Oct 2021 17:11:05 +0000 (12:11 -0500)]
compat: add ExitStack

For now, just add enough py2 support (since it wasn't too hard) to
handle some forthcoming cases.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
2 years agoCatPipe.__del__: replace with context management
Rob Browning [Tue, 28 Sep 2021 05:32:37 +0000 (00:32 -0500)]
CatPipe.__del__: replace with context management

Drop AbortableIter since CatFile is the only user, in favor of just
closing the catpipe (what the AbortableIter was doing) in the get()
exception handler.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoindex.Writer.__del__: replace with context management
Rob Browning [Tue, 28 Sep 2021 01:28:53 +0000 (20:28 -0500)]
index.Writer.__del__: replace with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoReplace LocalRepo/RemoteRepo __del__ with context management
Rob Browning [Tue, 28 Sep 2021 00:58:06 +0000 (19:58 -0500)]
Replace LocalRepo/RemoteRepo __del__ with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agosave: detect missing metastore via ENOENT not EACCES
Rob Browning [Fri, 8 Oct 2021 17:39:16 +0000 (12:39 -0500)]
save: detect missing metastore via ENOENT not EACCES

While we might also eventually want to handle EACCES, ENOENT should be
what we want for the current handler, i.e. "does it exist at all".

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
2 years agoindex.Reader.__del__: replace with context management
Rob Browning [Sun, 26 Sep 2021 21:20:06 +0000 (16:20 -0500)]
index.Reader.__del__: replace with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoMetaStoreWriter.__del__: replace with context management
Rob Browning [Sun, 26 Sep 2021 20:55:12 +0000 (15:55 -0500)]
MetaStoreWriter.__del__: replace with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoMetaStoreReader.__del__: replace with context management
Rob Browning [Sun, 26 Sep 2021 20:43:34 +0000 (15:43 -0500)]
MetaStoreReader.__del__: replace with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoHLinkDB.__del__: replace with context management
Rob Browning [Sun, 26 Sep 2021 19:53:18 +0000 (14:53 -0500)]
HLinkDB.__del__: replace with context management

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agodrecurse: replace OsFile (and __del__) with finalized fd
Rob Browning [Sun, 26 Sep 2021 19:40:02 +0000 (14:40 -0500)]
drecurse: replace OsFile (and __del__) with finalized fd

Add composable helpers.finalize(x, finalizer) context management
adapter and use it to replace OsFile.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
2 years agoShaBloom.__del__: replace with context management
Rob Browning [Sun, 17 Oct 2021 17:17:36 +0000 (12:17 -0500)]
ShaBloom.__del__: replace with context management

These changes also just use finally in some cases, instead of the more
complex py2 compatible BaseException/with_pending_raise() catch becase
I'm leaning in favor of just dropping python 2 support soon.

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