Control: tags -1 + patch Hi Lorenzo,
On Mon, Feb 17, 2025 at 05:51:36PM +0000, Matthias Klose wrote: > The package fails to build in a test rebuild on at least amd64 with > gcc-15/g++-15, but succeeds to build with gcc-14/g++-14. The > severity of this report will be raised before the forky release. Please find attached a patch ready to go in Debian that I just wrote to fix this, based on a patch I sent upstream at https://github.com/g-pape/runit/pull/4 but you probably won't want to apply this because literally half an hour later the upstream maintainer shared his own patch at https://github.com/g-pape/runit/pull/5! Andrew
>From 203199886103c3b09fbefcc5792ba71fc401af68 Mon Sep 17 00:00:00 2001 From: Andrew Bower <[email protected]> Date: Sun, 5 Oct 2025 17:06:44 +0100 Subject: [PATCH] C23: patch K&R declarations into ANSI prototypes (Closes: #1097826) --- ...for-remaining-K-R-style-declarations.patch | 504 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 505 insertions(+) create mode 100644 debian/patches/0029-C23-swap-ANSI-for-remaining-K-R-style-declarations.patch diff --git a/debian/patches/0029-C23-swap-ANSI-for-remaining-K-R-style-declarations.patch b/debian/patches/0029-C23-swap-ANSI-for-remaining-K-R-style-declarations.patch new file mode 100644 index 0000000..f4f91d9 --- /dev/null +++ b/debian/patches/0029-C23-swap-ANSI-for-remaining-K-R-style-declarations.patch @@ -0,0 +1,504 @@ +From: Andrew Bower <[email protected]> +Subject: C23: swap ANSI prototypes for K&R-style declarations + +Last-Update: 2025-10-05 +Forwarded: https://github.com/g-pape/runit/pull/4 +--- + runit-2.2.0/src/alloc.c | 6 ++---- + runit-2.2.0/src/alloc.h | 6 +++--- + runit-2.2.0/src/alloc_re.c | 5 +---- + runit-2.2.0/src/buffer.c | 2 +- + runit-2.2.0/src/buffer.h | 6 +++--- + runit-2.2.0/src/buffer_0.c | 2 +- + runit-2.2.0/src/buffer_get.c | 2 +- + runit-2.2.0/src/buffer_put.c | 2 +- + runit-2.2.0/src/buffer_write.c | 2 +- + runit-2.2.0/src/byte.h | 11 +++++------ + runit-2.2.0/src/byte_chr.c | 5 +---- + runit-2.2.0/src/byte_copy.c | 5 +---- + runit-2.2.0/src/byte_cr.c | 5 +---- + runit-2.2.0/src/byte_diff.c | 5 +---- + runit-2.2.0/src/byte_rchr.c | 5 +---- + runit-2.2.0/src/pathexec_env.c | 2 +- + runit-2.2.0/src/runit.c | 10 +++++----- + runit-2.2.0/src/runsv.c | 4 ++-- + runit-2.2.0/src/runsvdir.c | 6 +++--- + runit-2.2.0/src/select.h2 | 1 - + runit-2.2.0/src/sig.c | 4 ++-- + runit-2.2.0/src/sig.h | 6 +++--- + runit-2.2.0/src/sig_catch.c | 2 +- + runit-2.2.0/src/svlogd.c | 8 ++++---- + runit-2.2.0/src/wait.h | 6 ++---- + runit-2.2.0/src/wait_nohang.c | 2 +- + runit-2.2.0/src/wait_pid.c | 4 ++-- + 27 files changed, 50 insertions(+), 74 deletions(-) + +diff --git a/runit-2.2.0/src/alloc.c b/runit-2.2.0/src/alloc.c +index c741aa4..5b21993 100644 +--- a/runit-2.2.0/src/alloc.c ++++ b/runit-2.2.0/src/alloc.c +@@ -12,8 +12,7 @@ static aligned realspace[SPACE / ALIGNMENT]; + #define space ((char *) realspace) + static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */ + +-/*@null@*//*@out@*/char *alloc(n) +-unsigned int n; ++/*@null@*//*@out@*/char *alloc(unsigned int n) + { + char *x; + n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */ +@@ -23,8 +22,7 @@ unsigned int n; + return x; + } + +-void alloc_free(x) +-char *x; ++void alloc_free(char *x) + { + if (x >= space) + if (x < space + SPACE) +diff --git a/runit-2.2.0/src/alloc.h b/runit-2.2.0/src/alloc.h +index 21122fc..8647a7d 100644 +--- a/runit-2.2.0/src/alloc.h ++++ b/runit-2.2.0/src/alloc.h +@@ -3,8 +3,8 @@ + #ifndef ALLOC_H + #define ALLOC_H + +-extern /*@null@*//*@out@*/char *alloc(); +-extern void alloc_free(); +-extern int alloc_re(); ++extern /*@null@*//*@out@*/char *alloc(unsigned int); ++extern void alloc_free(char *); ++extern int alloc_re(char **,unsigned int,unsigned int); + + #endif +diff --git a/runit-2.2.0/src/alloc_re.c b/runit-2.2.0/src/alloc_re.c +index 1074609..5096fb1 100644 +--- a/runit-2.2.0/src/alloc_re.c ++++ b/runit-2.2.0/src/alloc_re.c +@@ -3,10 +3,7 @@ + #include "alloc.h" + #include "byte.h" + +-int alloc_re(x,m,n) +-char **x; +-unsigned int m; +-unsigned int n; ++int alloc_re(char **x,unsigned int m,unsigned int n) + { + char *y; + +diff --git a/runit-2.2.0/src/buffer.c b/runit-2.2.0/src/buffer.c +index 38e6d77..b53c933 100644 +--- a/runit-2.2.0/src/buffer.c ++++ b/runit-2.2.0/src/buffer.c +@@ -2,7 +2,7 @@ + + #include "buffer.h" + +-void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len) ++void buffer_init(buffer *s,int (*op)(int,char *,unsigned int),int fd,char *buf,unsigned int len) + { + s->x = buf; + s->fd = fd; +diff --git a/runit-2.2.0/src/buffer.h b/runit-2.2.0/src/buffer.h +index 8f2e572..bd4db94 100644 +--- a/runit-2.2.0/src/buffer.h ++++ b/runit-2.2.0/src/buffer.h +@@ -8,14 +8,14 @@ typedef struct buffer { + unsigned int p; + unsigned int n; + int fd; +- int (*op)(); ++ int (*op)(int,char *,unsigned int); + } buffer; + + #define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } + #define BUFFER_INSIZE 8192 + #define BUFFER_OUTSIZE 8192 + +-extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int); ++extern void buffer_init(buffer *,int (*)(int,char *,unsigned int),int,char *,unsigned int); + + extern int buffer_flush(buffer *); + extern int buffer_put(buffer *,const char *,unsigned int); +@@ -50,7 +50,7 @@ extern void buffer_seek(buffer *,unsigned int); + extern int buffer_copy(buffer *,buffer *); + + extern int buffer_unixread(int,char *,unsigned int); +-extern int buffer_unixwrite(int,const char *,unsigned int); ++extern int buffer_unixwrite(int,/* const */char *,unsigned int); + + extern buffer *buffer_0; + extern buffer *buffer_0small; +diff --git a/runit-2.2.0/src/buffer_0.c b/runit-2.2.0/src/buffer_0.c +index 47d3263..d76f352 100644 +--- a/runit-2.2.0/src/buffer_0.c ++++ b/runit-2.2.0/src/buffer_0.c +@@ -2,7 +2,7 @@ + + #include "buffer.h" + +-int buffer_0_read(fd,buf,len) int fd; char *buf; int len; ++int buffer_0_read(int fd, char *buf, unsigned int len) + { + if (buffer_flush(buffer_1) == -1) return -1; + return buffer_unixread(fd,buf,len); +diff --git a/runit-2.2.0/src/buffer_get.c b/runit-2.2.0/src/buffer_get.c +index 3a6e1b6..4ce4147 100644 +--- a/runit-2.2.0/src/buffer_get.c ++++ b/runit-2.2.0/src/buffer_get.c +@@ -4,7 +4,7 @@ + #include "byte.h" + #include "error.h" + +-static int oneread(int (*op)(),int fd,char *buf,unsigned int len) ++static int oneread(int (*op)(int,char*,unsigned int),int fd,char *buf,unsigned int len) + { + int r; + +diff --git a/runit-2.2.0/src/buffer_put.c b/runit-2.2.0/src/buffer_put.c +index 23164b3..be429c3 100644 +--- a/runit-2.2.0/src/buffer_put.c ++++ b/runit-2.2.0/src/buffer_put.c +@@ -5,7 +5,7 @@ + #include "byte.h" + #include "error.h" + +-static int allwrite(int (*op)(),int fd,const char *buf,unsigned int len) ++static int allwrite(int (*op)(int,char*,unsigned int),int fd,const char *buf,unsigned int len) + { + int w; + +diff --git a/runit-2.2.0/src/buffer_write.c b/runit-2.2.0/src/buffer_write.c +index 4ba13ef..7578774 100644 +--- a/runit-2.2.0/src/buffer_write.c ++++ b/runit-2.2.0/src/buffer_write.c +@@ -3,7 +3,7 @@ + #include <unistd.h> + #include "buffer.h" + +-int buffer_unixwrite(int fd,const char *buf,unsigned int len) ++int buffer_unixwrite(int fd,/* const */char *buf,unsigned int len) + { + return write(fd,buf,len); + } +diff --git a/runit-2.2.0/src/byte.h b/runit-2.2.0/src/byte.h +index 09aab61..0e92d3a 100644 +--- a/runit-2.2.0/src/byte.h ++++ b/runit-2.2.0/src/byte.h +@@ -3,12 +3,11 @@ + #ifndef BYTE_H + #define BYTE_H + +-extern unsigned int byte_chr(); +-extern unsigned int byte_rchr(); +-extern void byte_copy(); +-extern void byte_copyr(); +-extern int byte_diff(); +-extern void byte_zero(); ++extern unsigned int byte_chr(char *,unsigned int,int); ++extern unsigned int byte_rchr(char *,unsigned int, int); ++extern void byte_copy(char *,unsigned int,const char *); ++extern void byte_copyr(char *,register unsigned int,const char *); ++extern int byte_diff(const char *,register unsigned int,const char *); + + #define byte_equal(s,n,t) (!byte_diff((s),(n),(t))) + +diff --git a/runit-2.2.0/src/byte_chr.c b/runit-2.2.0/src/byte_chr.c +index fd56056..073a4ea 100644 +--- a/runit-2.2.0/src/byte_chr.c ++++ b/runit-2.2.0/src/byte_chr.c +@@ -2,10 +2,7 @@ + + #include "byte.h" + +-unsigned int byte_chr(s,n,c) +-char *s; +-register unsigned int n; +-int c; ++unsigned int byte_chr(char *s, register unsigned int n, int c) + { + register char ch; + register char *t; +diff --git a/runit-2.2.0/src/byte_copy.c b/runit-2.2.0/src/byte_copy.c +index 74c9e4a..e9abdb0 100644 +--- a/runit-2.2.0/src/byte_copy.c ++++ b/runit-2.2.0/src/byte_copy.c +@@ -2,10 +2,7 @@ + + #include "byte.h" + +-void byte_copy(to,n,from) +-register char *to; +-register unsigned int n; +-register char *from; ++void byte_copy(register char *to,register unsigned int n,const register char *from) + { + for (;;) { + if (!n) return; *to++ = *from++; --n; +diff --git a/runit-2.2.0/src/byte_cr.c b/runit-2.2.0/src/byte_cr.c +index 52dc251..4844dbe 100644 +--- a/runit-2.2.0/src/byte_cr.c ++++ b/runit-2.2.0/src/byte_cr.c +@@ -2,10 +2,7 @@ + + #include "byte.h" + +-void byte_copyr(to,n,from) +-register char *to; +-register unsigned int n; +-register char *from; ++void byte_copyr(register char *to,register unsigned int n,const register char *from) + { + to += n; + from += n; +diff --git a/runit-2.2.0/src/byte_diff.c b/runit-2.2.0/src/byte_diff.c +index 0c4d17b..24a7b3c 100644 +--- a/runit-2.2.0/src/byte_diff.c ++++ b/runit-2.2.0/src/byte_diff.c +@@ -2,10 +2,7 @@ + + #include "byte.h" + +-int byte_diff(s,n,t) +-register char *s; +-register unsigned int n; +-register char *t; ++int byte_diff(const register char *s,register unsigned int n,const register char *t) + { + for (;;) { + if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; +diff --git a/runit-2.2.0/src/byte_rchr.c b/runit-2.2.0/src/byte_rchr.c +index 7ea9948..b761837 100644 +--- a/runit-2.2.0/src/byte_rchr.c ++++ b/runit-2.2.0/src/byte_rchr.c +@@ -2,10 +2,7 @@ + + #include "byte.h" + +-unsigned int byte_rchr(s,n,c) +-char *s; +-register unsigned int n; +-int c; ++unsigned int byte_rchr(char *s,register unsigned int n,int c) + { + register char ch; + register char *t; +diff --git a/runit-2.2.0/src/pathexec_env.c b/runit-2.2.0/src/pathexec_env.c +index f873094..86dfec3 100644 +--- a/runit-2.2.0/src/pathexec_env.c ++++ b/runit-2.2.0/src/pathexec_env.c +@@ -65,7 +65,7 @@ void pathexec_env_run(const char *file, char *const *argv) + e[elen] = 0; + + pathexec_run(file,argv,e); +- alloc_free(e); ++ alloc_free((char *) e); + } + + void pathexec(char *const *argv) +diff --git a/runit-2.2.0/src/runit.c b/runit-2.2.0/src/runit.c +index cc50404..174b226 100644 +--- a/runit-2.2.0/src/runit.c ++++ b/runit-2.2.0/src/runit.c +@@ -33,23 +33,23 @@ int sigi =0; + int sigp =0; + int siga =0; + +-void sig_cont_handler (void) { ++void sig_cont_handler (int s) { + sigc++; + write(selfpipe[1], "", 1); + } +-void sig_int_handler (void) { ++void sig_int_handler (int s) { + sigi++; + write(selfpipe[1], "", 1); + } +-void sig_pwr_handler (void) { ++void sig_pwr_handler (int s) { + sigp++; + write(selfpipe[1], "", 1); + } +-void sig_alarm_handler (void) { ++void sig_alarm_handler (int s) { + siga++; + write(selfpipe[1], "", 1); + } +-void sig_child_handler (void) { write(selfpipe[1], "", 1); } ++void sig_child_handler (int s) { write(selfpipe[1], "", 1); } + + void sync_if_needed() { + struct stat s; +diff --git a/runit-2.2.0/src/runsv.c b/runit-2.2.0/src/runsv.c +index f2bf9c3..c66e0a3 100644 +--- a/runit-2.2.0/src/runsv.c ++++ b/runit-2.2.0/src/runsv.c +@@ -84,8 +84,8 @@ void warnx(char *m1, char *m2, char *m3) { + + void stopservice(struct svdir *); + +-void s_child() { write(selfpipe[1], "", 1); } +-void s_term() { ++void s_child(int s) { write(selfpipe[1], "", 1); } ++void s_term(int s) { + sigterm =1; + write(selfpipe[1], "", 1); /* XXX */ + } +diff --git a/runit-2.2.0/src/runsvdir.c b/runit-2.2.0/src/runsvdir.c +index d32feb0..b74dd18 100644 +--- a/runit-2.2.0/src/runsvdir.c ++++ b/runit-2.2.0/src/runsvdir.c +@@ -59,9 +59,9 @@ void warn(char *m1, char *m2) { + void warn3x(char *m1, char *m2, char *m3) { + strerr_warn6("runsvdir ", svdir, ": warning: ", m1, m2, m3, 0); + } +-void s_term() { exitsoon =1; } +-void s_hangup() { exitsoon =2; } +-void s_alarm() { siga = 1; } ++void s_term(int s) { exitsoon =1; } ++void s_hangup(int s) { exitsoon =2; } ++void s_alarm(int s) { siga = 1; } + + void report_forced_rescan() { + struct taia stamp; +diff --git a/runit-2.2.0/src/select.h2 b/runit-2.2.0/src/select.h2 +index 4bd4fcf..b7ac8c9 100644 +--- a/runit-2.2.0/src/select.h2 ++++ b/runit-2.2.0/src/select.h2 +@@ -8,6 +8,5 @@ + #include <sys/types.h> + #include <sys/time.h> + #include <sys/select.h> +-extern int select(); + + #endif +diff --git a/runit-2.2.0/src/sig.c b/runit-2.2.0/src/sig.c +index 7db3f4a..3ad0d1e 100644 +--- a/runit-2.2.0/src/sig.c ++++ b/runit-2.2.0/src/sig.c +@@ -16,5 +16,5 @@ int sig_pipe = SIGPIPE; + int sig_pwr = SIGPWR; + int sig_term = SIGTERM; + +-void (*sig_defaulthandler)() = SIG_DFL; +-void (*sig_ignorehandler)() = SIG_IGN; ++void (*sig_defaulthandler)(int) = SIG_DFL; ++void (*sig_ignorehandler)(int) = SIG_IGN; +diff --git a/runit-2.2.0/src/sig.h b/runit-2.2.0/src/sig.h +index 0ced62d..b3c93c0 100644 +--- a/runit-2.2.0/src/sig.h ++++ b/runit-2.2.0/src/sig.h +@@ -12,10 +12,10 @@ extern int sig_pipe; + extern int sig_pwr; + extern int sig_term; + +-extern void (*sig_defaulthandler)(); +-extern void (*sig_ignorehandler)(); ++extern void (*sig_defaulthandler)(int); ++extern void (*sig_ignorehandler)(int); + +-extern void sig_catch(int,void (*)()); ++extern void sig_catch(int,void (*)(int)); + #define sig_ignore(s) (sig_catch((s),sig_ignorehandler)) + #define sig_uncatch(s) (sig_catch((s),sig_defaulthandler)) + +diff --git a/runit-2.2.0/src/sig_catch.c b/runit-2.2.0/src/sig_catch.c +index 7b5bd89..aa2af50 100644 +--- a/runit-2.2.0/src/sig_catch.c ++++ b/runit-2.2.0/src/sig_catch.c +@@ -4,7 +4,7 @@ + #include "sig.h" + #include "hassgact.h" + +-void sig_catch(int sig,void (*f)()) ++void sig_catch(int sig,void (*f)(int)) + { + #ifdef HASSIGACTION + struct sigaction sa; +diff --git a/runit-2.2.0/src/svlogd.c b/runit-2.2.0/src/svlogd.c +index f1720ce..b747f24 100644 +--- a/runit-2.2.0/src/svlogd.c ++++ b/runit-2.2.0/src/svlogd.c +@@ -616,11 +616,11 @@ int buffer_pread(int fd, char *s, unsigned int len) { + if (i > 0) linecomplete =(s[i -1] == '\n'); + return(i); + } +-void sig_term_handler(void) { ++void sig_term_handler(int s) { + if (verbose) strerr_warn2(INFO, "sigterm received.", 0); + exitasap =1; + } +-void sig_child_handler(void) { ++void sig_child_handler(int s) { + int pid, l; + + if (verbose) strerr_warn2(INFO, "sigchild received.", 0); +@@ -632,11 +632,11 @@ void sig_child_handler(void) { + break; + } + } +-void sig_alarm_handler(void) { ++void sig_alarm_handler(int s) { + if (verbose) strerr_warn2(INFO, "sigalarm received.", 0); + rotateasap =1; + } +-void sig_hangup_handler(void) { ++void sig_hangup_handler(int s) { + if (verbose) strerr_warn2(INFO, "sighangup received.", 0); + reopenasap =1; + } +diff --git a/runit-2.2.0/src/wait.h b/runit-2.2.0/src/wait.h +index d294e9d..2fb886c 100644 +--- a/runit-2.2.0/src/wait.h ++++ b/runit-2.2.0/src/wait.h +@@ -3,10 +3,8 @@ + #ifndef WAIT_H + #define WAIT_H + +-extern int wait_pid(); +-extern int wait_nohang(); +-extern int wait_stop(); +-extern int wait_stopnohang(); ++extern int wait_pid(int *wstat, int pid); ++extern int wait_nohang(int *wstat); + + #define wait_crashed(w) ((w) & 127) + #define wait_exitcode(w) ((w) >> 8) +diff --git a/runit-2.2.0/src/wait_nohang.c b/runit-2.2.0/src/wait_nohang.c +index 5c9c53d..27d6e17 100644 +--- a/runit-2.2.0/src/wait_nohang.c ++++ b/runit-2.2.0/src/wait_nohang.c +@@ -4,7 +4,7 @@ + #include <sys/wait.h> + #include "haswaitp.h" + +-int wait_nohang(wstat) int *wstat; ++int wait_nohang(int *wstat) + { + #ifdef HASWAITPID + return waitpid(-1,wstat,WNOHANG); +diff --git a/runit-2.2.0/src/wait_pid.c b/runit-2.2.0/src/wait_pid.c +index c2869b8..fe0d9e1 100644 +--- a/runit-2.2.0/src/wait_pid.c ++++ b/runit-2.2.0/src/wait_pid.c +@@ -7,7 +7,7 @@ + + #ifdef HASWAITPID + +-int wait_pid(wstat,pid) int *wstat; int pid; ++int wait_pid(int *wstat, int pid) + { + int r; + +@@ -24,7 +24,7 @@ int wait_pid(wstat,pid) int *wstat; int pid; + static int oldpid = 0; + static int oldwstat; /* defined if(oldpid) */ + +-int wait_pid(wstat,pid) int *wstat; int pid; ++int wait_pid(int *wstat, int pid) + { + int r; + diff --git a/debian/patches/series b/debian/patches/series index 33c44ee..cc23870 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -11,3 +11,4 @@ 0026-runsvchdir-get-dir-from-env.patch 0027-runsv.c-sv.c-properly-wait-for-log-on-exit.patch 0028-sv.c-man-sv.8-exit-111-on-timeout-check-wait-for-req-status.patch +0029-C23-swap-ANSI-for-remaining-K-R-style-declarations.patch -- 2.51.0

