rpms/cvsps/F-11 cvsps-2.2b1-dynamic-logbuf.patch, NONE, 1.1 cvsps.spec, 1.9, 1.10
Ville Skyttä
scop at fedoraproject.org
Thu Aug 6 19:01:58 UTC 2009
- Previous message (by thread): rpms/kernel/devel drm-hush-vblank-warning.patch, NONE, 1.1 kernel.spec, 1.1697, 1.1698
- Next message (by thread): rpms/perl-Email-MIME-Modifier/devel .cvsignore, 1.7, 1.8 perl-Email-MIME-Modifier.spec, 1.11, 1.12 sources, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: scop
Update of /cvs/pkgs/rpms/cvsps/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13873
Modified Files:
cvsps.spec
Added Files:
cvsps-2.2b1-dynamic-logbuf.patch
Log Message:
* Thu Aug 6 2009 Ville Skyttä <ville.skytta at iki.fi> - 2.2-0.4.b1
- Apply David D. Kilzer's dynamic log buffer allocation patch (#516083,
Andreas Schwab).
- Use %global instead of %define.
cvsps-2.2b1-dynamic-logbuf.patch:
cache.c | 27 ++++++++++++++++++++++++---
cvsps.c | 36 ++++++++++++++++++++----------------
2 files changed, 44 insertions(+), 19 deletions(-)
--- NEW FILE cvsps-2.2b1-dynamic-logbuf.patch ---
# From: http://ydirson.free.fr/soft/git/cvsps.git
commit 76a9c2aaa0d2957de0bc8f0c0b994abfd1645a50
Author: David D. Kilzer <ddkilzer at kilzer.net>
Date: Mon Jun 20 01:04:34 2005 +0200
Dynamically allocate the log buffer to prevent warning messages
On anoncvs.opensource.apple.com (Apple's anonymous CVS server for
WebKit), some very long log entries were included in CVS. I got tired
of cvsps-2.1 truncating them, so I made the 'logbuff' buffer be
dynamically allocated.
diff --git i/cache.c w/cache.c
index 4c51cf7..01a8ed3 100644
--- i/cache.c
+++ w/cache.c
@@ -108,10 +108,19 @@ time_t read_cache()
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 @@ time_t read_cache()
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 @@ time_t read_cache()
out_close:
fclose(fp);
out:
+ free(logbuff);
return cache_date;
}
diff --git i/cvsps.c w/cvsps.c
index f0e7d29..db28d7c 100644
--- i/cvsps.c
+++ w/cvsps.c
@@ -269,7 +269,8 @@ static void load_from_cvs()
PatchSetMember * psm = NULL;
char datebuff[26];
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];
@@ -277,6 +278,12 @@ static void load_from_cvs()
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";
@@ -484,25 +491,22 @@ static void load_from_cvs()
*/
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
- * (unless truncation happens)
- * 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);
Index: cvsps.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cvsps/F-11/cvsps.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- cvsps.spec 24 Feb 2009 10:28:47 -0000 1.9
+++ cvsps.spec 6 Aug 2009 19:01:57 -0000 1.10
@@ -1,14 +1,16 @@
-%define prever b1
+%global prever b1
Name: cvsps
Version: 2.2
-Release: 0.2.%{prever}%{?dist}
+Release: 0.4.%{prever}%{?dist}
Summary: Patchset tool for CVS
Group: Development/Tools
License: GPL+
URL: http://www.cobite.com/cvsps/
Source0: http://www.cobite.com/cvsps/%{name}-%{version}%{prever}.tar.gz
+# #516083
+Patch0: %{name}-2.2b1-dynamic-logbuf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: zlib-devel
@@ -28,6 +30,7 @@ changes were committed 'atomically' to t
%prep
%setup -q -n %{name}-%{version}%{prever}
+%patch0 -p1
sed -i -e 's/diffs\\-opts/diff\\-opts/' cvsps.1
@@ -52,6 +55,14 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Aug 6 2009 Ville Skyttä <ville.skytta at iki.fi> - 2.2-0.4.b1
+- Apply David D. Kilzer's dynamic log buffer allocation patch (#516083,
+ Andreas Schwab).
+- Use %%global instead of %%define.
+
+* Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.2-0.3.b1
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.2-0.2.b1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
- Previous message (by thread): rpms/kernel/devel drm-hush-vblank-warning.patch, NONE, 1.1 kernel.spec, 1.1697, 1.1698
- Next message (by thread): rpms/perl-Email-MIME-Modifier/devel .cvsignore, 1.7, 1.8 perl-Email-MIME-Modifier.spec, 1.11, 1.12 sources, 1.7, 1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list