Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Feb 2001 17:14:55 -0500
From:      Forrest Aldrich <forrie@forrie.com>
To:        freebsd-config@freebsd.org
Cc:        forrie@forrie.com
Subject:   CVS patches to permit longer filename args
Message-ID:  <5.0.2.1.2.20010228171326.01af61b0@216.67.14.69>

next in thread | raw e-mail | index | archive | help
I've emailed this to peter@freebsd.org, but wanted to have you review this 
in case he doesn't have time to address it.

I tried, in vain, to contact the CVSHome people... but got no 
response.  So, I'd like to field this patch your way and get your thoughts 
on it.

The original patch was provided by Simon Gerraty of quick.com.au.  He's now 
sjg@juniper.net, and he's aware that I'm trying to resolve the problem that 
this patch supposedly fixes.

The patch is below, but here I will include some of his comments.  I'd 
appreciate your input, or suggestions about how else to solve the problem.

Thanks alot,

Forrest

 >>>>> SJG COMMENTS sjg@juniper.net

we use CVS to maintain our DNS data.  We also use a DNS regression
suite (see http://www.quick.com.au/help/dns.html) to do pre-commit
checks - very handy.

The above toolset includes facilities for generating PTR records.
If/when we re-configure said tool, it can cause a few hundred in-addr
zone files to change.

This typically causes the pre-commit checks to fail as the OS command
line length is exceeded when cvs attempts to run the regression suite
in that directory.

The patch below (to cvs-1.10) modifies precommit_proc() such that if
the pre-commit filter command begins with "xargs" or _PATH_XARGS, then
it is run using run_popen() rather than run_exec().

I'm submitting it here in its first cut form to see what others think
(of the idea - not the code :-)  It may be better forinstance to
always use run_popen() ? But for now this does the job.

--sjg
<<<<<<<<<<< END COMMENTS







X-UID: 3349

*** commit.c~   Mon Feb 26 15:52:37 2001
--- commit.c    Mon Feb 26 15:52:40 2001
***************
*** 1102,1113 ****
--- 1102,1117 ----
       void *closure;
   {
       struct logfile_info *li;
+     FILE *fp = closure; /* sjg mods */

       li = (struct logfile_info *) p->data;
       if (li->type == T_ADDED
         || li->type == T_MODIFIED
         || li->type == T_REMOVED)
       {
+       if (fp) /* sjg mods */
+       fprintf(fp, "'%s'\n", p->key); /* sjg mods */
+       else /* sjg mods */
         run_arg (p->key);
       }
       return (0);
***************
*** 1121,1126 ****
--- 1125,1131 ----
       char *repository;
       char *filter;
   {
+     int rc = -1; /* sjg mods */
       /* see if the filter is there, only if it's a full path */
       if (isabsolute (filter))
       {
***************
*** 1142,1151 ****
         free (s);
       }

       run_setup (filter);
       run_arg (repository);
       (void) walklist (saved_ulist, precommit_list_proc, NULL);
!     return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
   }

   /*
--- 1147,1200 ----
         free (s);
       }

+ /* sjg mods */
+
+ #ifndef _PATH_XARGS
+ # define _PATH_XARGS "/usr/bin/xargs"
+ #endif
+     if (strncmp(filter, _PATH_XARGS, sizeof(_PATH_XARGS) - 1) == 0 || 
strncmp(filter, "xargs", 5) == 0) { /* we expect many args, so don't try 
run_exec() */
+     char *cmd = xmalloc(strlen(filter) + strlen(repository) + 4);
+     if (cmd) {
+         FILE *fp;
+         int status = -1;
+
+         sprintf(cmd, "%s %s", filter, repository);
+
+         if (fp = run_popen(cmd, "w")) {
+         (void) walklist (saved_ulist, precommit_list_proc, fp);
+         status = pclose(fp);
+
+         if (status != -1) {
+     /*
+      * from run_exec()
+      */
+ #ifndef VMS /* status is return status */
+     if (WIFEXITED (status))
+         rc = WEXITSTATUS (status);
+     else if (WIFSIGNALED (status))
+     {
+         if (WTERMSIG (status) == SIGPIPE)
+         error (1, 0, "broken pipe");
+         rc = 2;
+     }
+     else
+         rc = 1;
+ #else /* VMS */
+         rc = WEXITSTATUS (status);
+ #endif /* VMS */
+     }
+     }
+     free(cmd);
+     }
+
+   } else {
       run_setup (filter);
       run_arg (repository);
       (void) walklist (saved_ulist, precommit_list_proc, NULL);
!     /* sjg mods */
!     rc = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY);
!   }
!    return rc;
   }

   /*


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-config" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.0.2.1.2.20010228171326.01af61b0>