bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cvs patches & notes


From: Rob Saccoccio
Subject: cvs patches & notes
Date: Fri, 13 Apr 2001 13:19:48 -0400

I've identified and fixed (or worked around) some issues with cvs and
thought I'd pass 'em along...

1. There's a "bogus kludge" in server.c wrapped by "#ifdef sun" that applies
to pretty old unpatched versions of SunOS.  Maybe an autoconf script could
be written to test for the condition that causes the problem.  I had a look
at when the OS patch was first released (and unfortunately don't recall the
details), but it was years ago.  A reasonable alternative may be to assume
the kludge isn't needed and suggest that if the problem arises the patch be
applied or SUNOS_KLUDGE be defined to enable the old behavior.

2. When operating in pserver mode, the loginfo scripts are invoked with a
file descriptor still open (10) which enables writing back to the client.
This is clearly an oversight.  I came across this as I was trying to get the
server to return without waiting for the loginfo scripts to complete.  In
turns out, the server is waiting on the closure of a FD (9) that is closed
in the helper client, but was passed to its children.  I have a detailed
truss if you'd like it.  I couldn't figure out the "right" place to close
the FD, so I now close it at the top of my scripts.

3. Below is a patch against 1.11 logmsg.c that allows loginfo scripts to
properly handle filenames with spaces.  Currently, the arguments are not
properly setup to handle this.  The patch is backward compatible.

--robs


--- logmsg.c    Fri Apr 13 12:38:43 2001
+++ new-logmsg.c        Fri Apr 13 12:38:26 2001
@@ -552,9 +552,9 @@
  * concatenate each filename/version onto str_list
  */
 static int
-title_proc (p, closure)
+title_proc (p, quote)
     Node *p;
-    void *closure;
+    void *quote;
 {
     struct logfile_info *li;
     char *c;
@@ -568,8 +568,9 @@
           You can verify that this assumption is safe by checking the
           code in add.c (add_directory) and import.c (import). */

-       str_list = xrealloc (str_list, strlen (str_list) + 5);
+       str_list = xrealloc (str_list, strlen (str_list) + 7);
        (void) strcat (str_list, " ");
+       (void) strcat (str_list, (char *)quote);

        if (li->type == T_TITLE)
        {
@@ -624,6 +625,8 @@
                }
            }
        }
+
+       (void) strcat (str_list, (char *)quote);
     }
     return (0);
 }
@@ -711,9 +714,35 @@
                                           after the format string (we
                                           might skip a '}') somewhere
                                           in there... */
+       char *qp = fmt_percent - 1;     /* a pointer used to find quotes */
+       char *quote = "";

        /* Grab the format string. */

+       /* Backward compatibility kludge.  If the previous non-white space
+          character is a single quote, its there to cancel out the single
+          quotes that WERE coded around the repository and changed file
+          list.  This allowed the shell to break up the args to the
+          filter program on white space, creating a seperate arg for
+          each file spec (and the repository).  Since this is the
+          intended default behaviour, in order to not break existing
+          scripts we have remove it when its there and put it in
+          when its not.  This parser really needs to be rewritten.
+          Another approach would have been to allow the single quote
+          to be a format character (unrecognized format chars SHOULD
+          be honored as literals and not ignored), it would break any
+          existing scripts that were expecting the comma that it is
+          currently replaced with now. */
+
+       /* Walk back from the percent until we hit a non-white space char */
+       while (qp > filter && (*qp == ' ' || *qp == '\t')) --qp;
+
+       if (*qp == '\'')
+       {
+           quote = "'";
+           *qp = ' ';
+       }
+
        if ((*(fmt_percent + 1) == ' ') || (*(fmt_percent + 1) == '\0'))
        {
            /* The percent stands alone.  This is an error.  We could
@@ -760,6 +789,15 @@
            fmt_continue = fmt_end;
        }

+       /* Walk forward from fmt_continue until we hit a non-white space
char */
+       qp = fmt_continue;
+       while (*qp != '\0' && (*qp == ' ' || *qp == '\t')) ++qp;
+
+       if (*qp == '\'' && *quote != '\0')
+       {
+           *qp = ' ';
+       }
+
        len = fmt_end - fmt_begin;
        str_list_format = xmalloc (len + 1);
        strncpy (str_list_format, fmt_begin, len);
@@ -777,13 +815,13 @@
        if (str_list_format[0] != '\0')
        {
            type = T_TITLE;
-           (void) walklist (changes, title_proc, NULL);
+           (void) walklist (changes, title_proc, quote);
            type = T_ADDED;
-           (void) walklist (changes, title_proc, NULL);
+           (void) walklist (changes, title_proc, quote);
            type = T_MODIFIED;
-           (void) walklist (changes, title_proc, NULL);
+           (void) walklist (changes, title_proc, quote);
            type = T_REMOVED;
-           (void) walklist (changes, title_proc, NULL);
+           (void) walklist (changes, title_proc, quote);
        }

        free (str_list_format);
@@ -794,13 +832,15 @@

        prog = xmalloc ((fmt_percent - filter) + strlen (srepos)
                        + strlen (str_list) + strlen (fmt_continue)
-                       + 10);
+                       + 12);
        (void) strncpy (prog, filter, fmt_percent - filter);
        prog[fmt_percent - filter] = '\0';
-       (void) strcat (prog, "'");
+       if (*quote == '\0') (void) strcat (prog, "'");
+       (void) strcat (prog, quote);
        (void) strcat (prog, srepos);
+       (void) strcat (prog, quote);
        (void) strcat (prog, str_list);
-       (void) strcat (prog, "'");
+       if (*quote == '\0') (void) strcat (prog, "'");
        (void) strcat (prog, fmt_continue);

        /* To be nice, free up some memory. */

-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]