public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Benjamin A. Beasley <code@musicinmybrain.net>
To: git-commits@fedoraproject.org
Subject: [rpms/earcut-hpp] rawhide: Patch for degenerate edges
Date: Wed, 09 Sep 2026 08:56:40 GMT	[thread overview]
Message-ID: <178894420047.1.11623101430760137012.rpms-earcut-hpp-c00e2a744ebf@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/earcut-hpp
Branch : rawhide
Commit : c00e2a744ebf1573c81d76a057365be8574d5a74
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-09-09T09:54:52+01:00
Stats  : +67/-0 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/earcut-hpp/c/c00e2a744ebf1573c81d76a057365be8574d5a74?branch=rawhide

Log:
Patch for degenerate edges

---
diff --git a/136.patch b/136.patch
new file mode 100644
index 0000000..2d6a3e1
--- /dev/null
+++ b/136.patch
@@ -0,0 +1,29 @@
+From 99cef86716b50e4fe529b6c0aae3e994758848c9 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Wed, 9 Sep 2026 07:34:30 +0100
+Subject: [PATCH] Include `type_traits` header for `std::decay`
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Don’t rely on indirect/implicit inclusion via other standard-library
+headers.
+
+This minor omission was originally pointed out by Copilot in
+https://github.com/skogler/mapbox_earcut_python/pull/32.
+---
+ include/mapbox/earcut.hpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/mapbox/earcut.hpp b/include/mapbox/earcut.hpp
+index 84f8bd5..1f8b6da 100644
+--- a/include/mapbox/earcut.hpp
++++ b/include/mapbox/earcut.hpp
+@@ -7,6 +7,7 @@
+ #include <cstdint>
+ #include <limits>
+ #include <memory>
++#include <type_traits>
+ #include <utility>
+ #include <vector>
+ 

diff --git a/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch b/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch
new file mode 100644
index 0000000..2b39749
--- /dev/null
+++ b/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch
@@ -0,0 +1,30 @@
+From c0c5ecb6bd1f43ad1f5b005e846221e524d9214d Mon Sep 17 00:00:00 2001
+From: Neil Chatterjee <55393285+skeptopic@users.noreply.github.com>
+Date: Tue, 7 Jul 2026 10:07:38 +0200
+Subject: [PATCH] Guard against degenerate edges (#134)
+
+JS Array#Sort doesn't bomb on NaN, but std::sort does
+---
+ include/mapbox/earcut.hpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/include/mapbox/earcut.hpp b/include/mapbox/earcut.hpp
+index 2bd03b4..b4450db 100644
+--- a/include/mapbox/earcut.hpp
++++ b/include/mapbox/earcut.hpp
+@@ -561,9 +561,12 @@ typename Earcut<N>::Node* Earcut<N>::eliminateHoles(const Polygon& points, Node*
+     std::sort(holeQueue.begin(), holeQueue.end(), [](const Node* a, const Node* b) {
+         if (a->x != b->x) return a->x < b->x;
+         if (a->y != b->y) return a->y < b->y;
+-        const double aSlope = (a->next->y - a->y) / (a->next->x - a->x);
+-        const double bSlope = (b->next->y - b->y) / (b->next->x - b->x);
+-        return aSlope < bSlope;
++        const double adx = a->next->x - a->x, ady = a->next->y - a->y;
++        const double bdx = b->next->x - b->x, bdy = b->next->y - b->y;
++        const bool aDegenerate = adx == 0 && ady == 0;
++        const bool bDegenerate = bdx == 0 && bdy == 0;
++        if (aDegenerate != bDegenerate) return aDegenerate;
++        return ady * bdx < bdy * adx;
+     });
+ 
+     // block-bbox index for findHoleBridge, grown append-only as holes merge. Seed it with the

diff --git a/earcut-hpp.spec b/earcut-hpp.spec
index dcc3934..ee160bd 100644
--- a/earcut-hpp.spec
+++ b/earcut-hpp.spec
@@ -15,6 +15,14 @@ Source0:        %{url}/archive/v%{version}/earcut.hpp-%{version}.tar.gz
 # not contribute to the binary RPMs.
 Source1:        https://github.com/mapbox/earcut/archive/v%{version}/earcut-%{version}.tar.gz
 
+# Include `type_traits` header for `std::decay`
+# https://github.com/mapbox/earcut.hpp/pull/136
+Patch:          %{url}/pull/136.patch
+# Guard against degenerate edges
+# https://github.com/mapbox/earcut.hpp/commit/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d
+# See discussion in https://github.com/skogler/mapbox_earcut_python/pull/32.
+Patch:          %{url}/commit/c0c5ecb6bd1f43ad1f5b005e846221e524d9214d.patch
+
 BuildSystem:    cmake
 # We do want to build the tests, but we have no use for the benchmarks or the
 # visualizer program.

                 reply	other threads:[~2026-09-09  8:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178894420047.1.11623101430760137012.rpms-earcut-hpp-c00e2a744ebf@fedoraproject.org \
    --to=code@musicinmybrain.net \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox