Ahem,

On Sat, 2021-01-09 at 21:08:20 +0100, Guillem Jover wrote:
> On Wed, 2013-05-29 at 05:20:54 +0200, Guillem Jover wrote:
> > Package: csh
> > Version: 20110502-2
> > Severity: wishlist
> > Tags: patch
> 
> > Here's a patch (only built tested) removing some of the delta with
> > upstream by using the libbsd overlay, which transparently augments
> > the system headers.
> > 
> > To apply the patch, you'll need to run «quilt pop -a» first.
> 
> Here's a refreshed patch, also built tested, with an additional
> definition for LIBBSD_OPENBSD_VIS, to make it possible to switch
> upstream the default prototype for the vis functions to the NetBSD
> variants, which while newer, have more widespread presence in the BSD
> world. Given that this codebase uses the OpenBSD variant, instead of
> switching it to the NetBSD variant and introducing additional delta,
> let's define this macro (which does not exist yet in libbsd, but will
> once the switch is performed, so backwards compat will be preserved).

And of course I missed attaching the new patch. :)

(BTW the salsa repo seems to be out-of-sync.)

Thanks,
Guillem
From cef55d938eace8d37c8f8c6100f72ba1cc93b357 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Sat, 9 Jan 2021 20:39:47 +0100
Subject: [PATCH] csh: Reduce delta by using more of libbsd

This change removes some of the delta with upstream by using the
libbsd overlay, which transparently augments the system headers.

Preemptively defines LIBBSD_OPENBSD_VIS to select the OpenBSD variant
for the vis functions which are going to switch default prototype to
the NetBSD variant in some future libbsd release.

Closes: #710209
---
 debian/control                           |  3 +-
 debian/patches/02_libbsd.diff            | 86 +++++-------------------
 debian/patches/04_fpurge.diff            | 19 ------
 debian/patches/06_time_h_for_time_t.diff | 14 ++--
 debian/patches/07_funopen.diff           | 16 +++--
 debian/patches/08_glob.diff              | 12 ++--
 debian/patches/series                    |  1 -
 7 files changed, 42 insertions(+), 109 deletions(-)
 delete mode 100644 debian/patches/04_fpurge.diff

diff --git a/debian/control b/debian/control
index 96f747e..78651ee 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,8 @@ Vcs-Browser: https://salsa.debian.org:/mckinstry/bsd-csh.git
 Vcs-Git: https://salsa.debian.org:/mckinstry/bsd-csh.git
 Build-Depends: debhelper-compat (= 13),
   groff, 
-  libbsd-dev, 
+  pkg-config,
+  libbsd-dev (>= 0.4.0),
   bmake (>= 20130730-2)
 
 Package: csh
diff --git a/debian/patches/02_libbsd.diff b/debian/patches/02_libbsd.diff
index 470131f..03f4df7 100644
--- a/debian/patches/02_libbsd.diff
+++ b/debian/patches/02_libbsd.diff
@@ -3,11 +3,22 @@ Forwarded: not-needed
 Author: Matej Vela <v...@debian.org>
 Last-Update: 2011-07-05
 
-Index: csh-20110502/Makefile
-===================================================================
---- csh-20110502.orig/Makefile
-+++ csh-20110502/Makefile
-@@ -14,6 +14,7 @@
+---
+ Makefile |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -8,12 +8,15 @@
+ PROG=	csh
+ DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
+ DFLAGS+=-D_GNU_SOURCE
++DFLAGS+=-DLIBBSD_OPENBSD_VIS
+ #CFLAGS+=-g
+ #CFLAGS+=-Wall
+-CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
++LIBBSD_CFLAGS!=pkg-config --cflags libbsd-overlay
++CFLAGS+=-I${.CURDIR} -I. ${DFLAGS} ${LIBBSD_CFLAGS}
  SRCS=	alloc.c char.c const.c csh.c dir.c dol.c error.c exec.c exp.c file.c \
  	func.c glob.c hist.c init.c lex.c misc.c parse.c proc.c \
  	sem.c set.c str.c time.c
@@ -15,68 +26,3 @@ Index: csh-20110502/Makefile
  
  CLEANFILES+=error.h const.h
  
-Index: csh-20110502/csh.c
-===================================================================
---- csh-20110502.orig/csh.c
-+++ csh-20110502/csh.c
-@@ -39,9 +39,10 @@
- #include <pwd.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <locale.h>
- #include <unistd.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- #include <stdarg.h>
- 
- #include "csh.h"
-Index: csh-20110502/dir.c
-===================================================================
---- csh-20110502.orig/dir.c
-+++ csh-20110502/dir.c
-@@ -35,6 +35,7 @@
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <unistd.h>
- #include <stdarg.h>
- 
-Index: csh-20110502/glob.c
-===================================================================
---- csh-20110502.orig/glob.c
-+++ csh-20110502/glob.c
-@@ -35,6 +35,7 @@
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <unistd.h>
- #include <stdarg.h>
- 
-Index: csh-20110502/sem.c
-===================================================================
---- csh-20110502.orig/sem.c
-+++ csh-20110502/sem.c
-@@ -37,6 +37,7 @@
- #include <fcntl.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <bsd/string.h>
- #include <unistd.h>
- #include <stdarg.h>
- 
-Index: csh-20110502/str.c
-===================================================================
---- csh-20110502.orig/str.c
-+++ csh-20110502/str.c
-@@ -39,7 +39,7 @@
- 
- #include <sys/types.h>
- #include <stdarg.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- 
- #include "csh.h"
- #include "extern.h"
diff --git a/debian/patches/04_fpurge.diff b/debian/patches/04_fpurge.diff
deleted file mode 100644
index b555ba2..0000000
--- a/debian/patches/04_fpurge.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-Description: Replace BSD-specific fpurge with GNU-specific __fpurge
-Forwarded: not-needed
-Author: Matej Vela <v...@debian.org>
-Last-Update: 2011-05-13
-
-Index: csh-20110313/csh.h
-===================================================================
---- csh-20110313.orig/csh.h
-+++ csh-20110313/csh.h
-@@ -96,6 +96,9 @@
- #include <stdio.h>
- FILE *cshin, *cshout, *csherr;
- 
-+#include <stdio_ext.h>
-+#define fpurge __fpurge
-+
- #define	isdir(d)	(S_ISDIR(d.st_mode))
- 
- typedef int bool;
diff --git a/debian/patches/06_time_h_for_time_t.diff b/debian/patches/06_time_h_for_time_t.diff
index e2fd5ce..862d876 100644
--- a/debian/patches/06_time_h_for_time_t.diff
+++ b/debian/patches/06_time_h_for_time_t.diff
@@ -3,13 +3,15 @@ Forwarded: not-needed
 Author: Matej Vela <v...@debian.org>
 Last-Update: 2011-07-05
 
-Index: csh-20110502/csh.c
-===================================================================
---- csh-20110502.orig/csh.c
-+++ csh-20110502/csh.c
-@@ -44,6 +44,7 @@
+---
+ csh.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/csh.c
++++ b/csh.c
+@@ -43,6 +43,7 @@
  #include <unistd.h>
- #include <bsd/vis.h>
+ #include <vis.h>
  #include <stdarg.h>
 +#include <time.h>
  
diff --git a/debian/patches/07_funopen.diff b/debian/patches/07_funopen.diff
index c020339..61d92d8 100644
--- a/debian/patches/07_funopen.diff
+++ b/debian/patches/07_funopen.diff
@@ -3,11 +3,13 @@ Forwarded: not-needed
 Author: Matej Vela <v...@debian.org>
 Last-Update: 2011-05-13
 
-Index: csh-20110313/csh.c
-===================================================================
---- csh-20110313.orig/csh.c
-+++ csh-20110313/csh.c
-@@ -81,10 +81,11 @@
+---
+ csh.c |   30 ++++++++++++++----------------
+ 1 file changed, 14 insertions(+), 16 deletions(-)
+
+--- a/csh.c
++++ b/csh.c
+@@ -80,10 +80,11 @@ bool    tellwhat = 0;
  
  extern char **environ;
  
@@ -22,7 +24,7 @@ Index: csh-20110313/csh.c
  static int	srccat(Char *, Char *);
  static int	srcfile(char *, bool, bool);
  static void	phup(int);
-@@ -189,14 +190,11 @@
+@@ -188,14 +189,11 @@ main(int argc, char *argv[])
       *	    Fortunately this is not needed under the current implementation
       *	    of stdio.
       */
@@ -40,7 +42,7 @@ Index: csh-20110313/csh.c
  	exit(1);
      (void) setvbuf(cshin,  NULL, _IOLBF, 0);
      (void) setvbuf(cshout, NULL, _IOLBF, 0);
-@@ -1210,23 +1208,23 @@
+@@ -1209,23 +1207,23 @@ gethdir(Char *home, int len)
   */
  #define DESC(a) (*((int *) (a)) - (didfds && *((int *) a) >= FSHIN ? FSHIN : 0))
  
diff --git a/debian/patches/08_glob.diff b/debian/patches/08_glob.diff
index 23057bc..c8a11ef 100644
--- a/debian/patches/08_glob.diff
+++ b/debian/patches/08_glob.diff
@@ -9,11 +9,13 @@ Forwarded: not-needed
 Author: Matej Vela <v...@debian.org>
 Last-Update: 2011-05-13
 
-Index: csh-20110502/glob.c
-===================================================================
---- csh-20110502.orig/glob.c
-+++ csh-20110502/glob.c
-@@ -370,46 +370,99 @@
+---
+ glob.c |  109 ++++++++++++++++++++++++++++++++++++++++++++++++-----------------
+ 1 file changed, 81 insertions(+), 28 deletions(-)
+
+--- a/glob.c
++++ b/glob.c
+@@ -369,46 +369,99 @@ handleone(Char *str, Char **vl, int acti
  static Char **
  libglob(Char **vl)
  {
diff --git a/debian/patches/series b/debian/patches/series
index 29c69c3..3c5c7ad 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,7 +1,6 @@
 01_gnu_source.diff
 02_libbsd.diff
 03_maxpathlen.diff
-04_fpurge.diff
 05_fhs_pathnames.diff
 06_time_h_for_time_t.diff
 07_funopen.diff
-- 
2.30.0

Reply via email to