Relying on the process group to figure out which processes to treat
as children and grandchildren of the test run was not correct, as
the testrunner didn't ensure it was creating a new process group.
When running inside 'make check' the process group was actually that
of make, not testrunner.sh.
Since setpgid is not universally available, we iterate the process
tree via ps, and kill the children recursively.
getgrnam is not thread-safe on Linux (but is on macOS). To ensure
we don't call it from two threads at the same time we move its use
inside a lambda that initializes a local static. This is fine, as
we don't expect the 'nogroup' gid to change.
We now reflect the user who mounted the sparsebundle as the owner of
the resulting .dmg file, and try to reflect the state of allow_other
and allow_root through the file permission bits.
These are just informative. The real access control happens in FUSE
based on the allow_other/allow_root options (unless user also passes
the default_permissions option, in which case the permission bits
will also be checked).
Fixes issue #15
The move from off_t to size_t in 90c81b1776 was misguided. Although
it semantically makes sense to use an unsigned datatype for file sizes,
the size_t data type is only 32-bit wide on 32-bit systems, so the move
broke reading of large sparsebundles on 32-bit systems, since we could
no longer represent the file size.
We now use uint64_t explicitly, which is both unsigned, and wide enough
to represent all the files we want.
The uintmax_t datatype has been demoted to be used only for printing,
to make it clearer what width is actually expected and used in the code.
Fixes#26
Tests are run using 'make check', and can be combined with the
existing Makefile targets, e.g. 'make check all' to run checks
on all available platforms.
Pass DEBUG=1 for additional test output.
We never expect the offset to be negative, so instead of keeping
it around as off_t, and having to cast to size_t to deal with
signed vs unsigned comparisons, we just use size_t directly.
There's still a few uses of off_t and ssize_t around, but
those will need further refactoring to clean up.
We were using -1 as a sentinel to determine if we had computed the
file descriptor limit, but rlim_t is unsigned. Also, RLIM_INFINITY
is typically -1 as well, so the choice of -1 as a sentinel was
probably not a good idea anyways.
Closes issue #19.
The 'apt' binary is not available on e.g. TravisCI, so lets stick to
using 'apt-get' for a smoother out-of-the-box build process.
The list of packages updated in df7c77a0 have been kept the same.
It's not the bundle that's opened by fuse, that's just our internal
pointer back to where the data lives. As far as fuse is concerned
the only file we have is sparsebundle.dmg, and that's the file that's
opened and released.
Instead of referencing SB_DATA all over the place, and hence also
calling fuse_get_context(), we now do it once of each function call,
through the renamed sparsebundle_current() macro.
This makes the code a bit more transparent and easier on the eye,
versus the more opaque 'data' type.