Post by patrick keshishianAttached is a patch implementing LOGM change against cvs-1.11.23
I=E2=80=99ve implemented it differently, especially in order to never
send partial lines to the client (in a network packet). If you
wish, have a look at / review the following patch.
I=E2=80=99m currently sanity.sh-testing it, this will take the night.
--- src/gnu/usr.bin/cvs/src/buffer.c:1.2=09Sat Oct 22 14:33:29 2016
+++ src/gnu/usr.bin/cvs/src/buffer.c=09Sat Nov 18 22:05:10 2017
@@ -1052,7 +1055,14 @@ buf_copy_lines (struct buffer *outbuf, s
=09}
=20
=09/* Put in the command. */
-=09buf_append_char (outbuf, command);
+=09switch (command) {
+=09case CVS_OUTPUT_EX_LOGM:
+=09=09buf_output0 (outbuf, "LOGM");
+=09=09break;
+=09default:
+=09=09buf_append_char (outbuf, command);
+=09=09break;
+=09}
=09buf_append_char (outbuf, ' ');
=20
=09if (inbuf->data !=3D nldata)
--- src/gnu/usr.bin/cvs/src/client.c:1.8=09Sat Aug 12 01:51:22 2017
+++ src/gnu/usr.bin/cvs/src/client.c=09Sat Nov 18 22:05:11 2017
@@ -3079,6 +3079,7 @@ struct response responses[] =3D
rs_optional),
RSP_LINE("M", handle_m, response_type_normal, rs_essential),
RSP_LINE("Mbinary", handle_mbinary, response_type_normal, rs_optional)=
,
+ RSP_LINE("LOGM", handle_m, response_type_normal, rs_optional),
RSP_LINE("E", handle_e, response_type_normal, rs_essential),
RSP_LINE("F", handle_f, response_type_normal, rs_optional),
RSP_LINE("MT", handle_mt, response_type_normal, rs_optional),
--- src/gnu/usr.bin/cvs/src/cvs.h:1.7=09Fri Oct 21 16:41:16 2016
+++ src/gnu/usr.bin/cvs/src/cvs.h=09Sat Nov 18 22:05:12 2017
@@ -920,11 +921,15 @@ void tag_check_valid (const char *, int,
=20
/* From server.c and documented there. */
void cvs_output (const char *, size_t);
+void cvs_output_ex (const char *, size_t, int);
void cvs_output_binary (char *, size_t);
void cvs_outerr (const char *, size_t);
void cvs_flusherr (void);
void cvs_flushout (void);
void cvs_output_tagged (const char *, const char *);
+int supported_response (const char *);
+
+#define CVS_OUTPUT_EX_LOGM=090x80000001
=20
extern const char *global_session_id;
=20
--- src/gnu/usr.bin/cvs/src/log.c:1.1.101.2=09Tue Apr 19 20:33:18 2005
+++ src/gnu/usr.bin/cvs/src/log.c=09Sat Nov 18 22:05:12 2017
@@ -145,6 +148,7 @@ static void log_version (struct log_data
=09=09=09=09RCSNode *, RCSVers *, int);
static int log_branch (Node *, void *);
static int version_compare (const char *, const char *, int);
+static void logm_output (const char *);
=20
static struct log_data log_data;
static int is_rlog;
@@ -1681,11 +1685,10 @@ log_version (struct log_data *log_data,=20
=09cvs_output ("*** empty log message ***\n", 0);
else
{
+=09/* assert: last thing cvs_output=E2=80=99ed was a newline */
=09/* FIXME: Technically, the log message could contain a null
byte. */
-=09cvs_output (p->data, 0);
-=09if (((char *)p->data)[strlen (p->data) - 1] !=3D '\n')
-=09 cvs_output ("\n", 1);
+=09logm_output(p->data);
}
}
=20
@@ -1780,3 +1783,23 @@ version_compare (const char *v1, const c
=09 ++v2;
}
}
+
+static void
+logm_output(const char *str)
+{
+=09/* assert: str is not empty */
+=09size_t len =3D strlen(str);
+=09int buftag =3D 'M';
+=09static char has_logm =3D 0;
+
+=09if (server_active) {
+=09=09if (!has_logm)
+=09=09=09has_logm =3D supported_response("LOGM") ? 1 : 2;
+=09=09if (has_logm =3D=3D 1)
+=09=09=09buftag =3D CVS_OUTPUT_EX_LOGM;
+=09}
+
+=09cvs_output_ex(str, len, buftag);
+=09if (/*len > 0 &&*/ str[len - 1] !=3D '\n')
+=09=09cvs_output_ex("\n", 1, buftag);
+}
--- src/gnu/usr.bin/cvs/src/server.c:1.14=09Sat Aug 12 01:08:25 2017
+++ src/gnu/usr.bin/cvs/src/server.c=09Sat Nov 18 22:05:12 2017
@@ -548,8 +553,8 @@ alloc_pending_warning (size_t size)
=20
=20
=20
-static int
-supported_response (char *name)
+int
+supported_response (const char *name)
{
struct response *rs;
=20
@@ -7703,6 +7708,12 @@ krb_encrypt_buffer_initialize( struct bu
void
cvs_output (const char *str, size_t len)
{
+ cvs_output_ex (str, len, 'M');
+}
+
+void
+cvs_output_ex (const char *str, size_t len, int buftag)
+{
if (len =3D=3D 0)
=09len =3D strlen (str);
#ifdef SERVER_SUPPORT
@@ -7711,7 +7722,7 @@ cvs_output (const char *str, size_t len)
=09if (buf_to_net)
=09{
=09 buf_output (saved_output, str, len);
-=09 buf_copy_lines (buf_to_net, saved_output, 'M');
+=09 buf_copy_lines (buf_to_net, saved_output, buftag);
=09}
# if HAVE_SYSLOG_H
=09else
@@ -7726,7 +7737,7 @@ cvs_output (const char *str, size_t len)
=09if (protocol)
=09{
=09 buf_output (saved_output, str, len);
-=09 buf_copy_lines (protocol, saved_output, 'M');
+=09 buf_copy_lines (protocol, saved_output, buftag);
=09 buf_send_counted (protocol);
=09}
# if HAVE_SYSLOG_H
bye,
//mirabilos
--=20
13:22=E2=8E=9C=C2=ABneurodamage=C2=BB mira, what's up man? I have a CVS que=
stion for you in #cvs
13:22=E2=8E=9C=C2=ABneurodamage=C2=BB since you're so good w. it =E2=94=82 =
=C2=ABneurodamage:#cvs=C2=BB i love you
13:28=E2=8E=9C=C2=ABneurodamage:#cvs=C2=BB you're a handy guy to have aroun=
d for systems stuff =E2=98=BA
16:06=E2=8E=9C<Draget:#cvs> Thank god I found you =3D) 20:03=E2=94=82=C2=
=ABbioe007:#cvs=C2=BB mira2k: ty
17:14=E2=8E=9C<ldiain:#cvs> Thanks big help you are :-) <bioe007> mira|nw=
t: ty again
18:35=E2=8E=9C=C2=ABalturiak:#cvs=C2=BB mirabilos: aw, nice. thanks :o
18:36=E2=8E=9C=C2=ABThunderChicken:#cvs=C2=BB mirabilos FTW! 23:03=E2=8E=
=9C=C2=ABmithraic:#cvs=C2=BB aaah. thanks
18:41=E2=8E=9C=C2=ABalturiak:#cvs=C2=BB phew. thanks a bunch, guys. you jus=
t made my weekend :-)
18:10=E2=8E=9C=C2=ABsumit:#cvs=C2=BB mirabilos: oh ok.. thanks for that
21:57=E2=8E=9C<bhuey:#cvs> yeah, I really appreciate help
18:50=E2=8E=9C=C2=ABgrndlvl:#cvs=C2=BB thankyou 18:50=E2=8E=9C=
=C2=ABgrndlvl:#cvs=C2=BB worked perfectly
20:50=E2=8E=9C<paolo:#cvs> i see. mirabilos, thnks for your support
00:36=E2=8E=9C=C2=ABhalirutan:#cvs=C2=BB ok, the obvious way:-) thx
18:44=E2=8E=9C=C2=ABarcfide:#cvs=C2=BB mirabilos, I am running OpenBSD. =
18:59=E2=8E=9C=C2=ABarcfide:#cvs=C2=BB
Hrm, yes, I see what you mean. 19:01=E2=8E=9C=C2=ABarcfide:#cvs=C2=BB Yeah,=
thanks for the help.
21:33=E2=8E=9C=C2=ABCardinalFang:#cvs=C2=BB Ugh. Okay. Sorry for the dumb=
question. Thank you
21:34=E2=8E=9C<centosian:#cvs> mirabilos: whoa that's sweet
21:52=E2=8E=9C=C2=ABgarrett__:#cvs=C2=BB much appreciated =C2=ABgarrett__:=
#cvs=C2=BB thanks for your time
23:39=E2=8E=9C<symons:#cvs> this worked, thank you very much 16:26=E2=8E=9C=
<schweizer:#cvs> ok
thx, i'll try that 20:00=E2=8E=9C=C2=ABstableable:#cvs=C2=BB Thank you.=
20:50=E2=8E=9C=C2=ABs833:#cvs=C2=BB
mirabilos: thanks a lot. 19:34=E2=8E=9C<bobbytek:#cvs> Thanks for co=
nfirming :)
20:08=E2=8E=9C<tsolox:#cvs> ...works like a charm.. thanks mirabilos