bug-cvs
[Top][All Lists]
Advanced

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

Bug report and patch


From: Jim Hyslop
Subject: Bug report and patch
Date: Fri, 11 Feb 2005 23:46:45 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217

I hereby grant permission to distribute this patch under the
terms of the GNU Public License.

BUG: 'cvs watch on' and 'cvs watch off' on an empty directory will
clear any default '_watchers' in that directory.

VERSION APPLIES TO: both stable (1.11) and feature (1.12) branches.

TEST CASE:
Sorry, my shell programming skills are extremely limited. Someone who has the time and expertise should be able to convert this into a proper addition for sanity.sh:

#assumptions: 'test-directory' exists in the repository
# as either a top-level directory or a CVS module,
# and it has no default watchers/watched.

cvs co test-directory
cd test-directory
mkdir subdir
cvs add subdir
cd subdir

#START watch add/remove sequence
cvs watch add
grep '_watchers' $CVSROOT/test-directory/subdir/CVS/fileattr
(the grep should succeed and currently does)

cvs watch on
grep '_watchers' $CVSROOT/test-directory/subdir/CVS/fileattr
(currently, this grep will fail - it should succeed)
grep '_watched' $CVSROOT/test-directory/subdir/CVS/fileattr
(this grep should succeed, and currently does)

cvs watch off
grep '_watchers' $CVSROOT/test-directory/subdir/CVS/fileattr
(currently, this grep will fail - it should succeed)
grep '_watched' $CVSROOT/test-directory/subdir/CVS/fileattr
(this grep should fail)

cvs watch remove
($CVSROOT/test-directory/subdir/CVS/fileattr should not exist)
($CVSROOT/test-directory/subdir/CVS should not exist)
#END watch add/remove sequence
echo Hi there>afile
cvs add afile
cvs ci -m "A file" afile
(repeat add/remove sequence, results should be the same)
(clean up)

PATCH:
The problem is, when onoff_fileproc and onoff_filesdoneproc call fileattr_set the current attributes have not yet been read from the current fileattr file. The patch simply forces the current fileattr values to be read into memory before modifying the attribute.

Index: src/edit.c
===================================================================
RCS file: /cvs/ccvs/src/edit.c,v
retrieving revision 1.57.4.4
diff -u -r1.57.4.4 edit.c
--- src/edit.c  20 Mar 2004 22:25:49 -0000      1.57.4.4
+++ src/edit.c  12 Feb 2005 04:18:48 -0000
@@ -32,6 +32,7 @@
     void *callerdat;
     struct file_info *finfo;
 {
+    fileattr_get0 (finfo->file, "_watched");
     fileattr_set (finfo->file, "_watched", turning_on ? "" : NULL);
     return 0;
 }
@@ -49,6 +50,7 @@
     const char *update_dir;
     List *entries;
 {
+    fileattr_get0 (NULL, "_watched");
     if (setting_default)
        fileattr_set (NULL, "_watched", turning_on ? "" : NULL);
     return err;


NEWS entry:
* Thanks to a patch from Jim Hyslop <address@hidden>, issuing
  'cvs watch on' or 'cvs watch off' in an empty directory no longer
  clears any watchers in that directory.

--
Jim





reply via email to

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