Date: Tue, 8 Dec 1998 15:08:52 +1100 (EST) From: "Simon J. Gerraty" To: bug-cvs@gnu.org Subject: Pre-commit check failure due to too many args. Hi, 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 Index: commit.c =================================================================== RCS file: /home/cvsroot/cvs/src/commit.c,v retrieving revision 1.1.1.1 diff -c -b -r1.1.1.1 commit.c *** commit.c 1998/12/08 01:08:38 1.1.1.1 --- commit.c 1998/12/08 03:16:36 *************** *** 1089,1100 **** --- 1089,1104 ---- void *closure; { struct logfile_info *li; + FILE *fp = closure; li = (struct logfile_info *) p->data; if (li->type == T_ADDED || li->type == T_MODIFIED || li->type == T_REMOVED) { + if (fp) + fprintf(fp, "'%s'\n", p->key); + else run_arg (p->key); } return (0); *************** *** 1108,1113 **** --- 1112,1119 ---- char *repository; char *filter; { + int rc = -1; + /* see if the filter is there, only if it's a full path */ if (isabsolute (filter)) { *************** *** 1129,1138 **** 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)); } /* --- 1135,1188 ---- free (s); } + #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); ! rc = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY); ! } ! return rc; } /*