1
0
mirror of https://gitlab.com/bzip2/bzip2.git synced 2025-09-13 04:46:28 +03:00
Commit Graph

190 Commits

Author SHA1 Message Date
Micah Snyder
1c5049e9f0 CMake, Rust: build bzlib_rust with CMake
Add FindRust.cmake module. Original source:
https://github.com/micahsnyder/cmake-rust-demo

Integrate bzlib_rust unit tests with CTest.
2022-01-30 19:27:54 -08:00
Mateusz Mikuła
3f60c546aa Format Rust code 2022-01-30 17:20:32 -08:00
Mateusz Mikuła
e05e22d57a Ignore tables from rustfmt 2022-01-30 17:20:28 -08:00
Luca Bruno
c24c5aec02 rand_table: use u16 and remove some panic points
This changes some numeric types and operations to make RandState
operations safer. In particular:
 * RAND_TABLE values are all u16
 * index and counter are u16
 * u16->usize does not require any unsafe cast
 * saturating add/sub operations are still correct, and safer
2022-01-30 17:17:27 -08:00
Federico Mena Quintero
30d03a1d1e huffman.c: turn the DOWNHEAP() macro into a function 2022-01-30 17:16:46 -08:00
Federico Mena Quintero
e8b8f69b85 huffman.c: turn the UPHEAP() macro into a function 2022-01-30 17:16:46 -08:00
Federico Mena Quintero
6f9365da76 Remove unused RandState field from EState
It is just DState that needs it.
2022-01-30 17:16:45 -08:00
Federico Mena Quintero
b85dc9b77d RandState: use snake_case names for fields 2022-01-30 17:16:45 -08:00
Federico Mena Quintero
04f0b0a10b rand_table.rs: Port all the functions in randtable.c to Rust
This is a straightforward port.
2022-01-30 17:16:43 -08:00
Federico Mena Quintero
581942f3a0 Make the RAND_TABLE static const 2022-01-30 17:13:40 -08:00
Federico Mena Quintero
3a6f9553d2 BZ2_rand_update_mask() - Turn BZ_RAND_UPD_MASK into a function 2022-01-30 17:12:22 -08:00
Federico Mena Quintero
9fe1ae2cc9 BZ2_rand_mask() - Turn BZ_RAND_MASK into a function 2022-01-30 17:11:06 -08:00
Federico Mena Quintero
9e5d25038a BZ_rand_init() - Turn BZ_RAND_INIT_MASK into a function 2022-01-30 17:06:46 -08:00
Federico Mena Quintero
62f9fc8abf Put the fields from BZ_RAND_DECLS in a RandState struct
The BZ_RAND_* macros nicely encapsulate the concept of a randomization
table with state; let's turn that into an actual type.
2022-01-30 17:06:46 -08:00
Federico Mena Quintero
1e3c9d774c Remove crc32test.c
The tests are now in Rust.
2022-01-30 17:05:45 -08:00
Federico Mena Quintero
f7f69c03f3 Move the crc32 implementation over to Rust
This doesn't link properly yet; it needs pthread/dlsym (?)
2022-01-30 17:04:44 -08:00
Federico Mena Quintero
8865635737 Move usage of the crc crate to an experimental test
For now, it would be hard to directly substitute the CRC
implementation in bzlib, because the crc32::Digest state from the Rust
crate is opaque.  We'll do it another way.
2022-01-30 17:02:22 -08:00
Federico Mena Quintero
2ca1c0de27 Now that we don't use crc32fast, rename the test function 2022-01-30 17:01:57 -08:00
Federico Mena Quintero
0a80c139ed Use Digest::new_custom() to use the same CRC32 mode as the original C code
Many thanks to @kepstin@glitch.social for figuring this out!

This is based on the information and tables from
https://github.com/Michaelangel007/crc32
2022-01-30 17:01:57 -08:00
Federico Mena Quintero
6bddec645e Add a Rust build infrastructure for an internals library
This is copied from librsvg.
2022-01-30 17:01:45 -08:00
Federico Mena Quintero
f43fea340a Add a test for the CRC32 functions
This just computes the CRC32 of some strings and compares them
to their precomputed values.  We'll use this to test against a
different implementation.
2022-01-30 17:00:52 -08:00
Federico Mena Quintero
f55a1e7e0f Make the CRC32 table static const 2022-01-30 17:00:34 -08:00
Federico Mena Quintero
2ae5dbf531 Lowercase the names of the CRC functions 2022-01-30 17:00:31 -08:00
Federico Mena Quintero
b1c20be736 Turn the CRC32 macros into functions 2022-01-30 16:59:22 -08:00
Federico Mena Quintero
01030efb29 Rename crctable.c to crc32.c
We are going to put all the CRC32 code in there, not just the table.
2022-01-30 16:53:39 -08:00
Micah Snyder
ab4061f774 Change USE_OLD_SONAME to build extra lib w. old name
Rather than adding a symlink with the old name, this commit changes the
USE_OLD_SONAME option so it builds an extra copy of the library with the
old SONAME.
2022-01-30 11:59:25 -08:00
Micah Snyder
4c0d43f0f8 Fix Windows build
The commit to fix GCC10's warning regarding non-signal-safe functions in
our fatal signal handler introduced STDERR_FILENO which is a POSIX
definition not supported on Windows.

This commit replaces it with _fileno(stderr) on Windows.
I've also added macros to replace a few other functions with ISO C and
C++ compliant variants.
2022-01-30 11:50:37 -08:00
Micah Snyder
1ea006590d CMake: Add USE_OLD_SONAME configuration option
You can now build with `cmake . -D USE_OLD_SONAME=ON` to have CMake
patch the shared library to use the old SONAME for binary compatibility
with old libbz2 1.0.x installs.
2022-01-30 11:50:37 -08:00
Micah Snyder
7b44372099 Project version 1.1.0, libtool version 1:9:0
Increase the project version to 1.1.0 as this is a new feature version.

As for all new feature versions, increase the libtool .so version.
Only increase the revision, as no API's were added or removed.
It may look like I've increased it by 2, but that's because v1.0.8 used
Makefiles and was at 1:8:0.

See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
2022-01-30 11:50:37 -08:00
Micah Snyder
10fe37f2eb Project home is now now gitlab.com/bzip2
Explain why bzip2 has repositories on sourceware.org and gitlab.com.

Change error messages in bzip2 source to request that bugs be reported
to project's gitlab issues page.

Fixup project homepage in various documents to point to gitlab project.

Remove trailing whitespace from a few documents.

Update the Release Checklist.

Add myself as new maintainer.
2022-01-30 11:50:37 -08:00
Micah Snyder
5d159ca220 News: Update to account for 1.0.7, 1.0.8
Add the notes from 1.0.7 and 1.0.8 patch versions.

Restructure the news as markdown.

Re-order to news so the newest things go at the top.

Remove duplicate item from the AUTHORS document.
2022-01-30 11:50:37 -08:00
Mark Wielaard
56c8399086 Don't call unsafe functions from SIGSEGV/SIGBUS signal handler.
GCC10 -fanalyzer notices that we try to call functions that are not
signal safe from our fatal signal handler:

bzip2.c: In function ‘mySIGSEGVorSIGBUScatcher’:
bzip2.c:819:7: warning: call to ‘fprintf’ from within signal handler
               [CWE-479] [-Wanalyzer-unsafe-call-within-signal-handler]

It also notices we then call showFileNames and cleanupAndFail which
also call possibly not signal safe functions.

Just write out the error message directly to STDERR and exit without
trying to clean up any files.
2022-01-30 11:50:37 -08:00
Mark Wielaard
c7334a261a manual.xml: Add BZ_SEQUENCE_ERROR to return values of BZ2_bzDecompress
BZ_SEQUENCE_ERROR can be returned if BZ2_bzDecompress is called after
an earlier call already returned BZ_STREAM_END.

Reported-by: Vanessa McHale <vamchale@gmail.com>
2022-01-30 11:50:37 -08:00
Mark Wielaard
ef10e08eb4 Mention the --help command line option in the documentation.
Bug-Debian: https://bugs.debian.org/517257
2022-01-30 11:50:37 -08:00
Mark Wielaard
228a99c559 bzip2.1: remove blank spaces in man page and drop the .PU macro.
Author: Bjarni Ingi Gislason
Bug-Debian: https://bugs.debian.org/675380
2022-01-30 11:50:37 -08:00
Mark Wielaard
72d05fc59b manual: Add id to legalnotice.
Otherwise the generated HTML will have a different randomly generated
name id which generates spurious diffs.
2022-01-30 11:50:37 -08:00
Mark Wielaard
9873c1c246 fix bzdiff when TMPDIR contains spaces
The bzdiff script doesn't contain enough quotes, so that it doesn't
work if the TMPDIR environment variable is defined and contains
spaces.

https://bugs.debian.org/493710
Author: Vincent Lefevre <vincent@vinc17.org>
2022-01-30 11:50:37 -08:00
Mark Wielaard
62c12b8ebc Use UTF-8 encoding and include bzip.css as link for HTML manual. 2022-01-30 11:50:37 -08:00
Micah Snyder
2221ed3deb Test: discard BZIP/BZIP2 vars before testing
The tests may fail if the BZIP or BZIP2 environment variables are set.
To reproduce the issue, run:

  BZIP2="--derp" ctest -V

This commit discards those variables before running the tests.

Resolves: https://gitlab.com/bzip2/bzip2/-/issues/31

Fix courtesy of Michael Orlitzky
2021-07-10 03:08:58 -07:00
Micah
2a2a30bd9f Merge branch 'pr-27-dcbaker-fix-tests-fixup' into 'master'
tests/runtests.py: Compare the actual and expected output (replacement)

See merge request bzip2/bzip2!39
2021-07-10 22:46:58 +00:00
Micah Snyder
5b77c775f8 AppVeyor: Remove MSVC2008, Add 2017, Fix 2015
MSVC2008 appears to be no longer available.
MSVC2015 and 2017 appear to require setting APPVEYOR_BUILD_WORKER_IMAGE
The MSVC2015 x64 vcvarsall.bat command didn't match AppVeyor's
instructions. See: https://www.appveyor.com/docs/lang/cpp/
2021-07-10 15:37:58 -07:00
Micah Snyder
857df933cb Windows: Prevent git from changing line endings on test files
The sample3.ref test file is plain ascii, which means that Git on
Windows will automatically convert the line endings from \n to \r\n.
This of course causes a test to fail.

Added a .gitattributes file that requires Git to treat *.ref files as
binary, so it won't convert line endings.
2021-07-10 12:33:16 -07:00
Micah
d8b73fcc04 Merge branch 'not-me' into 'master'
Remove myself as maintainer

See merge request bzip2/bzip2!40
2021-06-04 01:43:18 +00:00
Federico Mena Quintero
58bc20462f Remove myself as maintainer 2021-06-03 19:14:52 -05:00
Micah Snyder
99459efa0b Code format housekeeping
There are a bunch of mixed tabs and spaces that are distracting when
reading the code. Just tidying up...
2021-06-01 09:37:23 -07:00
Micah Snyder
44032388da Tests: print actual v. expected on test failure
The compress -3 test is failing on Windows.
This change will print a hex dump in a left/right format to help
triage the failed test.
2021-06-01 09:37:16 -07:00
Micah Snyder
4cb6ecfd34 CMake: Run tests with correct options 2021-06-01 09:36:57 -07:00
Dylan Baker
3ea0df8d80 tests/runtests.py: Compare the actual and expected output
Which should have been done from the get-go, but I just didn't do.
2021-05-31 12:56:25 -07:00
Dylan Baker
917f66c56e meson: make test output more verbose 2021-05-31 12:56:25 -07:00
Micah
bf905ea225 Merge branch 'master' into 'master'
license and version print should output to stdout and exit with code 0

See merge request federicomenaquintero/bzip2!36
2021-05-31 19:53:03 +00:00