Unverified Commit 521c833c authored by Grimmauld's avatar Grimmauld
Browse files

librsvg: patch too_many_elements test to accept any error

libxml 2.15 no longer updates the element count
before throwing an error in case of too many elements.
This makes librsvg unable to report `TooManyLoadedElements`,
instead failing with a generic error.
parent 0d73b69f
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
diff --git a/rsvg/tests/errors.rs b/rsvg/tests/errors.rs
index 02b134bee..46391fa5d 100644
--- a/rsvg/tests/errors.rs
+++ b/rsvg/tests/errors.rs
@@ -14,15 +14,12 @@ use rsvg::{CairoRenderer, ImplementationLimit, Loader, LoadingError, RenderingEr
 
 #[ignore]
 #[test]
+#[should_panic]
 fn too_many_elements() {
     let name = "tests/fixtures/errors/bug515-too-many-elements.svgz";
 
-    assert!(matches!(
-        Loader::new().read_path(name),
-        Err(LoadingError::LimitExceeded(
-            ImplementationLimit::TooManyLoadedElements
-        ))
-    ));
+    // libxml2 might return an error without updating the element count, so just expect any error, not specifically too many elements
+    Loader::new().read_path(name).unwrap();
 }
 
 fn rendering_instancing_limit(name: &str) {
+11 −0
Original line number Diff line number Diff line
@@ -64,6 +64,17 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-vBu81BkSCwmNsovqVTNdneJHDU5qn27pcge0EPwVhn0=";
  };

  patches = [
    # too_many_elements test fails with libxml 2.15.0,
    # because libxml2 no longer updates the element count
    # before erroring out, which breaks the librsvg limit check.
    #
    # This is okay, because the error is still detected.
    # The error is simply not reported accurately.
    # https://gitlab.gnome.org/GNOME/librsvg/-/issues/1201
    ./expect-any-error-too-many-elements.patch
  ];

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit (finalAttrs) src;
    name = "librsvg-deps-${finalAttrs.version}";