GNU bug report logs - #5297
23.1; vc: fails to follow symlinks inside HOME

Previous Next

Package: emacs;

Reported by: Yuya Nishihara <yuya <at> tcha.org>

Date: Sun, 3 Jan 2010 13:06:03 UTC

Severity: normal

Tags: patch

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5297 in the body.
You can then email your comments to 5297 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5297; Package emacs. (Sun, 03 Jan 2010 13:06:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuya Nishihara <yuya <at> tcha.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 03 Jan 2010 13:06:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yuya Nishihara <yuya <at> tcha.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; vc: fails to follow symlinks inside HOME
Date: Sun, 3 Jan 2010 15:33:43 +0900
When detecting vc backend, vc-find-file-hook passes buffer-file-truename
to vc-backend function. However, because buffer-file-truename is *abbreviated*,
following vc-hg-registered or vc-git-registered just fails.

Also it seems bad to test equalness of buffer-file-name
and buffer-file-truename. Maybe buffer-file-name is expanded,
but buffer-file-truename is abbreviated.


In GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.3)
 of 2009-11-02 on excelsior, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ja_JP.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  cua-mode: t
  tabbar-mwheel-mode: t
  tabbar-mode: t
  highlight-symbol-mode: t
  hi-lock-mode: t
  global-linum-mode: t
  linum-mode: t
  hl-line-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r <tab> <return>

Recent messages:
Loading /etc/emacs/site-start.d/50php-elisp.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /etc/emacs/site-start.d/50pymacs.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
Loading /etc/emacs/site-start.d/50python-mode.el (source)...done
Loading /etc/emacs/site-start.d/50ruby1.8-elisp.el (source)...done
Loading /etc/emacs/site-start.d/50yaml-mode.el (source)...done
Loading cua-base...done
Loading paren...done
For information about GNU Emacs and the GNU system, type <f1> C-a.






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5297; Package emacs. (Tue, 05 Jan 2010 14:09:11 GMT) Full text and rfc822 format available.

Message #8 received at 5297 <at> debbugs.gnu.org (full text, mbox):

From: Yuya Nishihara <yuya <at> tcha.org>
To: 5297 <at> debbugs.gnu.org
Cc: Yuya Nishihara <yuya <at> tcha.org>
Subject: bug#5297: Re: 23.1; vc: fails to follow symlinks inside HOME
Date: Sun, 3 Jan 2010 23:10:47 +0900
Hi,

> When detecting vc backend, vc-find-file-hook passes buffer-file-truename
> to vc-backend function. However, because buffer-file-truename is *abbreviated*,
> following vc-hg-registered or vc-git-registered just fails.

The following snippet is workaround for the problem:

--
(defadvice vc-backend (before vc-backend-fix-abbrev-name activate)
  "Fixes vc-backend to expand abbreviated buffer-file-truename"
  (if (stringp (ad-get-arg 0))
      (ad-set-arg 0 (expand-file-name (ad-get-arg 0)))))
--

Yuya.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5297; Package emacs. (Tue, 05 Jan 2010 14:09:11 GMT) Full text and rfc822 format available.

Message #11 received at 5297 <at> debbugs.gnu.org (full text, mbox):

From: Yuya Nishihara <yuya <at> tcha.org>
To: 5297 <at> debbugs.gnu.org
Cc: Yuya Nishihara <yuya <at> tcha.org>
Subject: bug#5297: [PATCH] vc: fixed test of symlinks on abbreviatable path
Date: Sun, 3 Jan 2010 23:05:06 +0900
commit 51431c222c24bbe2919d3d98032f73723ebfccea
Author: Yuya Nishihara <yuya <at> tcha.org>
Date:   Sun Jan 3 14:12:56 2010 +0900

    vc: fixed test of symlinks on abbreviatable path
    
    buffer-file-truename is *abbreviated* truename, but buffer-file-name seems not,
    so we need to expand it.
    
    With abbreviated file-name, at least, vc-git and vc-hg are not detected
    as backend. This means symlinks to git/hg-managed files on HOME directory
    are not handled by vc-find-file-hook.

diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index fabb35f..238fafe 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -890,8 +890,9 @@ current, and kill the buffer that visits the link."
 	  (set (make-local-variable 'backup-inhibited) t))
 	;; Let the backend setup any buffer-local things he needs.
 	(vc-call-backend backend 'find-file-hook))
-       ((let ((link-type (and (not (equal buffer-file-name buffer-file-truename))
-			      (vc-backend buffer-file-truename))))
+       ((let* ((truename (expand-file-name buffer-file-truename))
+	       (link-type (and (not (equal buffer-file-name truename))
+			       (vc-backend truename))))
 	  (cond ((not link-type) nil)	;Nothing to do.
 		((eq vc-follow-symlinks nil)
 		 (message




Added tag(s) patch. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 20 Jan 2010 01:41:02 GMT) Full text and rfc822 format available.

Reply sent to Chong Yidong <cyd <at> gnu.org>:
You have taken responsibility. (Sat, 01 Dec 2012 13:29:02 GMT) Full text and rfc822 format available.

Notification sent to Yuya Nishihara <yuya <at> tcha.org>:
bug acknowledged by developer. (Sat, 01 Dec 2012 13:29:03 GMT) Full text and rfc822 format available.

Message #18 received at 5297-done <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Yuya Nishihara <yuya <at> tcha.org>
Cc: 5297-done <at> debbugs.gnu.org
Subject: Re: bug#5297: [PATCH] vc: fixed test of symlinks on abbreviatable path
Date: Sat, 01 Dec 2012 21:26:02 +0800
Yuya Nishihara <yuya <at> tcha.org> writes:

>     vc: fixed test of symlinks on abbreviatable path
>     
>     buffer-file-truename is *abbreviated* truename, but
>     buffer-file-name seems not, so we need to expand it.
>     
>     With abbreviated file-name, at least, vc-git and vc-hg are not detected
>     as backend. This means symlinks to git/hg-managed files on HOME directory
>     are not handled by vc-find-file-hook.

Sorry for the long delay.  I didn't have a test case, but this patch
looks correct so I've installed it in trunk.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 30 Dec 2012 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 176 days ago.

Previous Next


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