summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Vogel <jvogel@stygian.me>2024-12-14 00:40:59 -0500
committerJohn Vogel <jvogel@stygian.me>2024-12-14 00:40:59 -0500
commitaba880f759d649bddbc1bafef9c4a8b7486b8d10 (patch)
tree486299c85163c9fad6493f8a53a492455dd7c112
parent7ee4e89dd35826f5ca04309ae1368f2967356d76 (diff)
downloadmy-aports-aba880f759d649bddbc1bafef9c4a8b7486b8d10.tar.gz
local/cvsps: new aport
-rw-r--r--cvsps/01_ignoretrunk.patch16
-rw-r--r--cvsps/02_dynamicbufferalloc.patch117
-rw-r--r--cvsps/03_diffoptstypo.patch13
-rw-r--r--cvsps/05-inet_addr_fix.patch13
-rw-r--r--cvsps/06-discard-extra-version-lines.patch27
-rw-r--r--cvsps/APKBUILD56
-rw-r--r--cvsps/fix-makefile.patch27
-rw-r--r--cvsps/fix-manpage.patch18
-rw-r--r--cvsps/memfrob_is_glibc.patch12
9 files changed, 299 insertions, 0 deletions
diff --git a/cvsps/01_ignoretrunk.patch b/cvsps/01_ignoretrunk.patch
new file mode 100644
index 0000000..2f58ddb
--- /dev/null
+++ b/cvsps/01_ignoretrunk.patch
@@ -0,0 +1,16 @@
+Author: <crafterm@debian.org>
+Description: Ignore TRUNK branch name patch
+--- a/cvsps.c
++++ b/cvsps.c
+@@ -2104,6 +2104,11 @@
+
+ if (!get_branch_ext(rev, eot, &leaf))
+ {
++ if (strcmp(tag, "TRUNK") == 0)
++ {
++ debug(DEBUG_STATUS, "ignoring the TRUNK branch/tag");
++ return;
++ }
+ debug(DEBUG_APPERROR, "malformed revision");
+ exit(1);
+ }
diff --git a/cvsps/02_dynamicbufferalloc.patch b/cvsps/02_dynamicbufferalloc.patch
new file mode 100644
index 0000000..abedad6
--- /dev/null
+++ b/cvsps/02_dynamicbufferalloc.patch
@@ -0,0 +1,117 @@
+Author: <crafterm@debian.org>
+Description: Dynamic buffer allocation
+--- a/cache.c
++++ b/cache.c
+@@ -108,10 +108,19 @@
+ int tag_flags = 0;
+ char branchbuff[LOG_STR_MAX] = "";
+ int branch_add = 0;
+- char logbuff[LOG_STR_MAX] = "";
++ int logbufflen = LOG_STR_MAX + 1;
++ char * logbuff = malloc(logbufflen);
+ time_t cache_date = -1;
+ int read_version;
+
++ if (logbuff == NULL)
++ {
++ debug(DEBUG_SYSERROR, "could not malloc %d bytes for logbuff in read_cache", logbufflen);
++ exit(1);
++ }
++
++ logbuff[0] = 0;
++
+ if (!(fp = cache_open("r")))
+ goto out;
+
+@@ -299,8 +308,19 @@
+ else
+ {
+ /* Make sure we have enough in the buffer */
+- if (strlen(logbuff)+strlen(buff)<LOG_STR_MAX)
+- strcat(logbuff, buff);
++ int len = strlen(buff);
++ if (strlen(logbuff) + len >= LOG_STR_MAX)
++ {
++ logbufflen += (len >= LOG_STR_MAX ? (len+1) : LOG_STR_MAX);
++ char * newlogbuff = realloc(logbuff, logbufflen);
++ if (newlogbuff == NULL)
++ {
++ debug(DEBUG_SYSERROR, "could not realloc %d bytes for logbuff in read_cache", logbufflen);
++ exit(1);
++ }
++ logbuff = newlogbuff;
++ }
++ strcat(logbuff, buff);
+ }
+ break;
+ case CACHE_NEED_PS_MEMBERS:
+@@ -332,6 +352,7 @@
+ out_close:
+ fclose(fp);
+ out:
++ free(logbuff);
+ return cache_date;
+ }
+
+--- a/cvsps.c
++++ b/cvsps.c
+@@ -265,7 +265,8 @@
+ PatchSetMember * psm = NULL;
+ char datebuff[20];
+ char authbuff[AUTH_STR_MAX];
+- char logbuff[LOG_STR_MAX + 1];
++ int logbufflen = LOG_STR_MAX + 1;
++ char * logbuff = malloc(logbufflen);
+ int loglen = 0;
+ int have_log = 0;
+ char cmd[BUFSIZ];
+@@ -273,6 +274,12 @@
+ char use_rep_buff[PATH_MAX];
+ char * ltype;
+
++ if (logbuff == NULL)
++ {
++ debug(DEBUG_SYSERROR, "could not malloc %d bytes for logbuff in load_from_cvs", logbufflen);
++ exit(1);
++ }
++
+ if (!no_rlog && !test_log_file && cvs_check_cap(CAP_HAVE_RLOG))
+ {
+ ltype = "rlog";
+@@ -480,24 +487,22 @@
+ */
+ if (have_log || !is_revision_metadata(buff))
+ {
+- /* if the log buffer is full, that's it.
+- *
+- * Also, read lines (fgets) always have \n in them
+- * which we count on. So if truncation happens,
+- * be careful to put a \n on.
+- *
+- * Buffer has LOG_STR_MAX + 1 for room for \0 if
+- * necessary
+- */
+- if (loglen < LOG_STR_MAX)
++ /* If the log buffer is full, try to reallocate more. */
++ if (loglen < logbufflen)
+ {
+ int len = strlen(buff);
+
+- if (len >= LOG_STR_MAX - loglen)
++ if (len >= logbufflen - loglen)
+ {
+- debug(DEBUG_APPMSG1, "WARNING: maximum log length exceeded, truncating log");
+- len = LOG_STR_MAX - loglen;
+- buff[len - 1] = '\n';
++ debug(DEBUG_STATUS, "reallocating logbufflen to %d bytes for file %s", logbufflen, file->filename);
++ logbufflen += (len >= LOG_STR_MAX ? (len+1) : LOG_STR_MAX);
++ char * newlogbuff = realloc(logbuff, logbufflen);
++ if (newlogbuff == NULL)
++ {
++ debug(DEBUG_SYSERROR, "could not realloc %d bytes for logbuff in load_from_cvs", logbufflen);
++ exit(1);
++ }
++ logbuff = newlogbuff;
+ }
+
+ debug(DEBUG_STATUS, "appending %s to log", buff);
diff --git a/cvsps/03_diffoptstypo.patch b/cvsps/03_diffoptstypo.patch
new file mode 100644
index 0000000..91771c5
--- /dev/null
+++ b/cvsps/03_diffoptstypo.patch
@@ -0,0 +1,13 @@
+Author: <crafterm@debian.org>
+Description: Diff opts typo fix
+--- a/cvsps.1
++++ b/cvsps.1
+@@ -83,7 +83,7 @@
+ disable the use of rlog internally. Note: rlog is
+ required for stable PatchSet numbering. Use with care.
+ .TP
+-.B \-\-diffs\-opts <option string>
++.B \-\-diff\-opts <option string>
+ send a custom set of options to diff, for example to increase
+ the number of context lines, or change the diff format.
+ .TP
diff --git a/cvsps/05-inet_addr_fix.patch b/cvsps/05-inet_addr_fix.patch
new file mode 100644
index 0000000..ae333ac
--- /dev/null
+++ b/cvsps/05-inet_addr_fix.patch
@@ -0,0 +1,13 @@
+Author: Iustin Pop <iusty@k1024.org>
+Description: Fix the inet_addr result check with correct type casting
+--- a/cbtcommon/tcpsocket.c
++++ b/cbtcommon/tcpsocket.c
+@@ -198,7 +198,7 @@
+ memcpy(dest, &ip.s_addr, sizeof(ip.s_addr));
+ }
+ #else
+- if ( (*dest = inet_addr(addr_str)) != -1)
++ if ( (*dest = inet_addr(addr_str)) != (in_addr_t)-1)
+ {
+ /* nothing */
+ }
diff --git a/cvsps/06-discard-extra-version-lines.patch b/cvsps/06-discard-extra-version-lines.patch
new file mode 100644
index 0000000..7dcce62
--- /dev/null
+++ b/cvsps/06-discard-extra-version-lines.patch
@@ -0,0 +1,27 @@
+Subject: Discard extra "M" lines in response to "version"
+From: Richard Hansen <ubuntu-a7x@scientician.org>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1413084
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775883
+
+Some CVS servers print more than one "M" line in response to a
+"version" command. For example:
+
+Client: version
+Server: M Concurrent Versions System (CVS) 1.12.13 (client/server)
+Server: M with CVSACL Patch 1.2.5 (cvsacl.sourceforge.net)
+Server: ok
+
+This patch causes cvsps to consume all such lines rather than fail.
+
+--- a/cvs_direct.c
++++ b/cvs_direct.c
+@@ -916,7 +916,8 @@
+ else
+ debug(DEBUG_APPERROR, "cvs_direct: didn't read version: %s", lbuff);
+
+- read_line(ctx, lbuff);
++ while (strncmp(lbuff, "M ", 2) == 0)
++ read_line(ctx, lbuff);
+ if (strcmp(lbuff, "ok") != 0)
+ debug(DEBUG_APPERROR, "cvs_direct: protocol error reading version");
+
diff --git a/cvsps/APKBUILD b/cvsps/APKBUILD
new file mode 100644
index 0000000..863151a
--- /dev/null
+++ b/cvsps/APKBUILD
@@ -0,0 +1,56 @@
+# Maintainer: John Vogel <jvogel4@stny.rr.com>
+maintainer="John Vogel <jvogel4@stny.rr.com>"
+pkgname=cvsps
+pkgver=2.1
+#pkgver=2.2_beta1
+#_pkgver=${pkgver/_beta/b}
+#pkgver=2.1_git20080331
+#_commit=1a680d69dd39346bdf3674c6cb2460e11e15c7d2
+#_commit=1a680d6
+pkgrel=0
+pkgdesc="generate patchset information from a CVS repository"
+url="https://cvsps.sourceforge.net/"
+arch="all"
+license="GPL-2.0-or-later"
+depends="cvs"
+makedepends="zlib-dev"
+subpackages="$pkgname-doc"
+source="https://sourceforge.net/projects/cvsps/files/cvsps-$pkgver.tar.gz
+ 01_ignoretrunk.patch
+ 02_dynamicbufferalloc.patch
+ 03_diffoptstypo.patch
+ 05-inet_addr_fix.patch
+ fix-makefile.patch
+ fix-manpage.patch
+ 06-discard-extra-version-lines.patch
+ memfrob_is_glibc.patch
+ "
+#source="https://sourceforge.net/projects/cvsps/files/cvsps-$_pkgver.tar.gz
+# increase_log_length_limit.patch
+# no_memfrob.patch"
+# fix_protocol_error_reading_version.patch
+#source="$pkgname-$_commit.tar.gz::https://repo.or.cz/cvsps-yd.git/snapshot/$_commit.tar.gz
+# no_memfrob.patch"
+options="!check" # no tests
+#builddir="$srcdir/cvsps-yd-$_commit"
+#builddir="$srcdir/cvsps-$_pkgver"
+
+build() {
+ make
+}
+
+package() {
+ make prefix="$pkgdir"/usr install
+}
+
+sha512sums="
+8ba703fc4dd1c7a8201f4cefec533a6e228943f53f5380d8d17107718d8cb607c861a733d7ad1d6ed9288c4dbeae9fd59ceaf52172f16885a00d000a667e0e38 cvsps-2.1.tar.gz
+ae15479ffcf7ee66bcebe86df889d976f7b16d25e879a4bb442d069fb913f20b27b3d3f063007c4124b7919e97b8657ab976819d4f9c53df1d390d27f36eed8d 01_ignoretrunk.patch
+3235dd13ec121f3af0dc2f9d6c1b7552f0fb3d995957bdd93b537ec75c478fa3b28c7aedd68fb057f1ad4ebdcd43aa9b150b1e1d3589216397285e40fc1d0a52 02_dynamicbufferalloc.patch
+171e5843fe86e7b0723c2676a56ff14b75e7a9636db7503602b7ae4a6cbc7f08033895603f75e88759c18957391b9fac8df2b61be63c23aabd368a094fa42d11 03_diffoptstypo.patch
+8614a016ecaa34ea87b231308fc064fd32526125fd3b839b28fa040b479b200b0a7db0ba2e0975bba048ef6c20faa9abafcf20df8be8e57a7d7ba5f78269877b 05-inet_addr_fix.patch
+8e38a45a411e0fbb73ae9686464a55306256271dc291823072237ab64a70c429cd51b22e0cca258f552e72422e2d34c415f592980fe0d500aa647449eb7a87f2 fix-makefile.patch
+098e72f3950f306956b78d6225a87108f878a7b7fdf4132ca752ce2e45e59b0592ba3b689ce8566350492fa245992d028c2b437b306ffc1c1fe407add967be8c fix-manpage.patch
+566c28c13b2eb8599006d4bfdabc9263e19528e00f05bfec07ef96f022bcd128c152fe03c3ebc3f12d405f17c6210b5f6584135218d962c2fc352341323471a1 06-discard-extra-version-lines.patch
+00651cf1f00b3ef21111afabec93d8ca3849272d6ef61c8b9d06f5db68cd0134508606f00033a936acc7fcc338f5cc15178a36811222788e4ced7aceebb340b7 memfrob_is_glibc.patch
+"
diff --git a/cvsps/fix-makefile.patch b/cvsps/fix-makefile.patch
new file mode 100644
index 0000000..66c90f6
--- /dev/null
+++ b/cvsps/fix-makefile.patch
@@ -0,0 +1,27 @@
+Description: - Fix upstream Makefile and add hardening.
+ - Fix destination install directory.
+Author: Giovani Agusuto Ferreira <giovani@riseup.net>
+Last-Update: 2015-09-07Index: cvsps-2.1/Makefile
+===================================================================
+Index: cvsps-2.1/Makefile
+===================================================================
+--- cvsps-2.1.orig/Makefile
++++ cvsps-2.1/Makefile
+@@ -3,7 +3,7 @@ MINOR=1
+ CC?=gcc
+ CFLAGS?=-g -O2 -Wall
+ CFLAGS+=-I. -DVERSION=\"$(MAJOR).$(MINOR)\"
+-prefix?=/usr/local
++prefix?=/usr
+ OBJS=\
+ cbtcommon/debug.o\
+ cbtcommon/hash.o\
+@@ -21,7 +21,7 @@ OBJS=\
+ all: cvsps
+
+ cvsps: $(OBJS)
+- $(CC) -o cvsps $(OBJS) -lz
++ $(CC) $(LDFLAGS) -o cvsps $(OBJS) -lz
+
+ install:
+ [ -d $(prefix)/bin ] || mkdir -p $(prefix)/bin
diff --git a/cvsps/fix-manpage.patch b/cvsps/fix-manpage.patch
new file mode 100644
index 0000000..7d7cae2
--- /dev/null
+++ b/cvsps/fix-manpage.patch
@@ -0,0 +1,18 @@
+Description: - Fix a sentense on the manpage
+Author: Giovani Agusuto Ferreira <giovani@riseup.net>
+Last-Update: 2015-09-07
+Index: cvsps-2.1/cvsps.1
+===================================================================
+--- cvsps-2.1.orig/cvsps.1
++++ cvsps-2.1/cvsps.1
+@@ -10,8 +10,8 @@ repository. A patchset in this case is
+ to a collection of files, and all committed at the same time (using a
+ single 'cvs commit' command). This information is valuable to seeing the
+ big picture of the evolution of a cvs project. While cvs tracks revision
+-information, it is often difficult to see what changes were committed
+-'atomically' to the repository.
++information, it is often difficult to see what changes were committed 'atomically'
++to the repository.
+ .SH OPTIONS
+ .TP
+ .B \-h
diff --git a/cvsps/memfrob_is_glibc.patch b/cvsps/memfrob_is_glibc.patch
new file mode 100644
index 0000000..2b7484e
--- /dev/null
+++ b/cvsps/memfrob_is_glibc.patch
@@ -0,0 +1,12 @@
+diff -Naur a/cbtcommon/text_util.c b/cbtcommon/text_util.c
+--- a/cbtcommon/text_util.c 2024-12-12 20:29:31.441879464 -0500
++++ b/cbtcommon/text_util.c 2024-12-12 20:31:38.750121556 -0500
+@@ -236,7 +236,7 @@
+ }
+ }
+
+-#ifdef linux
++#ifdef __GLIBC__
+ extern void *memfrob(void *, size_t);
+ #else
+ static void * memfrob(void * mem, size_t len)