Subject: Re: bug#5414: 23.1.91; /sys/devices files trigger loading tramp

From: Michael Albinus <[email-masked]>
Date: Wed, 20 Jan 2010 20:05:31 +0100

Chong Yidong <[email-masked]> writes:

> Here's a proper recipe for reproducing this (the previous recipe does
> not do it, maybe it was untested):
>
>  emacs -Q
>  C-x C-f
>  C-a C-k
>  /sys/devices/pc [TAB]
>     => Tramp will be loaded

Thanks, I can reproduce it as well.

Tramp is loaded due to `rfn-eshadow-update-overlay'. In the loop
commented with "Binary search ...", it recomputes `mid', and calls
`rfn-eshadow-sifn-equal'. This function applies
`substitute-in-file-name' for a part of the the whole file name, which
looks like a remote file name, accidently. Bingo!

See the backtrace:

  tramp-file-name-handler(substitute-in-file-name "/pci0000:00/")
  substitute-in-file-name("/pci0000:00/")
  byte-code("ÁÂd\"!" [pos substitute-in-file-name buffer-substring-no-properties] 4)
  byte-code("ÆÇ !È!É d;	='TÊËÌ*;
=ÊËÌ*
T	Wa	TdW	TÊËÌ*	Td
	\\Í¥ÊËÌ*{<;ÎÉ 
#ÏÐ!," [rfn-eshadow-overlay end start mid goal pos substitute-in-file-name minibuffer-contents overlay-end minibuffer-prompt-end nil (byte-code "ÁÂd\"!" [pos substitute-in-file-name buffer-substring-no-properties] 4) ((error)) 2 move-overlay run-hooks rfn-eshadow-update-overlay-hook] 5)
  rfn-eshadow-update-overlay()
  run-hooks(post-command-hook)

I wouldn't regard it as a bug. One could argue, that rfn-shadow should
deactivate file name handlers for its work, but this might result in
collateral damages.

Best regards, Michael.