public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Filipe Rosset <rosset.filipe@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ngrep] rawhide: update to 1.49.0 fixes rhbz#2411924
Date: Tue, 16 Jun 2026 21:03:06 GMT	[thread overview]
Message-ID: <178164378613.1.17802814564982590011.rpms-ngrep-1b228064f0a1@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/ngrep
Branch : rawhide
Commit : 1b228064f0a1fbb4706eb32aa119b977cf548e95
Author : Filipe Rosset <rosset.filipe@gmail.com>
Date   : 2026-04-11T01:51:32-03:00
Stats  : +12/-304 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/ngrep/c/1b228064f0a1fbb4706eb32aa119b977cf548e95?branch=rawhide

Log:
update to 1.49.0 fixes rhbz#2411924

---
diff --git a/.gitignore b/.gitignore
index 505f6df..272bfaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ ngrep-1.44-1.tar.bz2
 /ngrep-9b59468.tar.gz
 /ngrep-2a9603bc67dface9606a658da45e1f5c65170444.tar.gz
 /ngrep-b2e3ba3c5a593abf203e65a407c3a9de0f998d4a.tar.gz
+/ngrep-1.49.0.tar.gz

diff --git a/27.patch b/27.patch
deleted file mode 100644
index 57dea25..0000000
--- a/27.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-From cfcf1e6e9c4f8a2404810d8d1d90e6d1eaa0abdd Mon Sep 17 00:00:00 2001
-From: Romain Francoise <romain@rfr.io>
-Date: Sat, 20 Nov 2021 23:28:15 +0100
-Subject: [PATCH] Port to PCRE2 API and enable JIT compilation
-
-The original PCRE API provided on most systems by libpcre3 is no longer
-maintained upstream and is superseded by the new PCRE2 API, which was
-first released in 2015. pcre3 will be removed from Debian in 2023, as
-noted in this bug report: https://bugs.debian.org/1000080
-
-This commit replaces the existing PCRE implementation with a new one
-using PCRE2, which is quite similar. One benefit is that PCRE2 provides
-a JIT compiler which can replace the interpretive regular expression
-evaluation code with native machine code on most modern platforms:
-https://pcre.org/current/doc/html/pcre2jit.html
-
-Depending on the length and complexity of the pattern used, enabling JIT
-compilation makes Ngrep 50x to 150x faster, testing in quiet mode on a
-multi-gigabyte PCAP file stored on tmpfs.
----
- configure.in |  24 ++++++------
- ngrep.c      | 106 ++++++++++++++++++++++++++++++++++-----------------
- 2 files changed, 82 insertions(+), 48 deletions(-)
-
-diff --git a/configure.in b/configure.in
-index dbef39b..0806a62 100644
---- a/configure.in
-+++ b/configure.in
-@@ -141,16 +141,16 @@ dnl
- REGEX_DIR=''
- REGEX_OBJS=''
- 
--AC_ARG_ENABLE(pcre,
--[  --enable-pcre           use PCRE instead of GNU regex (default GNU)],
--[ use_pcre="$enableval" ],
--[ use_pcre="no" ])
--
--if test $use_pcre = yes; then
--  USE_PCRE="1"
--  EXTRA_LIBS="$EXTRA_LIBS -lpcre"
-+AC_ARG_ENABLE(pcre2,
-+[  --enable-pcre2           use PCRE2 instead of GNU regex (default GNU)],
-+[ use_pcre2="$enableval" ],
-+[ use_pcre2="no" ])
-+
-+if test $use_pcre2 = yes; then
-+  USE_PCRE2="1"
-+  EXTRA_LIBS="$EXTRA_LIBS -lpcre2-8"
- else
--  USE_PCRE="0"
-+  USE_PCRE2="0"
- 
-   AC_MSG_RESULT
-   AC_MSG_RESULT(Configuring GNU Regular Expression library ...)
-@@ -476,7 +476,7 @@ dnl
- AC_DEFINE_UNQUOTED(USE_PCAP_RESTART,          $USE_PCAP_RESTART,          [whether to call the BPF lexer restart function between multiple BPF filter compilation attempts (default no)])
- AC_DEFINE_UNQUOTED(PCAP_RESTART_FUNC,         $PCAP_RESTART_FUNC,         [routine used for restarting the BPF lexer])
- 
--AC_DEFINE_UNQUOTED(USE_PCRE,                  $USE_PCRE,                  [whether to use PCRE (default GNU Regex)])
-+AC_DEFINE_UNQUOTED(USE_PCRE2,                 $USE_PCRE2,                 [whether to use PCRE2 (default GNU Regex)])
- AC_DEFINE_UNQUOTED(USE_IPv6,                  $USE_IPv6,                  [whether to use IPv6 (default off)])
- AC_DEFINE_UNQUOTED(USE_TCPKILL,               $USE_TCPKILL,               [whether to enable tcpkill functionality (default off)])
- AC_DEFINE_UNQUOTED(USE_VLAN_HACK,             $USE_VLAN_HACK,             [whether to automatically include VLAN frames (default on)])
-@@ -524,8 +524,8 @@ else
-     AC_MSG_RESULT(CONFIG: privilege dropping DISABLED)
- fi
- 
--if test "$USE_PCRE" = "1"; then
--    AC_MSG_RESULT(CONFIG: using PCRE regex library)
-+if test "$USE_PCRE2" = "1"; then
-+    AC_MSG_RESULT(CONFIG: using PCRE2 regex library)
- else
-     AC_MSG_RESULT(CONFIG: using GNU regex library)
- fi
-diff --git a/ngrep.c b/ngrep.c
-index 3df9389..dcf0555 100644
---- a/ngrep.c
-+++ b/ngrep.c
-@@ -91,8 +91,9 @@
- #include <netinet/icmp6.h>
- #endif
- 
--#if USE_PCRE
--#include <pcre.h>
-+#if USE_PCRE2
-+#define PCRE2_CODE_UNIT_WIDTH 8
-+#include <pcre2.h>
- #else
- #include <regex.h>
- #endif
-@@ -128,12 +129,14 @@ char nonprint_char = '.';
-  * GNU Regex/PCRE
-  */
- 
--#if USE_PCRE
--int32_t err_offset;
--char *re_err = NULL;
-+#if USE_PCRE2
-+PCRE2_SIZE err_offset;
-+int re_err;
- 
--pcre *pattern = NULL;
--pcre_extra *pattern_extra = NULL;
-+pcre2_code *re;
-+pcre2_match_data *pcre2_md;
-+PCRE2_SPTR pattern;
-+uint32_t pcre2_jit_on = 0;
- #else
- const char *re_err = NULL;
- 
-@@ -189,6 +192,7 @@ uint32_t ws_row, ws_col = 80, ws_col_forced = 0;
- 
- int main(int argc, char **argv) {
-     int32_t c;
-+    const char *extra = "";
- 
-     signal(SIGINT,   clean_exit);
-     signal(SIGABRT,  clean_exit);
-@@ -394,8 +398,12 @@ int main(int argc, char **argv) {
-         if (setup_matcher())
-             clean_exit(2);
- 
-+#if USE_PCRE2
-+        if (pcre2_jit_on)
-+            extra = " (JIT)";
-+#endif
-         if (quiet < 2 && strlen(match_data))
--            printf("%smatch: %s%s\n", invert_match?"don't ":"",
-+            printf("%smatch%s: %s%s\n", invert_match?"don't ":"", extra,
-                    (bin_data && !strchr(match_data, 'x'))?"0x":"", match_data);
- 
-         if (re_match_word) free(match_data);
-@@ -631,14 +639,14 @@ int setup_matcher(void) {
- 
-     } else {
- 
--#if USE_PCRE
--        uint32_t pcre_options = PCRE_UNGREEDY;
-+#if USE_PCRE2
-+        uint32_t pcre_options = PCRE2_UNGREEDY;
- 
-         if (re_ignore_case)
--            pcre_options |= PCRE_CASELESS;
-+            pcre_options |= PCRE2_CASELESS;
- 
-         if (re_multiline_match)
--            pcre_options |= PCRE_DOTALL;
-+            pcre_options |= PCRE2_DOTALL;
- #else
-         re_syntax_options = RE_CHAR_CLASSES | RE_NO_BK_PARENS | RE_NO_BK_VBAR |
-             RE_CONTEXT_INDEP_ANCHORS | RE_CONTEXT_INDEP_OPS;
-@@ -673,15 +681,36 @@ int setup_matcher(void) {
-             match_data = word_regex;
-         }
- 
--#if USE_PCRE
--        pattern = pcre_compile(match_data, pcre_options, (const char **)&re_err, &err_offset, 0);
-+#if USE_PCRE2
-+        re = pcre2_compile((PCRE2_SPTR8)match_data, PCRE2_ZERO_TERMINATED,
-+            pcre_options, &re_err, &err_offset, NULL);
-+        if (!re) {
-+            PCRE2_UCHAR buffer[256];
-+            pcre2_get_error_message(re_err, buffer, sizeof(buffer));
-+            fprintf(stderr, "regex compile failed: %s (offset: %zd)\n", buffer,
-+                err_offset);
-+            return 1;
-+        }
- 
--        if (!pattern) {
--            fprintf(stderr, "compile failed: %s\n", re_err);
-+        pcre2_md = pcre2_match_data_create_from_pattern(re, NULL);
-+        if (!pcre2_md) {
-+            fprintf(stderr, "unable to alloc pcre2 match data\n");
-             return 1;
-         }
- 
--        pattern_extra = pcre_study(pattern, 0, (const char **)&re_err);
-+        pcre2_config(PCRE2_CONFIG_JIT, &pcre2_jit_on);
-+        if (pcre2_jit_on) {
-+            int rc;
-+            size_t jitsz;
-+
-+            if (pcre2_jit_compile(re, PCRE2_JIT_COMPLETE) != 0) {
-+                fprintf(stderr, "unable to JIT-compile pcre2 regular expression\n");
-+                return 1;
-+            }
-+            rc = pcre2_pattern_info(re, PCRE2_INFO_JITSIZE, &jitsz);
-+            if (rc || jitsz == 0)
-+                pcre2_jit_on = 0;
-+        }
- #else
-         re_err = re_compile_pattern(match_data, strlen(match_data), &pattern);
-         if (re_err) {
-@@ -990,24 +1019,29 @@ void dump_packet(struct pcap_pkthdr *h, u_char *p, uint8_t proto, unsigned char
- }
- 
- int8_t re_match_func(unsigned char *data, uint32_t len, uint16_t *mindex, uint16_t *msize) {
--#if USE_PCRE
--
--    static int sub[2];
--    switch(pcre_exec(pattern, 0, (char const *)data, (int32_t)len, 0, 0, 0, 0)) {
--        case PCRE_ERROR_NULL:
--        case PCRE_ERROR_BADOPTION:
--        case PCRE_ERROR_BADMAGIC:
--        case PCRE_ERROR_UNKNOWN_NODE:
--        case PCRE_ERROR_NOMEMORY:
--            perror("she's dead, jim\n");
--            clean_exit(2);
-+#if USE_PCRE2
-+    int rc;
-+    PCRE2_SIZE *ovector;
-+    PCRE2_UCHAR errbuf[256];
- 
--        case PCRE_ERROR_NOMATCH:
--            return 0;
-+    if (pcre2_jit_on)
-+        rc = pcre2_jit_match(re, data, len, 0, 0, pcre2_md, NULL);
-+    else
-+        rc = pcre2_match(re, data, len, 0, 0, pcre2_md, NULL);
- 
--        default:
--            *mindex = sub[0];
--            *msize  = sub[1] - sub[0];
-+    if (rc < 0) {
-+        switch (rc) {
-+            case PCRE2_ERROR_NOMATCH:
-+                return 0;
-+            default:
-+                pcre2_get_error_message(rc, errbuf, sizeof(errbuf));
-+                fprintf(stderr, "she's dead, jim: %s (error %d)\n", errbuf, rc);
-+                clean_exit(2);
-+        }
-+    } else {
-+        ovector = pcre2_get_ovector_pointer(pcre2_md);
-+        *mindex = ovector[0];
-+        *msize = ovector[1] - ovector[0];
-     }
- #else
- 
-@@ -1479,9 +1513,9 @@ void clean_exit(int32_t sig) {
-     if (quiet < 1 && sig >= 0)
-         printf("exit\n");
- 
--#if USE_PCRE
--    if (pattern)       pcre_free(pattern);
--    if (pattern_extra) pcre_free(pattern_extra);
-+#if USE_PCRE2
-+    if (re)       pcre2_code_free(re);
-+    if (pcre2_md) pcre2_match_data_free(pcre2_md);
- #else
-     if (pattern.translate) free(pattern.translate);
-     if (pattern.fastmap)   free(pattern.fastmap);

diff --git a/28.patch b/28.patch
deleted file mode 100644
index 1a666c4..0000000
--- a/28.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 52515bae377f221b5473d9040f5f43ab1c672672 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer@redhat.com>
-Date: Mon, 19 Dec 2022 11:49:06 +0100
-Subject: [PATCH] Include <err.h> and "tcpkill.h" to avoid implicit function
- declarations
-
-Implicit function declarations are a historic language feature that
-were removed from C in 1999.
----
- ngrep.c   | 1 +
- tcpkill.c | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/ngrep.c b/ngrep.c
-index 3df9389..b2fcceb 100644
---- a/ngrep.c
-+++ b/ngrep.c
-@@ -98,6 +98,7 @@
- #endif
- 
- #include "ngrep.h"
-+#include "tcpkill.h"
- 
- 
- /*
-diff --git a/tcpkill.c b/tcpkill.c
-index 5388ec5..ac8fd2e 100644
---- a/tcpkill.c
-+++ b/tcpkill.c
-@@ -14,6 +14,7 @@
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
-+#include <err.h>
- #include <libnet.h>
- #include <pcap.h>
- 

diff --git a/ngrep.spec b/ngrep.spec
index 767ff50..9b65af3 100644
--- a/ngrep.spec
+++ b/ngrep.spec
@@ -1,26 +1,19 @@
-%global date 20241209
-%global commit b2e3ba3c5a593abf203e65a407c3a9de0f998d4a
-%global shortcommit  %(c=%{commit}; echo ${c:0:7})
+%global debug_package %{nil}
 
 Name:           ngrep
-Version:        1.47^%{date}git%{shortcommit}
+Version:        1.49.0
 Release:        %autorelease
 Summary:        Network layer grep tool
 License:        ngrep
 URL:            https://github.com/jpr5/ngrep
-Source:         %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz
-# PR#27: Port to PCRE2 API and enable JIT compilation
-Patch:          %{url}/pull/27.patch
-# PR#28: Include <err.h> and "tcpkill.h" to avoid implicit function declarations
-Patch:          %{url}/pull/28.patch
+Source:         %{url}/archive/%{commit}/%{name}-%{version}.tar.gz
 
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  gcc
-BuildRequires:  make
-
 BuildRequires:  libnet-devel
 BuildRequires:  libpcap-devel
+BuildRequires:  make
 BuildRequires:  pcre2-devel
 
 %description
@@ -33,7 +26,7 @@ interfaces, and understands bpf filter logic in the same fashion as more
 common packet sniffing tools, such as tcpdump and snoop.
 
 %prep
-%autosetup -p1 -n %{name}-%{commit}
+%autosetup -p1 -n %{name}-%{version}
 # Make sure not to be using bundled libs
 rm -r regex-0.12
 
@@ -44,7 +37,7 @@ autoreconf -fiv
 %configure \
   --enable-pcre2 \
   --enable-ipv6 \
-  --with-pcap-includes=%{_includedir}/pcap \
+  --with-pcap-includes=%{_includedir} \
   --enable-tcpkill
 %make_build STRIPFLAG=
 
@@ -52,9 +45,12 @@ autoreconf -fiv
 install -Ddpm0755 %{buildroot}%{_sbindir} %{buildroot}%{_mandir}/man8
 %make_install BINDIR_INSTALL="%{_sbindir}"
 
+%check
+./ngrep -V
+
 %files
 %license LICENSE
-%doc CHANGES CREDITS EXAMPLES.md README.md
+%doc CREDITS EXAMPLES.md README.md
 %{_sbindir}/ngrep
 %{_mandir}/man8/ngrep.8*
 

diff --git a/sources b/sources
index 01ce93d..ff84e26 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (ngrep-b2e3ba3c5a593abf203e65a407c3a9de0f998d4a.tar.gz) = 4c555ddb7e5427350f2767f45553565b07b312899139b4d6d9001470ee57ce890072d15ea0523c48b775d5196b498f06a5a3fe9a307eaa3d73416b2a9ab2dc81
+SHA512 (ngrep-1.49.0.tar.gz) = aff27c6adb679aab668a7f3674a351b4cace453b43a14329b66240536b1ee878e3a4791cf7d40b43b4dbc7c534db07e693b405fcd9a4e8956f21498be2a79896

                 reply	other threads:[~2026-06-16 21:03 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=178164378613.1.17802814564982590011.rpms-ngrep-1b228064f0a1@fedoraproject.org \
    --to=rosset.filipe@gmail.com \
    --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