GNU bug report logs - #37215
[PATCH] vc-cvs-ignore writes absolute filenames and duplicate strings

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Wolfgang Scherer <Wolfgang.Scherer@HIDDEN>; Keywords: patch; dated Wed, 28 Aug 2019 22:33:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 37215 <at> debbugs.gnu.org:


Received: (at 37215) by debbugs.gnu.org; 15 Sep 2019 13:12:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 15 09:12:14 2019
Received: from localhost ([127.0.0.1]:47507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i9UK3-0004jB-Bi
	for submit <at> debbugs.gnu.org; Sun, 15 Sep 2019 09:12:11 -0400
Received: from quimby.gnus.org ([80.91.231.51]:33358)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1i9UK1-0004j4-Lr
 for 37215 <at> debbugs.gnu.org; Sun, 15 Sep 2019 09:12:10 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1i9UJy-0000Q8-9b; Sun, 15 Sep 2019 15:12:08 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Wolfgang Scherer <Wolfgang.Scherer@HIDDEN>
Subject: Re: bug#37215: [PATCH] vc-cvs-ignore writes absolute filenames and
 duplicate strings
References: <e904804a-07c5-8d04-20b7-d2b983d112c1@HIDDEN>
Date: Sun, 15 Sep 2019 15:12:05 +0200
In-Reply-To: <e904804a-07c5-8d04-20b7-d2b983d112c1@HIDDEN> (Wolfgang Scherer's
 message of "Thu, 29 Aug 2019 00:32:22 +0200")
Message-ID: <87imptwvoa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Wolfgang Scherer <Wolfgang.Scherer@HIDDEN> writes: > *
 lisp/vc/vc-cvs.el:
 (vc-cvs-ignore) Expand filename correctly > and pass on basename only. >
 (vc-cvs-append-to-ignore) Do not write duplicate strings to > .cvsignore. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 37215
Cc: 37215 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Wolfgang Scherer <Wolfgang.Scherer@HIDDEN> writes:

> * lisp/vc/vc-cvs.el: (vc-cvs-ignore) Expand filename correctly
> and pass on basename only.
> (vc-cvs-append-to-ignore) Do not write duplicate strings to
> .cvsignore.

This looks correct to me, but:

[...]

> +        ;; FIXME this is a pcvs variable.
> +        (if (bound-and-true-p cvs-sort-ignore-file)
> +            (sort-lines nil (point-min) (point-max)))

Does it make sense to heed a pcvs variable here?  I think it would be
surprising that vc-cvs behaves differently depending on whether you've
loaded pcvs or not.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#37215; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Aug 2019 22:32:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 28 18:32:33 2019
Received: from localhost ([127.0.0.1]:51365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i36US-0006nE-MQ
	for submit <at> debbugs.gnu.org; Wed, 28 Aug 2019 18:32:32 -0400
Received: from lists.gnu.org ([209.51.188.17]:51376)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <Wolfgang.Scherer@HIDDEN>) id 1i36UR-0006n6-1B
 for submit <at> debbugs.gnu.org; Wed, 28 Aug 2019 18:32:31 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45277)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <Wolfgang.Scherer@HIDDEN>) id 1i36UP-0001uv-NG
 for bug-gnu-emacs@HIDDEN; Wed, 28 Aug 2019 18:32:30 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
 RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Wolfgang.Scherer@HIDDEN>) id 1i36UO-0002T8-Jg
 for bug-gnu-emacs@HIDDEN; Wed, 28 Aug 2019 18:32:29 -0400
Received: from mout.gmx.net ([212.227.15.15]:49893)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <Wolfgang.Scherer@HIDDEN>)
 id 1i36UO-0002S3-2D
 for bug-gnu-emacs@HIDDEN; Wed, 28 Aug 2019 18:32:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1567031544;
 bh=jb0cMdUAvfUBqaW6ZYQf2dbhAx9JkXoEpIKk/W335Z0=;
 h=X-UI-Sender-Class:To:From:Subject:Date;
 b=AbxWHfyv4Er5gT54/3bqQ+tOUGqwBQrp9jzvcovY/OwiW215xoljEas/fL1jaWHJM
 PG/dhmGzWb7FYKa6Dtxc2HPfLm9yNWNBReVTQRkvW252rdZdPhQRmaLU6JE08bkkJP
 lmi+YcAwXqrYBrx4SUW2bvfWQl5YNZoPxy3T/m/4=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from sheckley.simul.de ([87.144.41.174]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MIMbO-1hxexg1Key-00EMwo for
 <bug-gnu-emacs@HIDDEN>; Thu, 29 Aug 2019 00:32:24 +0200
Received: from [127.0.0.1] (sheckley.simul.de [127.0.0.1])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by sheckley.simul.de (Postfix) with ESMTPSA id BA98D1942AFF
 for <bug-gnu-emacs@HIDDEN>; Thu, 29 Aug 2019 00:32:22 +0200 (CEST)
To: Emacs Bugs <bug-gnu-emacs@HIDDEN>
From: Wolfgang Scherer <Wolfgang.Scherer@HIDDEN>
Subject: [PATCH] vc-cvs-ignore writes absolute filenames and duplicate strings
Openpgp: preference=signencrypt
Autocrypt: addr=Wolfgang.Scherer@HIDDEN; prefer-encrypt=mutual; keydata=
 xsDiBEb46IgRBACMHOAb1KNo1Ylk+ebri+4R+bG4tyKlqBlrpv8D9/ZwRdXSGt+0DyCHoaAd
 7KW7noHapLe87DunABOjKG4nqTGv+dRiWuUBlp3I4aYRFDVa3Da+XnIYkMHKqhK59VEHQCdp
 Km42nuLS7TS+n99at9YwzTG6VBdOlBKTlRFngOjVLwCg1RGXJ6X3EjS1FKCQeXziURVpWlkD
 /2zY6Ayhxi62TS84VjikXrrmjXykAAaAmMVEyKKYb9L5pGlqiZz9g/K9xw1EUoZTYuaufquD
 v4rAGR58K/3V4CYfJLEeshMWiaXHvMmlxMznlG16/um4MvmR8B3r+cx0nOPK1JBdD2qrkNnF
 Mw8FB+zouLFB4Gt2IUC5IlOmZ8OQA/4qdU53CItzWsCr9Nux4L0qUlRweSmCnV8xGQ2wP5XI
 MawIQxxREvSrsYDG8cNnYETMg4iQFfIktwAoxCJvuFAwIB6ZxHGF4FcEZm64CXc2u7CmFLqt
 rVhXhIfMz9oEYC+HhGczGamn9ofbGTFd2hJEtPcQgWNR4f7+aKknmi2+OM0fV29sZmdhbmcg
 U2NoZXJlciA8d3NAc3ctYW10LndzPsJhBBMRAgAhBQJYmz3YAhsjBQsJCAcCBhUICQoLAgQW
 AgMBAh4BAheAAAoJEIUCr3Gr112VZZoAoLTBSTp1qGuNhLdXY04iaWCMYmHCAJ4kHPtQ6nTw
 kEq9qCHgVgXDaY7wjs7ATQRG+OiIEAQAhi0wjcxvA4tychg2NQuwBIf9LX/46l+74+QbewCn
 a4a+mw/9s5KYqLGtYMuu3/KYq9yBd53OYc7LWTLMxsGOIATSOQRhdCKYW1AanupYrC/bKNW/
 8i2QEXc7LIeYiaII0TkVdQTVZxrg9kKLQ+Vf6z04Lbfv91sVCkHKI9jxgVMAAwUD/0mkDeN0
 tllPH+NOjbkkqlOj6UOwzwIYgXmALhuAEFGXVLM2HfRV9TtJa2OoGZiuhyGXat3Jl9QK9NNv
 d/J4HSal93ZHWstPU4YIRc5uhJ1eeWwKsfTmPvbZXMKMkh+hBBJ39SZnmxfoeUzkK0EQNE2p
 PZDyjAlz03qOx6D0DHnZwkkEGBECAAkFAkb46IgCGwwACgkQhQKvcavXXZU8PwCdGmUH5mbh
 dsLYyx7qthe4hOWnW54AoJQMfmHP4uUI6ji8VkdlvO8LKtLP
Message-ID: <e904804a-07c5-8d04-20b7-d2b983d112c1@HIDDEN>
Date: Thu, 29 Aug 2019 00:32:22 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------3FBEAFDFBD64FCA29D5F1499"
Content-Language: de-DE
X-Provags-ID: V03:K1:xtpW0fyEJnjEMV5rsdCkerYx2caLbb74XxdoiJdW25NJ/5b0wR1
 7QjUlRO4KuNBp4SLJu5UflIAQMeWvtDL5yboNQeFCjDAefNnFBHUU5ZumfheVwUng5NJZ5k
 bZMR6FF6IylybUzWayYiJbmfgmB+eRp7+IGtGyqd7rmktWllSLBw5ZbzdoCmL9yqMalF0V8
 DR+TDwxn+34orUtP5zDvg==
X-UI-Out-Filterresults: notjunk:1;V03:K0:buwnXpotcl4=:DySNbGH6yQv0wHO2nOTSW7
 K2VkgNDuU/gxVlTVVqMJzIhj/xq+h7oG7d8mQqdJXCVSMJIIVoBhRUQMxTDFzVX+ojCXRgRpy
 TU+OZMpnTPvtYhKgj/lu9QpIQCtpECAeN5csJb3el7ZRMCjt1dau3qvRgqciaOhorL3UcfA++
 n+z0YmFok/vLg8l/tmi9j1r9sSmyvFOBhRbxHvJJ8UeVZbiC2sD+7PRNk5UAD46LvM1NyNyUC
 657Tcok0Ds3sooSzDCds5gN2aIl/plrEfDMqR3zUhUwS1J7d3D/K4qoDQzTjNHk5H5BMVRqpD
 sC3FVk+XAAxqTeWDwZluLK4nT6hEPMNrcJYl4iqYtt5YdgNmCbUyD1diqb4I7OGES3vFZwSco
 5CgAOtgRc8q5OBrQ/5KbKKmdghfPDR44fVdJcg8v7QxLKN+1XTvEl+1mI61Im0v9sYMj7lbHI
 ZEjlbZAmv7sIjrW7Ya3AcF4XND88NAaMg3gRzncKubjRyQheSq1TdwIj6TW2pVUgQhd8tLeC9
 Vtq2GpVNtXwBeYxFt8/WGdCgBnECWI2GE1V721Ki8X9w/I6NyjZp2uH1ygxI4odACdOo6M0mC
 yP5sA2bxvOOXn+KTlSuc1D3iX+fo5dktSidiHUr1+CEdI7EViM0aV7KQ3Jv6BGomL5g9NKpLF
 qG5DRpxiRQNRYllK35gDSTaEzv/Ke2b0ESGI8Re0DaprP8WeKl9qYmj4AUUaAizaYFc1nk2Ro
 shHUv58WiQed5Qmy2dOk9ZmKZxGtFJI2yKT2js5K+w4tUgE9lSv2Iu6Bc19SEclJNnPE65FlD
 dhQtCkn5xwvdvuPtyStW0ib+mxvBnzLLblPua+Q90oi/UTObyQNcJsnZ6kJMwD7ihszJJqrMl
 HLcWys6i8+EAIolomhygRoJkhykR2pxey5n7YNZdFeYeMiwSbrVZPUUu/MSXVxoxasgCS/eX4
 dCE18EYFiuB0jMFJN2OFxAnmPl4VYGFGvJtLR56hrqWWMzSaD7WvD5/fTxThynbMkrrAGBw9X
 1kzgUEBisz2aBu3UpsGI6r8gozz/IWQL/r/YRm5VIHZaDq0aaZVyko2KmulCjcgKGbacJZMwj
 U7s2fDBP2Xc5wnDpYF1Jx0DSUjrWZieTmu61OOqy6vzMCdZIm9GLjpVqw==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 212.227.15.15
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

This is a multi-part message in MIME format.
--------------3FBEAFDFBD64FCA29D5F1499
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

When called with an absolute filename (which is the default
case), `vc-cvs-ignore' writes the entire path into the .cvsignore
file.

`vc-cvs-ignore' also writes duplicate strings into .cvsignore.

The attached patch fixes these errors.


--------------3FBEAFDFBD64FCA29D5F1499
Content-Type: text/x-patch;
 name="0001-Do-not-write-absolute-filenames-and-duplicate-string.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename*0="0001-Do-not-write-absolute-filenames-and-duplicate-string.pa";
 filename*1="tch"

=46rom 2b7b90b94a426754a99c965bf708bf5854008b76 Mon Sep 17 00:00:00 2001
From: Wolfgang Scherer <wolfgang.scherer@HIDDEN>
Date: Thu, 29 Aug 2019 00:29:31 +0200
Subject: [PATCH] Do not write absolute filenames and duplicate strings int=
o
 .cvsignore

* lisp/vc/vc-cvs.el: (vc-cvs-ignore) Expand filename correctly
and pass on basename only.
(vc-cvs-append-to-ignore) Do not write duplicate strings to
.cvsignore.
=2D--
 lisp/vc/vc-cvs.el | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index d84700f..1d0387b 100644
=2D-- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -1220,9 +1220,11 @@ is non-nil."
   "Return the administrative directory of FILE."
   (vc-find-root file "CVS"))

-(defun vc-cvs-ignore (file &optional _directory _remove)
-  "Ignore FILE under CVS."
-  (vc-cvs-append-to-ignore (file-name-directory file) file))
+(defun vc-cvs-ignore (file &optional directory _remove)
+  "Ignore FILE under CVS.
+FILE is either absolute or relative to DIRECTORY."
+  (setq file (directory-file-name (expand-file-name file directory)))
+  (vc-cvs-append-to-ignore (file-name-directory file) (file-name-nondirec=
tory file)))

 (defun vc-cvs-append-to-ignore (dir str &optional old-dir)
   "In DIR, add STR to the .cvsignore file.
@@ -1236,13 +1238,16 @@ to hear about anymore."
 		 (not (vc-editable-p buffer-file-name))))
       ;; CVSREAD=3Don special case
       (vc-checkout buffer-file-name t))
-    (goto-char (point-max))
-    (unless (bolp) (insert "\n"))
-    (insert str (if old-dir "/\n" "\n"))
-    ;; FIXME this is a pcvs variable.
-    (if (bound-and-true-p cvs-sort-ignore-file)
-        (sort-lines nil (point-min) (point-max)))
-    (save-buffer)))
+    (goto-char (point-min))
+    (save-match-data
+      (unless (re-search-forward (concat "^" (regexp-quote str) "$") nil =
t)
+        (goto-char (point-max))
+        (unless (bolp) (insert "\n"))
+        (insert str (if old-dir "/\n" "\n"))
+        ;; FIXME this is a pcvs variable.
+        (if (bound-and-true-p cvs-sort-ignore-file)
+            (sort-lines nil (point-min) (point-max)))
+        (save-buffer)))))

 (provide 'vc-cvs)

=2D-
2.7.4


--------------3FBEAFDFBD64FCA29D5F1499--




Acknowledgement sent to Wolfgang Scherer <Wolfgang.Scherer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#37215; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 15 Sep 2019 13:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.