From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Jonathan Kamens Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 May 2012 19:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 11490@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13371967304245 (code B ref -1); Wed, 16 May 2012 19:33:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 May 2012 19:32:10 +0000 Received: from localhost ([127.0.0.1]:58093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUjxB-00016M-HA for submit@debbugs.gnu.org; Wed, 16 May 2012 15:32:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53626) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUjux-00011Y-9g for submit@debbugs.gnu.org; Wed, 16 May 2012 15:29:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUjuf-0003Pe-Kr for submit@debbugs.gnu.org; Wed, 16 May 2012 15:29:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:34228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUjuf-0003PU-Hn for submit@debbugs.gnu.org; Wed, 16 May 2012 15:29:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUjud-0007Qb-Sj for bug-gnu-emacs@gnu.org; Wed, 16 May 2012 15:29:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUjub-0003Nu-Mq for bug-gnu-emacs@gnu.org; Wed, 16 May 2012 15:29:31 -0400 Received: from jik3.kamens.brookline.ma.us ([128.177.28.63]:43939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUjub-0003Jw-I6 for bug-gnu-emacs@gnu.org; Wed, 16 May 2012 15:29:29 -0400 Received: from [10.5.33.94] (206.83.68.9.ptr.us.xo.net [206.83.68.9]) (authenticated bits=0) by jik3.kamens.brookline.ma.us (8.13.8/8.13.8) with ESMTP id q4GJTKbN029298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 May 2012 15:29:21 -0400 Message-ID: <4FB40003.3050502@kamens.us> Date: Wed, 16 May 2012 15:29:07 -0400 From: Jonathan Kamens User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120425 Thunderbird/13.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------030809060701060103020404" X-Scanned-By: MIMEDefang 2.73 on 128.177.28.63 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Mailman-Approved-At: Wed, 16 May 2012 15:32:04 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is a multi-part message in MIME format. --------------030809060701060103020404 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit GNU Emacs 24.0.95.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.10) of 2012-04-06 on x86-13.phx2.fedoraproject.org Make an RCS file writable with chmod +w without locking it. Make changes to the file. Type C-x v v. The file will be locked and checked out and your changes will be overwritten. This is Bad, Bad, Bad. It needs to check if there are non-checked-out changes and ask whether to preserve them. It used to do this. I have no idea why it's behaving differently now or when it started behaving this way, but it's clearly wrong and dangerous, given the potential to lose work. I lost a whole day of work recently as a result of this bug. Yeah, it was user error, but that's not really the point. It's easy to protect the user from losing work due to this editor, and it's something that Emacs used to do, so it should continue to do it. jik --------------030809060701060103020404 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit GNU Emacs 24.0.95.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.10) of 2012-04-06 on x86-13.phx2.fedoraproject.org

Make an RCS file writable with chmod +w without locking it.

Make changes to the file.

Type C-x v v.

The file will be locked and checked out and your changes will be overwritten.

This is Bad, Bad, Bad. It needs to check if there are non-checked-out changes and ask whether to preserve them.

It used to do this. I have no idea why it's behaving differently now or when it started behaving this way, but it's clearly wrong and dangerous, given the potential to lose work.

I lost a whole day of work recently as a result of this bug. Yeah, it was user error, but that's not really the point. It's easy to protect the user from losing work due to this editor, and it's something that Emacs used to do, so it should continue to do it.

  jik

--------------030809060701060103020404-- From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 May 2012 20:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jonathan Kamens Cc: 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.133719919310953 (code B ref 11490); Wed, 16 May 2012 20:14:01 +0000 Received: (at 11490) by debbugs.gnu.org; 16 May 2012 20:13:13 +0000 Received: from localhost ([127.0.0.1]:58113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUkav-0002qc-8n for submit@debbugs.gnu.org; Wed, 16 May 2012 16:13:13 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:41397 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUkab-0002pt-Fe for 11490@debbugs.gnu.org; Wed, 16 May 2012 16:13:12 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SUkaO-00026q-IW; Wed, 16 May 2012 16:12:40 -0400 From: Glenn Morris References: <4FB40003.3050502@kamens.us> X-Spook: encryption NORAD number key Bosnia assassination analyzer X-Ran: aKwsl: (Jonathan Kamens's message of "Wed, 16 May 2012 15:29:07 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Jonathan Kamens wrote: > GNU Emacs 24.0.95.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.10) of > 2012-04-06 on x86-13.phx2.fedoraproject.org > > Make an RCS file writable with chmod +w without locking it. > > Make changes to the file. > > Type C-x v v. > > The file will be locked and checked out and your changes will be > overwritten. I cannot reproduce this. I did: mkdir foo cd foo mkdir RCS echo initial > file ci -u -t-foo file chmod +w file emacs-24.0.96 -Q file add some text to file C-x v v A log buffer appears. I enter some text and press C-c C-c. I am told the buffer is modified and prompted to save it. I do so. At this point, RCS returns an error: RCS/file,v <-- file ci: RCS/file,v: no lock set by gmorris for revision 1.1 The contents of the file on disk and in the Emacs buffer are unchanged (ie, the added text is still present). This was with RCS 5.7. I never normally use RCS, maybe I am missing something. Do you have a recipe starting from emacs -Q that shows the problem? From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Jonathan Kamens Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 May 2012 01:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.133721749211919 (code B ref 11490); Thu, 17 May 2012 01:19:01 +0000 Received: (at 11490) by debbugs.gnu.org; 17 May 2012 01:18:12 +0000 Received: from localhost ([127.0.0.1]:58301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUpM3-00036B-Sh for submit@debbugs.gnu.org; Wed, 16 May 2012 21:18:12 -0400 Received: from jik3.kamens.brookline.ma.us ([128.177.28.63]:41482) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUpLj-00035T-BJ for 11490@debbugs.gnu.org; Wed, 16 May 2012 21:18:10 -0400 Received: from jik2.kamens.brookline.ma.us (jik2-openvpn [10.100.65.34]) (authenticated bits=0) by jik3.kamens.brookline.ma.us (8.13.8/8.13.8) with ESMTP id q4H1HYvM005940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 May 2012 21:17:37 -0400 Message-ID: <4FB451AE.60508@kamens.us> Date: Wed, 16 May 2012 21:17:34 -0400 From: Jonathan Kamens User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/15.0 Thunderbird/15.0a1 MIME-Version: 1.0 References: <4FB40003.3050502@kamens.us> In-Reply-To: Content-Type: multipart/alternative; boundary="------------060409000703030501020402" X-Scanned-By: MIMEDefang 2.73 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is a multi-part message in MIME format. --------------060409000703030501020402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Try it without making the file writable. This happens, e.g., if a file is edited as root by a user using vim, which doesn't care whether it's writable or not, since it's root doing the editing, and then by a user using Emacs, which /does/ care because it detects VC and thus makes the file read-only in Emacs. The user's first impulse will be to type C-x v v, which will overwrite the previous editor's changes. The problem goes away when vc-mistrust-permissions is set to true. I would argue that C-x v v should always check the status of a file with vc-mistrust-permissions set to true (or the logical equivalent) before overwriting its contents and potentially losing data. jik --------------060409000703030501020402 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Try it without making the file writable.

This happens, e.g., if a file is edited as root by a user using vim, which doesn't care whether it's writable or not, since it's root doing the editing, and then by a user using Emacs, which does care because it detects VC and thus makes the file read-only in Emacs. The user's first impulse will be to type C-x v v, which will overwrite the previous editor's changes.

The problem goes away when vc-mistrust-permissions is set to true.

I would argue that C-x v v should always check the status of a file with vc-mistrust-permissions set to true (or the logical equivalent) before overwriting its contents and potentially losing data.

  jik

--------------060409000703030501020402-- From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 May 2012 00:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jonathan Kamens Cc: 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.133730198723689 (code B ref 11490); Fri, 18 May 2012 00:47:01 +0000 Received: (at 11490) by debbugs.gnu.org; 18 May 2012 00:46:27 +0000 Received: from localhost ([127.0.0.1]:59885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SVBKs-0006A1-Bl for submit@debbugs.gnu.org; Thu, 17 May 2012 20:46:26 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:48226 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SVBKY-00069V-Lv for 11490@debbugs.gnu.org; Thu, 17 May 2012 20:46:25 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SVBKE-0000Zt-T2; Thu, 17 May 2012 20:45:46 -0400 From: Glenn Morris References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> X-Spook: Rule Psix Afghanistan UOP enforcers e-bomb AMEMB X-Ran: 4mx\Y$|1mxu62/"-n[ZM5,W85V*!7NJLW#@E!fm}0/@U?n_$CHU9@/}2bGPZ!Zcvck/n%\ X-Hue: black X-Attribution: GM Date: Thu, 17 May 2012 20:45:46 -0400 In-Reply-To: <4FB451AE.60508@kamens.us> (Jonathan Kamens's message of "Wed, 16 May 2012 21:17:34 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Jonathan Kamens wrote: > Try it without making the file writable. Well, ok, but your initial report began: Make an RCS file writable with chmod +w without locking it. If I instead use M-x toggle-read-only, make changes, and use C-x v v, then I see the problem. > The problem goes away when vc-mistrust-permissions is set to true. OK. It looks like that variable only affects RCS and SCCS? In which case I am guessing that few people will care if the default changes, so maybe we should just do that... From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Jonathan Kamens Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 May 2012 14:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.133735190912449 (code B ref 11490); Fri, 18 May 2012 14:39:01 +0000 Received: (at 11490) by debbugs.gnu.org; 18 May 2012 14:38:29 +0000 Received: from localhost ([127.0.0.1]:32839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SVOK5-0003Ek-FV for submit@debbugs.gnu.org; Fri, 18 May 2012 10:38:29 -0400 Received: from jik3.kamens.brookline.ma.us ([128.177.28.63]:42164) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SVOK2-0003EX-Ln for 11490@debbugs.gnu.org; Fri, 18 May 2012 10:38:27 -0400 Received: from jik2.kamens.brookline.ma.us (jik2-openvpn [10.100.65.34]) (authenticated bits=0) by jik3.kamens.brookline.ma.us (8.13.8/8.13.8) with ESMTP id q4IEc2bs006328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 May 2012 10:38:03 -0400 Message-ID: <4FB65ECA.6000205@kamens.us> Date: Fri, 18 May 2012 10:38:02 -0400 From: Jonathan Kamens User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> In-Reply-To: X-Enigmail-Version: 1.4.1 Content-Type: multipart/alternative; boundary="------------060300030200010905030508" X-Scanned-By: MIMEDefang 2.73 X-Spam-Score: -6.9 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is a multi-part message in MIME format. --------------060300030200010905030508 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 05/17/2012 08:45 PM, Glenn Morris wrote: > Well, ok, but your initial report began: > > Make an RCS file writable with chmod +w without locking it. > > If I instead use M-x toggle-read-only, make changes, and use C-x v v, > then I see the problem. Yeah, well, you can never trust users to be accurate in bug reports. :-( Sorry about that. Seriously, I've encountered this problem twice on two different computers recently, and the other time it happened might have been under Cygwin on Windows, where permissions are screwy. > OK. It looks like that variable only affects RCS and SCCS? > In which case I am guessing that few people will care if the default > changes, so maybe we should just do that... I'm obviously not in any position of authority here, but as for my personal opinion, I would have no objection whatsoever to making vc-mistrust-permissions default to true for safety's sake. Might also want to put a warning in the documentation of the variable about what might happen if you set it to false and then use vc-next-action on a file with non-checked-out changes. Jon --------------060300030200010905030508 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 05/17/2012 08:45 PM, Glenn Morris wrote:
Well, ok, but your initial report began:

   Make an RCS file writable with chmod +w without locking it.

If I instead use M-x toggle-read-only, make changes, and use C-x v v,
then I see the problem.
Yeah, well, you can never trust users to be accurate in bug reports. :-( Sorry about that.

Seriously, I've encountered this problem twice on two different computers recently, and the other time it happened might have been under Cygwin on Windows, where permissions are screwy.
OK. It looks like that variable only affects RCS and SCCS?
In which case I am guessing that few people will care if the default
changes, so maybe we should just do that...
I'm obviously not in any position of authority here, but as for my personal opinion, I would have no objection whatsoever to making vc-mistrust-permissions default to true for safety's sake. Might also want to put a warning in the documentation of the variable about what might happen if you set it to false and then use vc-next-action on a file with non-checked-out changes.

  Jon

--------------060300030200010905030508-- From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 May 2012 03:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jonathan Kamens Cc: 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.13376591398344 (code B ref 11490); Tue, 22 May 2012 03:59:02 +0000 Received: (at 11490) by debbugs.gnu.org; 22 May 2012 03:58:59 +0000 Received: from localhost ([127.0.0.1]:37883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWgFO-0002AW-D5 for submit@debbugs.gnu.org; Mon, 21 May 2012 23:58:58 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:51747 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWgF4-0002A7-5R for 11490@debbugs.gnu.org; Mon, 21 May 2012 23:58:57 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SWgEN-0002tc-3j; Mon, 21 May 2012 23:57:55 -0400 From: Glenn Morris References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> X-Spook: Noriega underground doctrine espionage Nazi bomb top X-Ran: %K_)ymhS$arm?r$WBXJx{!4c@|Q{xjc%G)?6h#j6->}N+t\uWt!4Cg{91gr'Pmt2bE3Mnc X-Hue: black X-Attribution: GM Date: Mon, 21 May 2012 23:57:54 -0400 In-Reply-To: <4FB65ECA.6000205@kamens.us> (Jonathan Kamens's message of "Fri, 18 May 2012 10:38:02 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.7 (-----) Jonathan Kamens wrote: > I'm obviously not in any position of authority here, but as for my > personal opinion, I would have no objection whatsoever to making > vc-mistrust-permissions default to true for safety's sake. Me neither. It seems like the default should be the safest mode of operation. However, Emacs 22.3 does not have this issuse; 23.1 onwards does. Something was lost with the removal of vc-next-action-on-file, and now vc-buffer-sync does not get called. From debbugs-submit-bounces@debbugs.gnu.org Tue May 22 15:40:31 2012 Received: (at control) by debbugs.gnu.org; 22 May 2012 19:40:31 +0000 Received: from localhost ([127.0.0.1]:39331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWuwY-0001iT-F1 for submit@debbugs.gnu.org; Tue, 22 May 2012 15:40:30 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:44158 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWuwE-0001hy-NQ for control@debbugs.gnu.org; Tue, 22 May 2012 15:40:29 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SWuvV-00019N-6x for control@debbugs.gnu.org; Tue, 22 May 2012 15:39:25 -0400 Date: Tue, 22 May 2012 15:39:25 -0400 Message-Id: Subject: control message for bug 11490 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) severity 11490 important tag 11490 help confirmed From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Jan 2013 02:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed help To: Glenn Morris Cc: Jonathan Kamens , 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.135726825514769 (code B ref 11490); Fri, 04 Jan 2013 02:58:01 +0000 Received: (at 11490) by debbugs.gnu.org; 4 Jan 2013 02:57:35 +0000 Received: from localhost ([127.0.0.1]:42345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqxTS-0003qA-MN for submit@debbugs.gnu.org; Thu, 03 Jan 2013 21:57:34 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:46014) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqxTP-0003py-HH for 11490@debbugs.gnu.org; Thu, 03 Jan 2013 21:57:33 -0500 Received: by mail-pa0-f42.google.com with SMTP id rl6so9050457pac.29 for <11490@debbugs.gnu.org>; Thu, 03 Jan 2013 18:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=p3knmGKY2VdIu3adUyCm1j7RdMNlcfzVVIvSJlsD5h0=; b=l9CK90GJSoQJCGeRQs5m+2uttVo1q1/Iw9R0BMvQOFipU7TD4nmx0IgsaKLStf6vPc 1RYxFPgOIx/Z285JKm6Z9+7K1TtWZn5WBBDbVG1uYqPDYKmDfzatDoQ+yAfBC4y09Pi/ hEWUHl3sZWTokWFjgMwRhQYepXzNd8NqQX3/aeQoHXjCPozWHToswakVf6hGTMncWM4L I1nOforLnxQBST5wKO7g+TWNT6mdIABUUFpKLVrvw4JCCjAP386VdOcgVvz+kP6NXqaf qWJ3Dpef9Ul1AgAa8WDluH1UjkKYdFbkka7DJ/x8EY3zm7rltF0bz7tI2jHnAjFrPjlL 8kww== X-Received: by 10.68.219.164 with SMTP id pp4mr158060509pbc.72.1357268246284; Thu, 03 Jan 2013 18:57:26 -0800 (PST) Received: from ulysses ([155.69.16.140]) by mx.google.com with ESMTPS id s5sm32289339pay.31.2013.01.03.18.57.22 (version=SSLv3 cipher=OTHER); Thu, 03 Jan 2013 18:57:24 -0800 (PST) From: Chong Yidong References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> Date: Fri, 04 Jan 2013 10:57:19 +0800 In-Reply-To: (Glenn Morris's message of "Mon, 21 May 2012 23:57:54 -0400") Message-ID: <87txqxr6y8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) >> I'm obviously not in any position of authority here, but as for my >> personal opinion, I would have no objection whatsoever to making >> vc-mistrust-permissions default to true for safety's sake. > > Me neither. It seems like the default should be the safest mode of > operation. > > However, Emacs 22.3 does not have this issuse; 23.1 onwards does. > Something was lost with the removal of vc-next-action-on-file, > and now vc-buffer-sync does not get called. Can someone summarize again a *correct* recipe to see the bug? What with the wrong initial bug report, and the imprecise follow-up, I can't figure out where the problem lies. If I do mkdir foo cd foo mkdir RCS echo initial > file ci -u -t-foo file [Edit file in root] emacs-24.0.96 -Q file C-x v v Then I get a prompt saying File has unlocked changes. Claim lock retaining changes? (yes or no) If I type yes, the changes are still there. What's the problem? From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Jan 2013 03:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed help To: Chong Yidong Cc: Jonathan Kamens , 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.135726907519485 (code B ref 11490); Fri, 04 Jan 2013 03:12:02 +0000 Received: (at 11490) by debbugs.gnu.org; 4 Jan 2013 03:11:15 +0000 Received: from localhost ([127.0.0.1]:42360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqxgg-00054E-PA for submit@debbugs.gnu.org; Thu, 03 Jan 2013 22:11:15 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:40618) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqxge-000547-Oo for 11490@debbugs.gnu.org; Thu, 03 Jan 2013 22:11:13 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TqxgZ-0003Oe-BZ; Thu, 03 Jan 2013 22:11:07 -0500 From: Glenn Morris References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> <87txqxr6y8.fsf@gnu.org> X-Spook: lynch Taiwan president Dateline Aladdin event security X-Ran: /KXy_6(DIVXL@]EC!g&6xN'OCD4T)Q~"cXLO9Gpo|1$dwZ,uFZ<9)uV.xe#*`q@\7ZA*SC X-Hue: red X-Attribution: GM Date: Thu, 03 Jan 2013 22:11:07 -0500 In-Reply-To: <87txqxr6y8.fsf@gnu.org> (Chong Yidong's message of "Fri, 04 Jan 2013 10:57:19 +0800") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Chong Yidong wrote: > Can someone summarize again a *correct* recipe to see the bug? mkdir foo cd foo mkdir RCS echo initial > file ci -u -t-foo file emacs-24.2 -Q file M-x toggle-read-only Enter some text in the buffer, eg now it looks like: ----- initial foobar ----- Press C-x v v, and "foobar" is deleted with no prompting and no way to get it back. I changed vc-mistrust-permissions to t for 24.3 because of this. But now that I check, it doesn't seem to help... From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Jonathan Kamens Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Jan 2013 03:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed help To: Glenn Morris Cc: 11490@debbugs.gnu.org, Chong Yidong Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.135726947120130 (code B ref 11490); Fri, 04 Jan 2013 03:18:02 +0000 Received: (at 11490) by debbugs.gnu.org; 4 Jan 2013 03:17:51 +0000 Received: from localhost ([127.0.0.1]:42365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqxn5-0005Ec-0C for submit@debbugs.gnu.org; Thu, 03 Jan 2013 22:17:51 -0500 Received: from jik3.kamens.brookline.ma.us ([128.177.28.63]:43368) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqxn2-0005EV-Vk for 11490@debbugs.gnu.org; Thu, 03 Jan 2013 22:17:49 -0500 Received: from jik2.kamens.brookline.ma.us (209-6-65-228.c3-0.abr-ubr1.sbo-abr.ma.cable.rcn.com [209.6.65.228]) (authenticated bits=0) by jik3.kamens.brookline.ma.us (8.13.8/8.13.8) with ESMTP id r043Hg3f022203 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Jan 2013 22:17:42 -0500 Message-ID: <50E649D6.4090808@kamens.us> Date: Thu, 03 Jan 2013 22:17:42 -0500 From: Jonathan Kamens User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> <87txqxr6y8.fsf@gnu.org> In-Reply-To: Content-Type: multipart/alternative; boundary="------------000505060704020209040906" X-Scanned-By: MIMEDefang 2.73 on 128.177.28.63 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) This is a multi-part message in MIME format. --------------000505060704020209040906 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 01/03/2013 10:11 PM, Glenn Morris wrote: > Chong Yidong wrote: > >> Can someone summarize again a *correct* recipe to see the bug? > mkdir foo > cd foo > mkdir RCS > echo initial > file > ci -u -t-foo file > emacs-24.2 -Q file > > M-x toggle-read-only > > Enter some text in the buffer, eg now it looks like: > > ----- > initial > foobar > ----- > > Press C-x v v, and "foobar" is deleted with no prompting and no way to > get it back. > > I changed vc-mistrust-permissions to t for 24.3 because of this. > But now that I check, it doesn't seem to help... The problem described above may indeed be a problem, but it's not the problem I reported. The problem I reported is: mkdir foo cd foo mkdir RCS echo initial > file ci -u -t-foo file chmod +w file echo second >> file chmod -w file emacs -Q file C-x v v - the changes are overwritten without prompting I think the step missing from Chong Yidong's recipe was making sure the file is read-only before trying to edit it in emacs. If vc-mistrust-permissions is true by default then this issue doesn't occur. jik --------------000505060704020209040906 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 01/03/2013 10:11 PM, Glenn Morris wrote:
Chong Yidong wrote:

Can someone summarize again a *correct* recipe to see the bug?
mkdir foo
cd foo
mkdir RCS
echo initial > file
ci -u -t-foo file
emacs-24.2 -Q file

M-x toggle-read-only

Enter some text in the buffer, eg now it looks like:

-----
initial
foobar
-----

Press C-x v v, and "foobar" is deleted with no prompting and no way to
get it back.

I changed vc-mistrust-permissions to t for 24.3 because of this.
But now that I check, it doesn't seem to help...
The problem described above may indeed be a problem, but it's not the problem I reported.

The problem I reported is:

mkdir foo
cd foo
mkdir RCS
echo initial > file
ci -u -t-foo file
chmod +w file
echo second >> file
chmod -w file
emacs -Q file
C-x v v - the changes are overwritten without prompting

I think the step missing from Chong Yidong's recipe was making sure the file is read-only before trying to edit it in emacs.

If vc-mistrust-permissions is true by default then this issue doesn't occur.

  jik
--------------000505060704020209040906-- From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Jan 2013 03:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed help To: Jonathan Kamens Cc: 11490@debbugs.gnu.org, Chong Yidong Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.135726969920503 (code B ref 11490); Fri, 04 Jan 2013 03:22:01 +0000 Received: (at 11490) by debbugs.gnu.org; 4 Jan 2013 03:21:39 +0000 Received: from localhost ([127.0.0.1]:42371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqxqk-0005Ke-QP for submit@debbugs.gnu.org; Thu, 03 Jan 2013 22:21:38 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:40844) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqxqj-0005KX-2F for 11490@debbugs.gnu.org; Thu, 03 Jan 2013 22:21:37 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Tqxqd-0004MW-RN; Thu, 03 Jan 2013 22:21:31 -0500 From: Glenn Morris References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> <87txqxr6y8.fsf@gnu.org> <50E649D6.4090808@kamens.us> X-Spook: Ansar al-Islam Bin Laden subversive Rubin AK-47 Centro X-Ran: Q]iz2*nvyQmm..?io?fNji2%mOZz'!X72%op,66F6Dp X-Hue: green X-Attribution: GM Date: Thu, 03 Jan 2013 22:21:31 -0500 In-Reply-To: <50E649D6.4090808@kamens.us> (Jonathan Kamens's message of "Thu, 03 Jan 2013 22:17:42 -0500") Message-ID: <55obh51vlw.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) Jonathan Kamens wrote: > Make an RCS file writable with chmod +w I wrote: > I cannot reproduce this Jonathan Kamens wrote: > Try it without making the file writable. I wrote: > I see the problem. (months pass) Jonathan Kamens wrote: > The problem described above may indeed be a problem, but it's not the > problem I reported. > > The problem I reported is: [...] > chmod +w file Welp, this sure has been crystal clear. From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Jonathan Kamens Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Jan 2013 03:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed help To: Glenn Morris Cc: 11490@debbugs.gnu.org, Chong Yidong Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.135727042121713 (code B ref 11490); Fri, 04 Jan 2013 03:34:01 +0000 Received: (at 11490) by debbugs.gnu.org; 4 Jan 2013 03:33:41 +0000 Received: from localhost ([127.0.0.1]:42399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqy2P-0005e8-FE for submit@debbugs.gnu.org; Thu, 03 Jan 2013 22:33:41 -0500 Received: from jik3.kamens.brookline.ma.us ([128.177.28.63]:45802) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqy2N-0005dy-9Z for 11490@debbugs.gnu.org; Thu, 03 Jan 2013 22:33:40 -0500 Received: from jik2.kamens.brookline.ma.us (209-6-65-228.c3-0.abr-ubr1.sbo-abr.ma.cable.rcn.com [209.6.65.228]) (authenticated bits=0) by jik3.kamens.brookline.ma.us (8.13.8/8.13.8) with ESMTP id r043XXUi029136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Jan 2013 22:33:33 -0500 Message-ID: <50E64D8D.1010201@kamens.us> Date: Thu, 03 Jan 2013 22:33:33 -0500 From: Jonathan Kamens User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> <87txqxr6y8.fsf@gnu.org> <50E649D6.4090808@kamens.us> <55obh51vlw.fsf@fencepost.gnu.org> In-Reply-To: <55obh51vlw.fsf@fencepost.gnu.org> Content-Type: multipart/alternative; boundary="------------010801010509080903060401" X-Scanned-By: MIMEDefang 2.73 on 128.177.28.63 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) This is a multi-part message in MIME format. --------------010801010509080903060401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Please read the WHOLE LIST OF COMMANDS I SENT in my test case. I made the file writable in that list only to modify it. If you read the whole list of commands, you will see that I make it unwritable again before editing it with emacs. And that's exactly the problem... if the file isn't writable, emacs assumes that it's not checked out and not modified it and checks it out when you hit C-x v v, overwriting the changes in it. --------------010801010509080903060401 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Please read the WHOLE LIST OF COMMANDS I SENT in my test case.

I made the file writable in that list only to modify it. If you read the whole list of commands, you will see that I make it unwritable again before editing it with emacs. And that's exactly the problem... if the file isn't writable, emacs assumes that it's not checked out and not modified it and checks it out when you hit C-x v v, overwriting the changes in it.

--------------010801010509080903060401-- From unknown Mon Aug 18 17:59:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11490: vc-next-action overwrites changes in non-checked-out RCS file Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Jan 2013 09:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11490 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed help To: Glenn Morris Cc: Jonathan Kamens , 11490@debbugs.gnu.org Received: via spool by 11490-submit@debbugs.gnu.org id=B11490.13573782755264 (code B ref 11490); Sat, 05 Jan 2013 09:32:02 +0000 Received: (at 11490) by debbugs.gnu.org; 5 Jan 2013 09:31:15 +0000 Received: from localhost ([127.0.0.1]:44290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrQ5z-0001Mr-89 for submit@debbugs.gnu.org; Sat, 05 Jan 2013 04:31:15 -0500 Received: from mail-pb0-f47.google.com ([209.85.160.47]:43623) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrQ5x-0001Mk-28 for 11490@debbugs.gnu.org; Sat, 05 Jan 2013 04:31:14 -0500 Received: by mail-pb0-f47.google.com with SMTP id un1so9614281pbc.6 for <11490@debbugs.gnu.org>; Sat, 05 Jan 2013 01:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=H+mEtHlWY+9t7nlCcUtAacGfU5r3YSV4RRqhGaSaBSg=; b=RJeEZZckPQyQ0yfPB1sOClXYvV71RnU5X7h4sOsb5NnJBxoF/q/DRYxFiNtEMS3TA8 QSTPRqgJm4t+u+azagKyysyiFKafS9h6kwt19XMkp+wPssLDBWgWIoJu2vt766p69/6Z qZxz/3paM9s0k0d3QBNtiTG35FFlFhIJrJKLjpivvT8ewSXmQRr40sM/cbjQsnuFWIyK 67On1oBocOnPh5E6/242rM2kfI8JWC5fk12IG2OUXxdvjQXrcAUfCRIybn/aCQAEFaHF f8o6Cov/qU0Ed7Z6oajZEiRo/aBd4GeYJXMVUVNRiGNGUPdBBEarlBTe5wUBF0LIxR1k vLUQ== X-Received: by 10.68.235.2 with SMTP id ui2mr169201240pbc.163.1357378259765; Sat, 05 Jan 2013 01:30:59 -0800 (PST) Received: from tsparkle (cm107.delta179.maxonline.com.sg. [59.189.179.107]) by mx.google.com with ESMTPS id is6sm33807502pbc.55.2013.01.05.01.30.56 (version=SSLv3 cipher=OTHER); Sat, 05 Jan 2013 01:30:58 -0800 (PST) From: Chong Yidong References: <4FB40003.3050502@kamens.us> <4FB451AE.60508@kamens.us> <4FB65ECA.6000205@kamens.us> <87txqxr6y8.fsf@gnu.org> <50E649D6.4090808@kamens.us> <55obh51vlw.fsf@fencepost.gnu.org> <50E64D8D.1010201@kamens.us> Date: Tue, 02 Apr 2013 17:30:54 +0800 In-Reply-To: <50E64D8D.1010201@kamens.us> (Jonathan Kamens's message of "Thu, 03 Jan 2013 22:33:33 -0500") Message-ID: <87mwthp9dd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Jonathan Kamens writes: > Please read the WHOLE LIST OF COMMANDS I SENT in my test case. > > I made the file writable in that list only to modify it. If you read > the whole list of commands, you will see that I make it unwritable > again before editing it with emacs. And that's exactly the problem... > if the file isn't writable, emacs assumes that it's not checked out > and not modified it and checks it out when you hit C-x v v, > overwriting the changes in it. [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.47 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (seewhydee[at]gmail.com) 2.2 DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: date -0.0 SPF_PASS SPF: sender matches SPF record -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% [score: 0.2157] 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.4 (/) Jonathan Kamens writes: > Please read the WHOLE LIST OF COMMANDS I SENT in my test case. > > I made the file writable in that list only to modify it. If you read > the whole list of commands, you will see that I make it unwritable > again before editing it with emacs. And that's exactly the problem... > if the file isn't writable, emacs assumes that it's not checked out > and not modified it and checks it out when you hit C-x v v, > overwriting the changes in it. OK, so the original bug is fixed by changing `vc-mistrust-permissions' to t, indeed. As for the problem Glenn just pointed out, it arises because VC caches the state of the file when it is first visited (via vc-state-refresh). The following patch (against trunk) should fix this, but I haven't had time to give it much testing yet. === modified file 'lisp/vc/vc-hooks.el' *** lisp/vc/vc-hooks.el 2013-01-02 16:13:04 +0000 --- lisp/vc/vc-hooks.el 2013-04-02 09:23:22 +0000 *************** *** 703,719 **** ;; the state to 'edited and redisplay the mode line. (let* ((file buffer-file-name) (backend (vc-backend file))) ! (and backend ! (or (and (equal (vc-file-getprop file 'vc-checkout-time) ! (nth 5 (file-attributes file))) ! ;; File has been saved in the same second in which ! ;; it was checked out. Clear the checkout-time ! ;; to avoid confusion. ! (vc-file-setprop file 'vc-checkout-time nil)) ! t) ! (eq (vc-checkout-model backend (list file)) 'implicit) ! (vc-state-refresh file backend) ! (vc-mode-line file backend)) ;; Try to avoid unnecessary work, a *vc-dir* buffer is ;; present if this is true. (when vc-dir-buffers --- 703,723 ---- ;; the state to 'edited and redisplay the mode line. (let* ((file buffer-file-name) (backend (vc-backend file))) ! (when backend ! (if (eq (vc-checkout-model backend (list file)) 'implicit) ! (progn ! ;; If the file was saved in the same second in which it ! ;; was checked out, clear the checkout-time to avoid ! ;; confusion. ! (if (equal (vc-file-getprop file 'vc-checkout-time) ! (nth 5 (file-attributes file))) ! (vc-file-setprop file 'vc-checkout-time nil)) ! (if (vc-state-refresh file backend) ! (vc-mode-line file backend))) ! ;; If we saved an unlocked file on a locking based VCS, that ! ;; file is not longer up-to-date. ! (if (eq (vc-file-getprop file 'vc-state) 'up-to-date) ! (vc-file-setprop file 'vc-state nil)))) ;; Try to avoid unnecessary work, a *vc-dir* buffer is ;; present if this is true. (when vc-dir-buffers === modified file 'lisp/vc/vc.el' *** lisp/vc/vc.el 2013-01-02 16:13:04 +0000 --- lisp/vc/vc.el 2013-04-02 09:30:28 +0000 *************** *** 1072,1077 **** --- 1072,1087 ---- ;; among all the `files'. (model (nth 4 vc-fileset))) + ;; If a buffer has unsaved changes, a checkout would discard them. + (when (and (not (eq model 'implicit)) + (eq state 'up-to-date)) + (let ((files files) + buffer) + (while files + (setq buffer (get-file-buffer (car files))) + (and buffer (buffer-modified-p buffer) + (setq state 'unlocked-changes files nil))))) + ;; Do the right thing (cond ((eq state 'missing) From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 05 21:59:31 2013 Received: (at control) by debbugs.gnu.org; 6 Jan 2013 02:59:31 +0000 Received: from localhost ([127.0.0.1]:46810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrgSQ-0007HH-9d for submit@debbugs.gnu.org; Sat, 05 Jan 2013 21:59:31 -0500 Received: from mail-da0-f50.google.com ([209.85.210.50]:36492) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TrgSN-0007HC-Vp for control@debbugs.gnu.org; Sat, 05 Jan 2013 21:59:28 -0500 Received: by mail-da0-f50.google.com with SMTP id h15so8130259dan.23 for ; Sat, 05 Jan 2013 18:59:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:subject:date:message-id:mime-version :content-type; bh=MSSU0JdowHicYHOHzoIHNALleONGTkYfLZ8uqBm81lo=; b=UXZFEwVadrL895VC3FoNMF09KUZPxLoFX3r2mXr7mIHXbXYqao9e1jKlKu7HrkNUKY VDbntj5xyIIGxhasn8R/OkwyFEhYFJDWZcuRx4BT504gS7iTXjBqS/ptGnPZrxWbCPC9 s10S1Qlzgcf4V3G2QwZdDQ5XVcne42pYObAtvN1ZO4i56LfzeYfQHpgBES5zPMFuGpAs LA9cV4ZZ3ko15E8rgEzS4NsjYETVonkBOABlRH3UzmXLiIRmtJ0Fm1xIW1zHAr3QifYA +HQJYYJWlJWrZ/xu4AzI7GUFkHxy3m3oWaNd25knA4MrSJJU+JhLGV0inC7hgUEtgPRB 4jVA== X-Received: by 10.69.0.8 with SMTP id au8mr176622660pbd.58.1357441150566; Sat, 05 Jan 2013 18:59:10 -0800 (PST) Received: from tsparkle (cm107.delta179.maxonline.com.sg. [59.189.179.107]) by mx.google.com with ESMTPS id m3sm36050003pav.4.2013.01.05.18.59.07 (version=SSLv3 cipher=OTHER); Sat, 05 Jan 2013 18:59:09 -0800 (PST) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 11490 Date: Sun, 06 Jan 2013 10:59:05 +0800 Message-ID: <87pq1jkoee.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) close 11490 thanks