Commit Graph

99 Commits

Author SHA1 Message Date
Tor Arne Vestbø
ba76dfa458 Properly clean up subprocesses in tests
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.
2018-09-13 16:46:31 +02:00
Tor Arne Vestbø
ed8c830af8 Remove unused pid variable in tests 2018-09-13 16:37:28 +02:00
Tor Arne Vestbø
cb7bbdffee Convert tests indentation to spaces 2018-09-13 16:36:47 +02:00
Tor Arne Vestbø
d56ff2a19a Tweak language in README 2018-09-12 13:19:22 +02:00
Tor Arne Vestbø
501f1ca5f1 Fix Makefile indentation 2018-09-11 23:59:18 +02:00
Tor Arne Vestbø
d5691b1418 Update FUSE link 2018-09-11 23:54:37 +02:00
Tor Arne Vestbø
5851bf70fa Add LGTM badge 2018-09-11 23:45:02 +02:00
Tor Arne Vestbø
9ac1d2d230 Fix Markdown code block indentation 2018-09-11 23:44:47 +02:00
Tor Arne Vestbø
134f8b61c1 Add CodeFactor badge 2018-09-11 23:24:59 +02:00
Tor Arne Vestbø
9a4d8f3567 Make use of getgrnam() thread-safe
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.
2018-09-11 23:18:31 +02:00
Tor Arne Vestbø
9b3c59f63c Fix ShellSheck issues 2018-09-11 11:08:49 +02:00
Tor Arne Vestbø
c1f54577df Only print colors during testing if attached to a color-capable TTY 2018-09-10 16:39:39 +02:00
Tor Arne Vestbø
7aad5ce703 Update macOS naming 2018-09-10 16:33:33 +02:00
Tor Arne Vestbø
da81d0de66 Tweak language in docs about mount point access 2018-09-10 15:26:04 +02:00
Tor Arne Vestbø
7d81b50bb8 Clarify access, ownership, and permissions for mounted sparsebundle
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
2018-09-10 15:22:03 +02:00
Tor Arne Vestbø
b78b40a880 Always restore terminal to sane defaults after docker-compose 2018-09-10 10:36:25 +02:00
Tor Arne Vestbø
9afa26898c Run test cases in order 2018-09-09 02:33:53 +02:00
Tor Arne Vestbø
84f4844991 Tweak teardown test function style 2018-09-09 02:11:45 +02:00
Tor Arne Vestbø
9405bb2a93 Fix large file support on 32-bit systems
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
2018-09-09 02:06:37 +02:00
Tor Arne Vestbø
7e21a302ed Use consistent style for pointer declarations 2018-09-09 01:36:06 +02:00
Tor Arne Vestbø
d7a1f72062 Add test harness and initial mount test
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.
2018-09-08 22:24:46 +02:00
Tor Arne Vestbø
46bfe7b547 Output log message when exiting the application 2018-09-08 22:15:10 +02:00
Tor Arne Vestbø
c831d584af Don't send syslog messages to console via LOG_CONS
It results in duplicate messages to the console when run in the
foreground on Ubuntu 16.04. We already get all messages to stderr
via LOG_PERROR.
2018-09-08 22:15:10 +02:00
Tor Arne Vestbø
1d65325a8b Add basic infrastructure for doing 32 and 64-bit GCC builds on macOS
Using make to do the platform selection is admittedly abusing the
hammer beyond any sort of sanity, but was a fun exercise ;)
2018-09-08 22:15:03 +02:00
Tor Arne Vestbø
63da17bdea Indent Makefile conditionals with spaces instead of tabs
Makes it less likely that make will confuse the indent for a command.
2018-08-04 19:22:41 +02:00
Tor Arne Vestbø
e4cae5363b Add dSYM files to gitignore 2018-08-03 01:24:37 +02:00
Tor Arne Vestbø
fe4d1c6067 Teach Makefile how to shadow-build
Allows running make -f /path/to/Makefile to keep the build
artifacts out of the source directory.
2018-08-03 01:23:45 +02:00
Tor Arne Vestbø
49f8f323d5 Prospective build fix for attempted call of ‘min(size_t, uintmax_t) 2018-05-11 21:29:26 +02:00
Tor Arne Vestbø
ffb268d003 Merge branch 'warning-cleanups'
A collection of various compilation warnings fixes that people have been
helpfully submitting fixes for without me picking up the ball until now.
2018-05-04 00:52:15 +02:00
Tor Arne Vestbø
d500e0c37b Enable -pedantic and fix use of %p with non-void* pointers 2018-05-04 00:43:50 +02:00
Tor Arne Vestbø
53ca0a682b Explicitly enable C++11 mode 2018-05-04 00:43:50 +02:00
Tor Arne Vestbø
7414e516c2 Track the number of times a sparsebundle has been opened using uintmax_t
Instead of off_t, which doesn't make sense, being both unsigned and not
a very logical type to use for a counter.
2018-05-04 00:43:50 +02:00
Tor Arne Vestbø
90c81b1776 Move to size_t and other unsigned types, over off_t
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.
2018-05-04 00:43:50 +02:00
Fedor Bezrukov
a5f9c89dd9 Fix narrowing from ssize_t to size_t in sparsebundle_read_buf_process_band 2018-05-04 00:43:50 +02:00
Paolo G. Giarrusso
f359ac8a0d Use correct printf format specifiers for size_t 2018-05-04 00:43:46 +02:00
Tor Arne Vestbø
f3ccd20bd6 Fix narrowing conversion of ‘-1’ from ‘int’ to ‘rlim_t‘
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.
2016-09-27 23:50:42 +02:00
Tor Arne Vestbø
046d0153b0 Revert df7c77a0 (Recommend and use 'apt install' over 'apt-get install')
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.
2016-09-27 23:39:43 +02:00
Tor Arne Vestbø
df7c77a0fd Recommend and use 'apt install' over 'apt-get install'
Also limits the packages we recommend installing. The rest will
be installed as dependencies if needed.

Fixes issue #18.
2016-09-27 23:35:45 +02:00
Tor Arne Vestbø
3d0e187f14 Allow overriding CFLAGS from the command line when running 'make' 2016-09-27 23:33:20 +02:00
Tor Arne Vestbø
d3ffa4071c Add maxAge for license badge 2016-09-18 21:50:21 +02:00
Tor Arne Vestbø
b25ea1cd10 Add license badge 2016-09-18 21:47:36 +02:00
Tor Arne Vestbø
01586abc7b Use SVG for build status badge 2016-09-18 21:31:39 +02:00
Tor Arne Vestbø
f5fb2f958b Log which file descriptors are closed 2016-06-17 18:56:19 +02:00
Tor Arne Vestbø
d3c85f2ab8 Add missing static keyword for sparsebundle_read_buf_prepare_file
Fixes warning about no previous prototype for function [-Wmissing-prototypes]
2016-06-17 18:56:15 +02:00
Tor Arne Vestbø
c8ac56d594 Clarify difference between bundle and exposed dmg path in logging
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.
2016-06-17 18:56:14 +02:00
Tor Arne Vestbø
bc83f462d0 Verify bundle and mount point paths in sparsebundle_opt_proc 2016-06-17 18:56:14 +02:00
Tor Arne Vestbø
40e55df463 Add sparsebundle_fatal_error function for unifying fatal errors
The function is marked with the printf archetype, so that the compiler
will not complain that we're passing non-string-literals to vfprintf.
2016-06-17 18:56:14 +02:00
Tor Arne Vestbø
c325e3e4fc Parse and store the mountpoint from the command line arguments 2016-06-17 18:56:13 +02:00
Tor Arne Vestbø
b5dd50f6d0 Rename and change usage of sparsebundle_data macros
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.
2016-06-17 18:56:13 +02:00
Tor Arne Vestbø
5b83abfa26 Fix unused parameter [-Wunused-parameter] warnings 2016-06-17 18:56:12 +02:00