guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 5edd0370ee6a581573e298f883419f184fff1ae3
Author: Sören Tempel <[email protected]>
AuthorDate: Sun Oct 5 20:24:15 2025 +0200

    gnu: nvi: Fix segfault caused by implicit function declarations
    
    * gnu/packages/patches/nvi-add-function-prototypes.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Register the patch.
    * gnu/packages/nvi.scm (nvi): Apply the patch.
    [arguments]: remove -Wno-error=implicit-function-declaration.
    
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/local.mk                                       |  1 +
 gnu/packages/nvi.scm                               |  2 +-
 .../patches/nvi-add-function-prototypes.patch      | 87 ++++++++++++++++++++++
 3 files changed, 89 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 56afdd981b..34726b8b1b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1939,6 +1939,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/nss-3.115-disable-broken-tests.patch     \
   %D%/packages/patches/nss-3.115-disable-pkix-ocsp-tests.patch  \
   %D%/packages/patches/ntp-fix-dereferencing-the-wrong-variable.patch   \
+  %D%/packages/patches/nvi-add-function-prototypes.patch       \
   %D%/packages/patches/nvi-assume-preserve-path.patch          \
   %D%/packages/patches/nvi-dbpagesize-binpower.patch           \
   %D%/packages/patches/nvi-db4.patch                           \
diff --git a/gnu/packages/nvi.scm b/gnu/packages/nvi.scm
index 5366c17e57..c13e131223 100644
--- a/gnu/packages/nvi.scm
+++ b/gnu/packages/nvi.scm
@@ -45,6 +45,7 @@
           (base32 "0nbbs1inyrqds0ywn3ln5slv54v5zraq7lszkg8nsavv4kivhh9l"))
         (patches (search-patches "nvi-assume-preserve-path.patch"
                                  "nvi-dbpagesize-binpower.patch"
+                                 "nvi-add-function-prototypes.patch"
                                  "nvi-db4.patch"))
         (modules '((guix build utils)))
         (snippet
@@ -81,7 +82,6 @@
          ;; nvi's configure chokes on passing CFLAGS and ignores
          ;; CFLAGS set in the environment.
          (string-append "CFLAGS=-g -O2"
-                        " -Wno-error=implicit-function-declaration"
                         " -Wno-error=incompatible-pointer-types"))
       #:phases
       #~(modify-phases %standard-phases
diff --git a/gnu/packages/patches/nvi-add-function-prototypes.patch 
b/gnu/packages/patches/nvi-add-function-prototypes.patch
new file mode 100644
index 0000000000..6e2f8226ef
--- /dev/null
+++ b/gnu/packages/patches/nvi-add-function-prototypes.patch
@@ -0,0 +1,87 @@
+From: Michael Hudson-Doyle <[email protected]>
+Date: Thu, 11 Apr 2024 11:18:39 +0200
+Subject: Add function prototypes to fix implicit function declaration errors
+
+Reviewed-By: Tobias Heider <[email protected]>
+Bug-Debian: https://bugs.debian.org/1066285
+---
+ cl/cl.h            | 5 +++++
+ cl/cl_funcs.c      | 6 ++++++
+ common/conv.h      | 3 +++
+ common/multibyte.h | 6 ++++++
+ dist/configure     | 1 +
+ 5 files changed, 21 insertions(+)
+
+diff --git a/cl/cl.h b/cl/cl.h
+index 3d71410..4ff232d 100644
+--- a/cl/cl.h
++++ b/cl/cl.h
+@@ -26,6 +26,11 @@
+ #endif
+ #endif
+ 
++/*
++ * for setupterm()
++ */
++#include <term.h>
++
+ typedef struct _cl_private {
+       char     ibuf[256];     /* Input keys. */
+ 
+diff --git a/cl/cl_funcs.c b/cl/cl_funcs.c
+index c5fc597..b6174ef 100644
+--- a/cl/cl_funcs.c
++++ b/cl/cl_funcs.c
+@@ -31,6 +31,12 @@ static const char sccsid[] = "$Id: cl_funcs.c,v 10.72 
2002/03/02 23:18:33 skimo
+ #include "../vi/vi.h"
+ #include "cl.h"
+ 
++/*
++ * This is declared by ncurses.h, but only if _XOPEN_SOURCE is set and lots of
++ * other things break if we define that.
++ */
++extern int waddnwstr (WINDOW *,const wchar_t *,int);
++
+ static void cl_rdiv __P((SCR *));
+ 
+ static int 
+diff --git a/common/conv.h b/common/conv.h
+index 76b06c1..a7675c4 100644
+--- a/common/conv.h
++++ b/common/conv.h
+@@ -21,3 +21,6 @@ struct _conv {
+       char2wchar_t    input2int;
+       wchar2char_t    int2disp;
+ };
++
++extern int conv_enc (SCR *sp, int option, char *enc);
++extern void conv_init (SCR *orig, SCR *sp);
+diff --git a/common/multibyte.h b/common/multibyte.h
+index 820f4ec..2484521 100644
+--- a/common/multibyte.h
++++ b/common/multibyte.h
+@@ -5,6 +5,12 @@
+ #include <wchar.h>
+ #include <wctype.h>
+ 
++/*
++ * This is declared by wchar.h, but only if _XOPEN_SOURCE is set and lots of
++ * other things break if we define that.
++ */
++extern int wcwidth (wchar_t c);
++
+ typedef       wchar_t         RCHAR_T;
+ #define RCHAR_T_MAX   ((1 << 24)-1)
+ typedef       wchar_t         CHAR_T;
+diff --git a/dist/configure b/dist/configure
+index b23e167..d7fb54f 100755
+--- a/dist/configure
++++ b/dist/configure
+@@ -27385,6 +27385,7 @@ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ #include <$CURSHEADER>
++#include <term.h>
+ int
+ main ()
+ {

Reply via email to