Comments (7)
Wow! Thanks for digging down this rabbit hole, both @mrc0mmand and @Dead2. From what I can tell, that's really just Hyrum's Law in practice (xkcd 1172) and there's no real reason to keep this test so specific. @randombit I'll cook up a pull request to relax it.
@mrc0mmand For now, as a temporary workaround, you may get away with running ./botan-test
with --skip-tests=compression_tests
. That should disable the failing test.
from botan.
Admittedly, that test seems quite opinionated on how a compression library should work and how its performance characteristics should look like. Botan just wraps the compression libraries and the test should probably just make sure that this wrapper works as expected.
From what I can tell, we could just remove the "opinionated" portion of this test. But perhaps, @randombit could add some context on that?
from botan.
I guess this is opinionated but I am surprised that level 1 compression compresses BETTER THAN level 9 compression. This kind of implies we should just use level 1 and save the extra CPU costs ....
from botan.
I guess this is opinionated but I am surprised that level 1 compression compresses BETTER THAN level 9 compression. This kind of implies we should just use level 1 and save the extra CPU costs ....
Yeah, I find this really suspicious, and I still feel like there's a bug somewhere else. But it's weird that it fails the same way with three different compression methods.
from botan.
After some digging I'd say that the culprit here is the transition from zlib to zlib-ng in current Fedora Rawhide (I just didn't realize that zlib, gzip, and deflate are all provided by zlib until now). There is a zlib-ng-compat package, which is supposed to provide a zlib-compatible API and ABI, but there's clearly a bug somewhere. I'll try to put together some reproducer without botan to see if that's really the case.
from botan.
Yup, it seems to be a bug in zlib-ng:
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
const char* const COMPRESSION_TEST_TEXT =
"'Twas brillig, and the slithy toves"
"Did gyre and gimble in the wabe:"
"All mimsy were the borogoves,"
"And the mome raths outgrabe."
"'Beware the Jabberwock, my son!"
"The jaws that bite, the claws that catch!"
"Beware the Jubjub bird, and shun"
"The frumious Bandersnatch!'"
"He took his vorpal sword in hand;"
"Long time the manxome foe he sought-"
"So rested he by the Tumtum tree"
"And stood awhile in thought."
"And, as in uffish thought he stood,"
"The Jabberwock, with eyes of flame,"
"Came whiffling through the tulgey wood,"
"And burbled as it came!"
"One, two! One, two! And through and through"
"The vorpal blade went snicker-snack!"
"He left it dead, and with its head"
"He went galumphing back."
"'And hast thou slain the Jabberwock?"
"Come to my arms, my beamish boy!"
"O frabjous day! Callooh! Callay!'"
"He chortled in his joy."
"'Twas brillig, and the slithy toves"
"Did gyre and gimble in the wabe:"
"All mimsy were the borogoves,"
"And the mome raths outgrabe.";
int main(void) {
Byte *out_l1, *out_l9;
uLong out_l1_len, out_l9_len;
out_l1_len = out_l9_len = compressBound(strlen(COMPRESSION_TEST_TEXT));
assert(out_l1 = calloc(out_l1_len, 1));
assert(out_l9 = calloc(out_l9_len, 1));
assert(compress2(out_l1, &out_l1_len, COMPRESSION_TEST_TEXT, strlen(COMPRESSION_TEST_TEXT), 1) == Z_OK);
assert(compress2(out_l9, &out_l9_len, COMPRESSION_TEST_TEXT, strlen(COMPRESSION_TEST_TEXT), 9) == Z_OK);
printf("Input: %lu bytes\nL1 output: %lu bytes\nL9 output: %lu bytes\n",
strlen(COMPRESSION_TEST_TEXT), out_l1_len, out_l9_len);
assert(out_l1_len > out_l9_len);
return 0;
}
On F38 (with zlib-1.2.13-4.fc39.x86_64
):
$ gcc -o test -lz test.c
$ ./test
Input: 900 bytes
L1 output: 455 bytes
L9 output: 450 bytes
On Fedora Rawhide (with zlib-ng-compat-2.1.6-1.fc40.x86_64
):
# gcc -o test -lz test.c
# ./test
Input: 900 bytes
L1 output: 449 bytes
L9 output: 450 bytes
test: test.c:57: main: Assertion `out_l1_len > out_l9_len' failed.
Aborted (core dumped)
So I'll go ahead, close this issue, and report this to zlib-ng instead.
from botan.
Reopening again, as the behavior is not actually a bug, but an implementation detail, please see the full response in the zlib-ng ticket: zlib-ng/zlib-ng#1656 (comment).
from botan.
Related Issues (20)
- FrodoKEM-AES terribly slow without AESNI
- Re-evaluate Certificate_Extension::validate
- current master fails to build docs HOT 3
- Replace TPM support with alternative library HOT 3
- Possibility to use a custom thread pool HOT 4
- Botan Thread == 1 handling and Emscripten side effects HOT 8
- Some build flags are not passed to link-time optimizer when building with `-flto=auto` HOT 6
- ECDSA public key recovery: Internal error: False assertion m_point is not null in EC_AffinePoint HOT 6
- ECDSA producing unverifiable or incorrect signatures for secp128r2 HOT 3
- Create ECDH_PrivateKey from raw bits HOT 5
- Ninja install places .cmake files in the wrong folder. HOT 2
- configure.py drops build.ninja in the repository root HOT 5
- Significant slowdown of S2K key derivation/SHA1 hashing HOT 16
- Certificate incorrectly not marked as 'self signed' HOT 2
- Building botan fails with vs2022 preview 4.0 HOT 2
- Coverage info missing for headers
- tls_proxy null reference HOT 1
- Branching on uninitialized memory in Botan::PCurve::PCurveInstance HOT 12
- Add MSan build to CI HOT 2
- Creating X509 self signed CA cert via PKCS11 module HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botan.