From aba880f759d649bddbc1bafef9c4a8b7486b8d10 Mon Sep 17 00:00:00 2001 From: John Vogel Date: Sat, 14 Dec 2024 00:40:59 -0500 Subject: local/cvsps: new aport --- cvsps/01_ignoretrunk.patch | 16 ++++ cvsps/02_dynamicbufferalloc.patch | 117 +++++++++++++++++++++++++++++ cvsps/03_diffoptstypo.patch | 13 ++++ cvsps/05-inet_addr_fix.patch | 13 ++++ cvsps/06-discard-extra-version-lines.patch | 27 +++++++ cvsps/APKBUILD | 56 ++++++++++++++ cvsps/fix-makefile.patch | 27 +++++++ cvsps/fix-manpage.patch | 18 +++++ cvsps/memfrob_is_glibc.patch | 12 +++ 9 files changed, 299 insertions(+) create mode 100644 cvsps/01_ignoretrunk.patch create mode 100644 cvsps/02_dynamicbufferalloc.patch create mode 100644 cvsps/03_diffoptstypo.patch create mode 100644 cvsps/05-inet_addr_fix.patch create mode 100644 cvsps/06-discard-extra-version-lines.patch create mode 100644 cvsps/APKBUILD create mode 100644 cvsps/fix-makefile.patch create mode 100644 cvsps/fix-manpage.patch create mode 100644 cvsps/memfrob_is_glibc.patch (limited to 'cvsps') 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: +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: +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) ++ { ++ 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: +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