Commit graph

9162 commits

Author SHA1 Message Date
Thomas Waldmann
2ef669945f
skip test_create_read_special_symlink for now
it tends to hang, not only on cygwin.
2025-05-28 22:12:27 +02:00
Thomas Waldmann
439c193662
add tests for archiving big all-zero and all-random files 2025-05-28 13:05:13 +02:00
Thomas Waldmann
29cd100e3b
Cython: do optimisations only where really needed 2025-05-28 11:29:23 +02:00
Thomas Waldmann
a235cff0c5
Chunker: fix infinite loop
Could happen at EOF when remaining data is insufficient and no new data can be added.
2025-05-28 11:07:15 +02:00
Thomas Waldmann
5445a52994
Chunker: add sparse/fmap support 2025-05-27 23:58:12 +02:00
Thomas Waldmann
ad6d0ef2e8
Chunker: integrate FileReader for unified read logic
Replaced inline file reading logic with `FileReader` to standardize handling across chunkers. Improved buffer updates and allocation handling for sparse files and optimized read operations.
2025-05-27 23:58:08 +02:00
Thomas Waldmann
1c0d3eaa9f
FileFMAPReader: add extensive test coverage
Includes unit tests for basic functionality, handling of custom file maps, allocation types, sparse file support, and `_build_fmap` method.
2025-05-27 23:58:06 +02:00
Thomas Waldmann
e65755e114
FileReader: add tests for read and chunk handling
Includes cases for simple reads, multiple reads, and mock chunk scenarios to verify behavior with mixed allocation types.

Also: change Chunk type for empty read result for better consistency.
2025-05-27 23:58:02 +02:00
Thomas Waldmann
4db522dc0d
remove unneeded assertion, use 1MiB read size 2025-05-27 23:58:00 +02:00
Thomas Waldmann
43635a2edc
FileReader: refactor read method
Simplified and improved handling of mixed types of chunks during reading. The allocation type of resulting chunks is now determined based on contributing chunks.
2025-05-27 23:57:58 +02:00
Thomas Waldmann
3dac8f180c
Refactor FileReader.read to always return Chunk objects 2025-05-27 23:57:57 +02:00
Thomas Waldmann
1f03a776d5
Remove support for header_size in file readers.
The `header_size` parameter and related logic have been removed from file readers, simplifying their implementation. This change eliminates unnecessary complexity while maintaining all functional capabilities via `read_size` and `fmap`.
2025-05-27 23:57:55 +02:00
Thomas Waldmann
f036152789
Chunker: split logic into FileFMAPReader and FileReader
`FileFMAPReader` deals with sparse files (data vs holes) or fmap and yields blocks of some specific read_size using a generator.

`FileReader` uses the `FileFMAPReader` to fill an internal buffer and lets users use its `read` method to read arbitrary sized chunks from the buffer.

For both classes, instances now only deal with a single file.
2025-05-27 23:57:53 +02:00
Thomas Waldmann
2818a0c26e
Refactor ChunkerFixed: move file reading into FileReader class
Replaced `ChunkerFixed`'s block-reading functionality with a new `FileReader` class to streamline code and improve separation of concerns. Adjusted `ChunkerFixed` to delegate file reading to `FileReader` while focusing on chunk assembly.

`FileReader` is intended to be useful for other chunkers also, so they can easily implement sparse file reading / fmap support.
2025-05-27 23:57:52 +02:00
Thomas Waldmann
6a17829c25
refactor ChunkerFixed: move filemap building to _build_fmap method 2025-05-27 23:57:48 +02:00
TW
04000f7fed
Merge pull request #8880 from Atharva-Varpe/master
tox: use native pyproject.toml configuration
2025-05-27 17:12:46 +02:00
TW
a7bc9771d9
Merge pull request #8882 from ThomasWaldmann/buzhash-chunker-cy-translation
Buzhash chunker: C to Cython translation
2025-05-26 23:18:35 +02:00
Thomas Waldmann
8d3767efe7
inline BARREL_SHIFT code 2025-05-26 21:52:41 +02:00
Thomas Waldmann
522eaf6899
Convert _chunker.c into Cython code within Chunker class
This was mostly done by Junie AI, but needed some manual fixes:

fix exception handling
======================

-    cdef object process(self):
+    cdef object process(self) except *:

fix construction of memoryviews
===============================

placement of the [:size] is important.

-                return memoryview(<char*>(self.data + self.position))[:self.remaining]
+                return memoryview((self.data + self.position)[:self.remaining])

-        return memoryview(<char*>(self.data + old_last))[:n]
+        return memoryview((self.data + old_last)[:n])
2025-05-26 21:32:14 +02:00
Atharva Varpe
7b8137c646 removing tox.ini 2025-05-24 06:34:20 +00:00
Atharva Varpe
a4633ec144 added native tox support to pyproject.toml 2025-05-24 05:38:44 +00:00
TW
ee1f0fdb9c
Merge pull request #8876 from ThomasWaldmann/docs
docs: fix mistyped CVE number
2025-05-23 09:48:07 +02:00
Thomas Waldmann
456e319bb6
docs: fix mistyped CVE number 2025-05-23 09:26:26 +02:00
TW
2b655fccf7
Merge pull request #8872 from ThomasWaldmann/chunker-params-reject-even-window-size
ChunkerParams: reject even window size for buzhash, fixes #8868
2025-05-23 07:36:23 +02:00
TW
6fc0cd5ef3
Merge pull request #8873 from ThomasWaldmann/disable-windows-ci
CI: disable windows for now
2025-05-23 07:35:17 +02:00
Thomas Waldmann
7072f6263d
ChunkerParams: reject even window size for buzhash, fixes #8868 2025-05-23 06:49:52 +02:00
Thomas Waldmann
5940bad06e
CI: disable windows for now
The file:// repo URLs are still broken on windows.
2025-05-23 06:47:59 +02:00
TW
5707a37702
Merge pull request #8871 from ThomasWaldmann/rel200b17
Release 2.0.0b17
2025-05-23 06:37:05 +02:00
Thomas Waldmann
6b87fec1f7
update CHANGES 2025-05-22 14:22:10 +02:00
Thomas Waldmann
4514b957e4
require borgstore 0.3.x 2025-05-22 13:23:29 +02:00
Thomas Waldmann
fa01a2d46a
build_usage build_man 2025-05-22 13:21:21 +02:00
TW
fdd6f69eb4
Merge pull request #8870 from ThomasWaldmann/update-changes
update CHANGES
2025-05-22 13:13:54 +02:00
Thomas Waldmann
5b24e774b7
update CHANGES 2025-05-22 12:46:05 +02:00
TW
138afbe47f
Merge pull request #8863 from ThomasWaldmann/split-helpers-tests
Split helpers tests
2025-05-22 12:18:22 +02:00
TW
34cc0b28d1
Merge pull request #8865 from ThomasWaldmann/cython-fixes
Cython and build fixes
2025-05-22 01:17:17 +02:00
TW
4b3ba5f814
Merge pull request #8866 from ThomasWaldmann/tox
minor tox.ini improvements
2025-05-22 01:16:57 +02:00
TW
87a6a43f4f
Merge pull request #8864 from ThomasWaldmann/ci-windows-coverage
CI: upload coverage for windows tests
2025-05-22 00:07:48 +02:00
Thomas Waldmann
60d37e871d
minor tox.ini improvements
- consistent indentation with spaces
- use pytest, not py.test
- consistent empty lines between sections
- remove empty changedir lines
2025-05-21 23:44:16 +02:00
Thomas Waldmann
16b7dd8cee
suppress compiler warning about CYTHON_FALLTHROUGH
The `-Wno-unreachable-code-fallthrough` compiler flag suppresses warnings about fallthrough annotations in unreachable code.

In C switch statements, "fallthrough" occurs when execution continues from one case to the next without a break statement. This is often a source of bugs, so modern compilers warn about it. To indicate intentional fallthrough, developers use annotations like `__attribute__((fallthrough))`.

In Cython-generated C code, the `CYTHON_FALLTHROUGH` macro is defined to expand to the appropriate fallthrough annotation for the compiler being used. For example, in `compress.c`:

```c
#define CYTHON_FALLTHROUGH __attribute__((fallthrough))
```

The issue occurs because Cython generates code with conditional branches that may be unreachable on certain platforms or configurations. When these branches contain switch statements with fallthrough annotations, compilers like Clang issue warnings like:

```
warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
```

These warnings appear in the generated C code, not in the original Cython source. They're harmless but noisy, cluttering the build output with warnings about code we don't control.

By adding `-Wno-unreachable-code-fallthrough` to the compiler flags in `setup.py`, we specifically tell the compiler to ignore these particular warnings, resulting in a cleaner build output without affecting the actual functionality of the code.

This is a common practice when working with generated code - suppress specific warnings that are unavoidable due to the code generation process while keeping other useful warnings enabled.
2025-05-21 23:22:24 +02:00
Thomas Waldmann
2034864085
minor cython code fixes 2025-05-21 23:05:26 +02:00
Thomas Waldmann
18844717d2
CI: upload coverage for windows tests 2025-05-21 22:40:55 +02:00
Thomas Waldmann
881eaca08a
fix tests so that they are as before the splitup 2025-05-21 22:20:12 +02:00
Thomas Waldmann
5545af1fd0
remove now empty helpers_test 2025-05-21 21:11:49 +02:00
Thomas Waldmann
89e7e117a0
tests: move tests to testsuite.helpers.parseformat_test 2025-05-21 21:10:58 +02:00
Thomas Waldmann
a6ed1f63bc
tests: move tests to testsuite.helpers.__init__test 2025-05-21 21:07:28 +02:00
Thomas Waldmann
c564e3927b
tests: move tests to testsuite.archiver.prune_cmd_test 2025-05-21 21:04:04 +02:00
Thomas Waldmann
9241c8c940
tests: move tests to testsuite.helpers.misc_test 2025-05-21 21:00:01 +02:00
Thomas Waldmann
95432a9466
tests: move tests to testsuite.helpers.msgpack_test 2025-05-21 20:48:20 +02:00
Thomas Waldmann
a3124cbed6
tests: move tests to testsuite.helpers.process_test 2025-05-21 20:44:30 +02:00
Thomas Waldmann
63c4082843
tests: move tests to testsuite.helpers.shellpattern_test 2025-05-21 20:40:22 +02:00