diff --git a/src/borg/_chunker.c b/src/borg/_chunker.c index 75599c5b1..dd141e87b 100644 --- a/src/borg/_chunker.c +++ b/src/borg/_chunker.c @@ -154,8 +154,6 @@ static int chunker_fill(Chunker *c) { ssize_t n; - off_t offset, length; - int overshoot; PyObject *data; PyThreadState *thread_state; @@ -169,7 +167,10 @@ chunker_fill(Chunker *c) if(c->fh >= 0) { thread_state = PyEval_SaveThread(); - offset = c->bytes_read; + #if ( ( _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L ) && defined(POSIX_FADV_DONTNEED) ) + off_t offset = c->bytes_read; + #endif + // if we have a os-level file descriptor, use os-level API n = read(c->fh, c->data + c->position + c->remaining, n); if(n > 0) { @@ -186,8 +187,8 @@ chunker_fill(Chunker *c) PyErr_SetFromErrno(PyExc_OSError); return 0; } - length = c->bytes_read - offset; #if ( ( _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L ) && defined(POSIX_FADV_DONTNEED) ) + off_t length = c->bytes_read - offset; // Only do it once per run. if (pagemask == 0) @@ -200,6 +201,7 @@ chunker_fill(Chunker *c) // for the OS or other processes. // We rollback the initial offset back to the start of the page, // to avoid it not being truncated as a partial page request. + int overshoot; if (length > 0) { // All Linux kernels (at least up to and including 4.6(.0)) have a bug where // they truncate last partial page of POSIX_FADV_DONTNEED request, so we need diff --git a/src/borg/cache_sync/__init__.py b/src/borg/cache_sync/__init__.py new file mode 100644 index 000000000..cb2d1a50f --- /dev/null +++ b/src/borg/cache_sync/__init__.py @@ -0,0 +1,23 @@ +""" +dummy package init file to suppress this weird setuptools warning: + +$ pip install -v . # note: does not happen with -ve . + +############################ +# Package would be ignored # +############################ +Python recognizes 'borg.cache_sync' as an importable package, +but it is not listed in the `packages` configuration of setuptools. + +'borg.cache_sync' has been automatically added to the distribution only +because it may contain data files, but this behavior is likely to change +in future versions of setuptools (and therefore is considered deprecated). + +Please make sure that 'borg.cache_sync' is included as a package by using +the `packages` configuration field or the proper discovery methods +(for example by using `find_namespace_packages(...)`/`find_namespace:` +instead of `find_packages(...)`/`find:`). + +You can read more about "package discovery" and "data files" on setuptools +documentation page. +""" diff --git a/src/borg/cache_sync/unpack.h b/src/borg/cache_sync/unpack.h index a04e81147..a67207725 100644 --- a/src/borg/cache_sync/unpack.h +++ b/src/borg/cache_sync/unpack.h @@ -388,6 +388,11 @@ static inline int unpack_callback_raw(unpack_user* u, const char* b, const char* u->expect = expect_map_item_end; } break; + default: + if(u->inside_chunks) { + SET_LAST_ERROR("Unexpected raw in chunks structure"); + return -1; + } } return 0; } diff --git a/src/borg/hashindex.pyx b/src/borg/hashindex.pyx index 3df89f365..586ec4493 100644 --- a/src/borg/hashindex.pyx +++ b/src/borg/hashindex.pyx @@ -278,8 +278,8 @@ cdef class NSKeyIterator: cdef const unsigned char *key cdef int key_size cdef int exhausted - cdef int flag_mask - cdef int flag_value + cdef unsigned int flag_mask + cdef unsigned int flag_value def __cinit__(self, key_size, mask, value): self.key = NULL