From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: don@donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#454: marked as done (file-precious-flag overwrites symlinks) Date: Sat, 2 Aug 2008 14:15:08 -0700 Message-ID: References: <87vdyj9lca.fsf@stupidchicken.com> <20080620171828.4FC98F40D9C3@momoland.openchat.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1217711707-2501-0" X-Trace: ger.gmane.org 1217712459 20924 80.91.229.12 (2 Aug 2008 21:27:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Aug 2008 21:27:39 +0000 (UTC) To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 02 23:28:29 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KPOeK-0006Pv-LD for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Aug 2008 23:28:29 +0200 Original-Received: from localhost ([127.0.0.1]:50592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPOdP-0001Ou-PP for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Aug 2008 17:27:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPOdK-0001OV-6P for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 17:27:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPOdJ-0001OF-OZ for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 17:27:25 -0400 Original-Received: from [199.232.76.173] (port=60023 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPOdJ-0001O7-BQ for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 17:27:25 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:34802) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KPOdI-000255-PB for bug-gnu-emacs@gnu.org; Sat, 02 Aug 2008 17:27:25 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m72LRLlc006468; Sat, 2 Aug 2008 14:27:22 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m72LF8Ki002586; Sat, 2 Aug 2008 14:15:08 -0700 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: don@donarmstrong.com X-Emacs-PR-Message: closed 454 X-Emacs-PR-Package: emacs X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:18980 Archived-At: This is a multi-part message in MIME format... ------------=_1217711707-2501-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Sat, 02 Aug 2008 17:08:05 -0400 with message-id <87vdyj9lca.fsf@stupidchicken.com> and subject line Re: file-precious-flag overwrites symlinks has caused the Emacs bug report #454, regarding file-precious-flag overwrites symlinks to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) --=20 454: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D454 Emacs Bug Tracking System Contact don@donarmstrong.com with problems ------------=_1217711707-2501-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.6 required=4.0 tests=BAYES_00,FOURLA, IMPRONONCABLE_1,MURPHY_WRONG_WORD1,MURPHY_WRONG_WORD2,RCVD_IN_DNSWL_LOW autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 20 Jun 2008 17:50:59 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5KHoseh031504 for ; Fri, 20 Jun 2008 10:50:56 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K9klC-0000kc-DF for bug-gnu-emacs@gnu.org; Fri, 20 Jun 2008 13:50:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K9klC-0000k7-1S for bug-gnu-emacs@gnu.org; Fri, 20 Jun 2008 13:50:54 -0400 Received: from [199.232.76.173] (port=49490 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9klB-0000jg-HU for bug-gnu-emacs@gnu.org; Fri, 20 Jun 2008 13:50:53 -0400 Received: from p84-72.acedsl.com ([66.114.84.72]:27399 helo=momoland.openchat.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K9klA-0003Ny-85 for bug-gnu-emacs@gnu.org; Fri, 20 Jun 2008 13:50:52 -0400 Received: by momoland.openchat.com (Postfix, from userid 1000) id 4FC98F40D9C3; Fri, 20 Jun 2008 13:18:28 -0400 (EDT) From: Max Mikhanosha To: bug-gnu-emacs@gnu.org Subject: file-precious-flag overwrites symlinks Message-Id: <20080620171828.4FC98F40D9C3@momoland.openchat.com> Date: Fri, 20 Jun 2008 13:18:28 -0400 (EDT) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 1942 seconds by postgrey-1.27 at monty-python; Fri, 20 Jun 2008 13:50:51 EDT I keep my .emacs file under version control as part of overall collection of config files, and as result ~/.emacs is a symbolic link. `backup-by-copying-when-linked' is set to t, so visiting ~/.emacs and then editing and saving it correctly saves the file that symlink is pointing too. For a long time I was trying to track down why sometimes, my ~/.emacs symbolic link is suddenly overwritten by the actual file. Finally found that this happens when one uses "Save for future session" in customize package, and farther tracked it down to a behavior of `basic-save-buffer-2' when file-precious-flag is set. Test case: -rw-r--r-- 1 max users 4 Jun 20 12:57 file lrwxrwxrwx 1 max users 4 Jun 20 12:58 link -> file backup-by-copying-when-linked => t file-precious-flag => nil Visit "link" edit and save -rw-r--r-- 1 max users 14 Jun 20 12:59 file lrwxrwxrwx 1 max users 4 Jun 20 12:58 link -> file Everything fine.. backup-by-copying-when-linked => t file-precious-flag => t Visit "link" edit and save -rw-r--r-- 1 max users 14 Jun 20 12:59 file -rw-r--r-- 1 max users 24 Jun 20 13:00 link Overwrites symlink The offending code in basic-save-buffer-2 is: ;; We succeeded in writing the temp file ;; so rename it. (rename-file tempname buffer-file-name t)) Above should refer to buffer-file-truename IMHO. The documentation for file-precious-flag mentiones that it will break hardlinks, but does not mention that it will break symlinks. If this behavour is not a bug, then maybe its a bug for custom-save-all to set file-precious-flag, causing an suprise to the user as to why ~/.emacs symlink is getting overwritten. In GNU Emacs 22.2.1 (x86_64-suse-linux-gnu, GTK+ Version 2.10.6) of 2008-04-09 on momoland configured using `configure '--with-gcc' '--with-pop' '--without-hesiod' '--with-kerberos' '--with-kerberos5' '--with-leim' '--with-xim' '--with-system-malloc' '--prefix=/usr' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--with-x' '--with-sound' '--with-xpm' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--with-x-toolkit=gtk' '--x-includes=/usr/include' '--x-libraries=/usr/lib64:/usr/share/X11' '--build=x86_64-suse-linux-gnu' 'build_alias=x86_64-suse-linux-gnu' 'CC=gcc' 'CFLAGS=-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -std=gnu89 -pipe -fno-strict-aliasing -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label -DSYSTEM_PURESIZE_EXTRA=55000 -DSITELOAD_PURESIZE_EXTRA=10000 ' 'L DFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: C locale-coding-system: nil default-enable-multibyte-characters: t Major mode: Fundamental Minor modes in effect: mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-x C-f C-g i i C-x C-f C-g C-x C-b * C-x o ESC O B RET ( s e t q SPC f i l e DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL M-x - s e DEL DEL DEL s e t - v a r i TAB RET b a c k u p - b y - c o p TAB - TAB l TAB RET t RET C-x C-f l i n k RET o l a l DEL DEL DEL ESC [ 4 ~ ESC [ 4 ~ ESC O B b DEL s o m e SPC t e x t C-x C-x M-x s a v e - b u f DEL DEL DEL DEL TAB - b u f f e r RET M-x s e t - v a r i a b l e RET f i l e - p r e TAB RET t RET RET m o r e SPC t e x t M-x M-p M-p RET C-x b TAB ESC O B ESC O B M-x s u b m i t - b u TAB DEL DEL DEL DEL DEL DEL DEL DEL DEL r e p o r t - e m TAB RET Recent messages: exchange-point-and-mark: No mark set in this buffer Making completion list... Wrote /home/max/link [2 times] Making completion list... next-history-element: End of history; no next item Quit Loading emacsbug... Loading regexp-opt...done Loading emacsbug...done call-interactively: Text is read-only ------------=_1217711707-2501-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.1 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 454-done) by emacsbugs.donarmstrong.com; 2 Aug 2008 21:07:57 +0000 Received: from cyd (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m72L7sgN000727 for <454-done@emacsbugs.donarmstrong.com>; Sat, 2 Aug 2008 14:07:56 -0700 Received: by cyd (Postfix, from userid 1000) id DA85957E337; Sat, 2 Aug 2008 17:08:05 -0400 (EDT) From: Chong Yidong To: Max Mikhanosha Cc: 454-done@emacsbugs.donarmstrong.com Subject: Re: file-precious-flag overwrites symlinks References: <87zlnzq8vj.fsf@stupidchicken.com> <877ib1wcl4.wl%max@openchat.com> Date: Sat, 02 Aug 2008 17:08:05 -0400 In-Reply-To: <877ib1wcl4.wl%max@openchat.com> (Max Mikhanosha's message of "Fri, 01 Aug 2008 01:04:07 -0400") Message-ID: <87vdyj9lca.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I see the bug now. I've checked in a fix, thanks. ------------=_1217711707-2501-0--