summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-10-12 12:47:05 +0000
committerpeter <peter@FreeBSD.org>1997-10-12 12:47:05 +0000
commitbeb1572d3562d20a36f28dd2a235a4a42033a76e (patch)
tree2e58dcdf04f62dd5ddffe89f81f5ccb06c03d034 /contrib/cvs/src
parent468930a717823fa8e978c89a6a6ed7c2cdfb0341 (diff)
downloadFreeBSD-src-beb1572d3562d20a36f28dd2a235a4a42033a76e.zip
FreeBSD-src-beb1572d3562d20a36f28dd2a235a4a42033a76e.tar.gz
Fix a serious bug in the recursion processor. When descending a tree,
the descend can jump several directories down in one hit, eg: when a user mentions multiple directories on the command line, eg: "cvs diff sys/i386/isa/snd sys/sys". The problem is that the chdir()s are pushed/popped to account for this, but the "full path" merely has the last component chopped off on the way back up. This busts lots of things when the recursion is backing up more than one directory (such as in the example). This causes 'cvs diff' to emit bogus Index: lines, 'cvs update' to do really stupid things, 'cvs commit' to record incorrect pathnames etc. I'm not sure that what I've done is quite correct, there seems to be a comment that implies some sort of problem with "." vs. "" equivalence or not, perhaps this is a problem on some other OS's, but I've not (yet) found any problems. This bug has been present since at least cvs-1.8.1. This should fix problems noted by several people including asami and jmg.
Diffstat (limited to 'contrib/cvs/src')
-rw-r--r--contrib/cvs/src/recurse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/cvs/src/recurse.c b/contrib/cvs/src/recurse.c
index b4b55a8..a32f0da 100644
--- a/contrib/cvs/src/recurse.c
+++ b/contrib/cvs/src/recurse.c
@@ -704,6 +704,7 @@ but CVS uses %s for its own purposes; skipping %s directory",
repository = srepository;
}
+#if 0
/* 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
@@ -714,6 +715,14 @@ but CVS uses %s for its own purposes; skipping %s directory",
else
update_dir[0] = '\0';
free (saved_update_dir);
+#else
+ /* The above code is cactus!!! - it doesn't handle descending
+ multiple directories at once! ie: it recurses down several
+ dirs and then back up one. This breaks 'diff', 'update',
+ 'commit', etc. */
+ free (update_dir);
+ update_dir = saved_update_dir;
+#endif
return (err);
}
OpenPOWER on IntegriCloud