[This file contains 3 patches, related to the behavior of CVS when it recurses through directories. All of the patches look more or less correct, and the bugs seem to have related underlying causes, but it would be good to see sanity.sh test case(s). -kingdon] Date: Mon, 16 Dec 1996 16:31:57 -0500 To: bug-cvs@prep.ai.mit.edu From: Gil Crouse Subject: Problem with local flag in client/server mode >Submitter-Id: net >Originator: Gil Crouse >Organization: BBN Systems and Technologies >Confidential: no >Synopsis: The local flag (-l) doesn't work correctly when subdirectories are specified on the command line >Severity: serious >Priority: high >Category: cvs >Class: sw-bug >Release: cvs-1.9 >Environment: sun sparc 2,5,20 solaris 2.4,2.5 System: SunOS wasp 5.5 Generic sun4m sparc sun4m Architecture: sun4 >Description: Create a repository with a main directory and one subdirectory, eg A/file1 A/B/file2 Then using a CVS client (rsh or pserver), execute a command using the local flag cvs editors -l A A/B This command will work, however if you transpose the arguments cvs editors -l A/B A This command will not work. >How-To-Repeat: >Fix: Here's the context diff *** recurse.c Wed Aug 7 17:46:34 1996 --- ../src/recurse.c Tue Dec 3 12:58:02 1996 *************** *** 637,643 **** /* put back update_dir */ cp = last_component (update_dir); ! if (cp > update_dir) cp[-1] = '\0'; else update_dir[0] = '\0'; --- 676,682 ---- /* put back update_dir */ cp = last_component (update_dir); ! if (cp > update_dir && frame->flags != R_SKIP_DIRS) cp[-1] = '\0'; else update_dir[0] = '\0'; From: ghudson@MIT.EDU Date: Mon, 13 Oct 1997 17:34:17 -0400 To: bug-cvs@prep.ai.mit.edu Subject: recursion may display wrong directories >Submitter-Id: net >Originator: Greg Hudson >Organization: MIT >Confidential: no >Synopsis: update_dir is not properly put back in do_dir_proc(). >Severity: non-critical >Priority: medium >Category: cvs >Class: sw-bug >Release: cvs-1.9 >Environment: System: IRIX steve-dallas 5.3 02091401 IP22 mips >Description: do_dir_proc() assumes that p->key is a single path element, and improperly restores update_dir if it contains multiple path elements. >How-To-Repeat: If you run "cvs update foo/bar baz/quux", you will see: cvs update: Updating foo/bar cvs update: Updating foo/baz/quux >Fix: Here is a patch against CVS 1.9.16. The comment I deleted referred to cases about DIR being "."; I didn't spend any time thinking about that, but given that the current behavior is a bug, it would be good to think about them rather than do something "the same as just setting update_dir back to saved_update_dir" which isn't. *** recurse.c.old Sun Sep 7 12:15:22 1997 --- recurse.c Mon Oct 13 17:25:14 1997 *************** *** 740,755 **** repository = srepository; } ! /* Put back update_dir. I think this is the same as just setting ! update_dir back to saved_update_dir, but there are a few cases I'm ! not sure about (in particular, if DIR is "." and update_dir is ! not ""), so for conservatism I'm leaving this here. */ ! cp = last_component (update_dir); ! if (cp > update_dir) ! cp[-1] = '\0'; ! else ! update_dir[0] = '\0'; ! free (saved_update_dir); return (err); } --- 740,748 ---- repository = srepository; } ! /* Put back update_dir. */ ! free(update_dir); ! update_dir = saved_update_dir; return (err); } From: James Mathiesen Subject: recurse.c cuts corners maintaining update_dir To: bug-cvs@prep.ai.mit.edu Date: Fri, 14 Nov 1997 14:02:36 -0500 (EST) Index: recurse.c =================================================================== RCS file: /src/local/gnu/repository/cvs/src/recurse.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- recurse.c 1996/10/09 16:16:04 1.1.1.2 +++ recurse.c 1997/11/14 18:58:01 1.2 @@ -549,6 +549,13 @@ int err = 0; struct saved_cwd cwd; + /* + * Commands like "cvs diff cf/a cf/b cf/c" require that we explicitly + * save and restore update_dir rather than stripping the final component + * off on our way out. + */ + char *saved_update_dir = xstrdup(update_dir); + /* set up update_dir - skip dots if not at start */ if (strcmp (dir, ".") != 0) { @@ -635,12 +642,9 @@ repository = srepository; } - /* put back update_dir */ - cp = last_component (update_dir); - if (cp > update_dir) - cp[-1] = '\0'; - else - update_dir[0] = '\0'; + /* Restore update_dir to its original value */ + strcpy(update_dir,saved_update_dir); + free(saved_update_dir); return (err); }