Subject: Re: bug#24082: 25.1; vc-dir for CVS repositories list all files as if from toplevel directory

From: [email-masked] (Jérémie Courrèges-Anglas)
Date: Mon, 10 Oct 2016 18:41:54 +0200

Göktuğ Kayaalp <[email-masked]> writes:

> On 2016-10-08 11:06:10 PM +0300, Dmitry Gutov <[email-masked]> wrote:
>> On 08.10.2016 18:13, Jérémie Courrèges-Anglas wrote:
>>> Oops, sorry.  Yes indeed, I only replaced `files' with `dir'.
>> OK, good. Any obvious problems with that solution? [...]
>
> Does not show unregistered files at all, so need to add them from shell.
> In fact, ‘cvs status’ command itself does not know anything about
> unregistered files at all, it only deals with registered files.
>
>>> [... Göktuğ's patch works] fine, there are some differences.
>>
>> That's too bad. I've tried the patch myself, and I didn't see those, 
>> neither [...]
>> Might there be something special with the repo you're trying it on? 

Well, the repo is a local mirror of the OpenBSD cvs repo, stored in /cvs
(/d/cvs today, after I had to do partitioning changes).  There may be
special settings in that repo, but the /tmp/test repo set up by the
script in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24082#33 shows
the same artifacts (see below).

> I've been using the patch since I submitted it, first on 25.1 release
> candidates and then on 25.1 release itself, and have not encountered any
> of these problems.  And most of my source-controlled stuff is in CVS.
> I'd say the local configuration or the patch application may have caused
> this problems.
>
> I'd be glad if Jérémie Courrèges-Anglas could post output from ‘cvs -fnq
> update’ in that checkout, I could maybe use it to understand the
> situation (BTW the ‘cvs -fn update -dP’ command I gave as an example in
> my previous message was mistaken, I took it from the ‘-’ lines of the
> patch, sorry).

/usr/ports/editors$ cvs -fnq update
? emacs-wip
? unregistered-file
M emacs/Makefile
M emacs/distinfo
M emacs/patches/patch-Makefile_in
M emacs/patches/patch-configure
R emacs/patches/patch-src_unexelf_c
? emacs/patches/patch-lisp_vc_vc-cvs_el
? emacs/patches/patch-lisp_vc_vc_el
M emacs/pkg/PFRAG.no-no_x11
M emacs/pkg/PLIST

The output is the same if I rename my ~/.cvsrc, which contains:
--8<--
cvs -q
diff -uNp
update -Pd
checkout -P
-->8--
probably irrelevant, since you specify -f.

Note that this is cvs from the base OpenBSD system:
--8<--
$ cvs --version

Concurrent Versions System (CVS) 1.11.1p1 (client/server)
...
-->8--

which AFAIK doesn't contain differences wrt cvs update from upstream
cvs-1.11.1p1.

>>> So the patched version shows unregistered files and directories, which
>>> is good, but has formatting artifacts (`.//' above).  Also, pressing `='
>>> on `.//emacs-wip', I get the following in *Messages*:
>>>
>>> ...
>>> Traversing directory /usr/ports/editors/...done
>>> Finding changes in /usr/ports/editors/emacs-wip...
>>> vc-find-backend-function: Cannot open load file: No such file or directory, vc-nil
>>>
>>> even though the directory contains a CVS dir, and cvs(1) works fine in
>>> it.  I don't think it's a big problem though.
>>
>> Agree, that doesn't sound like too big of a problem.
>>
>> And seeing unregistered files is pretty much working as intended. Alas, 
>> I see them in both versions of the code (the one using `dir', and the 
>> one using 'cvs update').
>
> I don't see unregistered files with the dir version.
>
>> Any ideas why you're seeing differently? Do you have a non-default value 
>> of vc-cvs-stay-local, maybe?

I had it in my ~/.emacs.d/init.el (I since removed it), but I ran my
tests with emacs -q, so it shouldn't affect the results anyway.  Also
note that the OpenBSD emacs package doesn't ship with a start file,
so -q and -Q should be equivalent:

/usr/local/share/emacs$ find . -name site-start.el
/usr/local/share/emacs$

> If he's using the port from the repo in his message, the ‘lisp/vc/vc.el’
> file seems to be patched and that may be conflicting.  If possible, I
> ask Jérémie to test my patch on master or 25.1 release without all those
> other patches, (applying it on package root w/ ‘patch -p 0’), and
> running emacs w/ -Q flag.

Here's the patch you spotted, it suppresses messages that slow down
vc-dir processes, but shouldn't affect the inner workings of vc-cvs.
Note that I first tested your patch using the master branch of the git
repo, which doesn't contain the patch below.

;$OpenBSD$
;
;- kill messages that slow down emacs at startup with many vc-dir opened.
;
;--- lisp/vc/vc.el.orig	Mon Oct  3 23:42:15 2016
;+++ lisp/vc/vc.el	Mon Oct  3 23:43:16 2016
;@@ -2897,13 +2897,11 @@ to provide the `find-revision' operation instead."
; (defun vc-file-tree-walk (dirname func &rest args)
;   "Walk recursively through DIRNAME.
; Invoke FUNC f ARGS on each VC-managed file f underneath it."
;-  (vc-file-tree-walk-internal (expand-file-name dirname) func args)
;-  (message "Traversing directory %s...done" dirname))
;+  (vc-file-tree-walk-internal (expand-file-name dirname) func args))
; 
; (defun vc-file-tree-walk-internal (file func args)
;   (if (not (file-directory-p file))
;       (when (vc-backend file) (apply func file args))
;-    (message "Traversing directory %s..." (abbreviate-file-name file))
;     (let ((dir (file-name-as-directory file)))
;       (mapcar
;        (lambda (f) (or

For completeness, here are the results with:

1. /usr/ports/editors, using emacs-25.1 and your patch

--8<--
VC backend : CVS
Working dir: /usr/ports/editors/
Repository : /d/cvs
Module     : ports/editors

                         ./
    unregistered         .//emacs-wip
    unregistered         .//unregistered-file
                         emacs/
    edited               .//emacs/Makefile
    edited               .//emacs/distinfo
                         emacs/patches/
    edited               .//emacs/patches/patch-Makefile_in
    edited               .//emacs/patches/patch-configure
    unregistered         .//emacs/patches/patch-lisp_vc_vc-cvs_el
    removed              .//emacs/patches/patch-src_unexelf_c
                         emacs/pkg/
    edited               .//emacs/pkg/PFRAG.no-no_x11
    edited               .//emacs/pkg/PLIST
-->8--

2. your /tmp/test testcase, from the cli and from vc, using emacs-master:

/tmp/test$ cvs -fnq update
M testfil
M subdir/subfil
/tmp/test$ emacs -Q .
--8<--
VC backend : CVS
Working dir: /tmp/test/
Repository : /tmp/cvsroot/
Module     : test

                         ./
    edited               .//testfil
                         subdir/
    edited               .//subdir/subfil
-->8--

3. your /tmp/test testcase, from vc, using emacs-master and your patch:

/tmp/test$ $HOME/src/emacs-master/src/emacs -Q .
--8<--
VC backend : CVS
Working dir: /tmp/test/
Repository : /tmp/cvsroot/
Module     : test

                         ./
    edited               .//testfil
                         subdir/
    edited               .//subdir/subfil
-->8--

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE