Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Filename auto complete doesn't work in tramp mode

12 views
Skip to first unread message

Ravi

unread,
May 21, 2013, 2:27:41 AM5/21/13
to help-gn...@gnu.org
H
​i,

I am using tramp mode in Emacs to edit files over ssh. Though listing of
directories works fine when I open it over ssh, but filename auto complete
doesn't work at all.

What can I do to further troubleshoot the problem?

Thanks,

Ravi A

Michael Albinus

unread,
May 21, 2013, 3:54:15 AM5/21/13
to Ravi, help-gn...@gnu.org
Ravi <ra.ra...@gmail.com> writes:

> Hi,

Hi Ravi,
Could you, please, give an example what does not work? Which keys have
you entered, and what shall be the expected result?

Do you load any completion package? Does the problem happen when you
start "emacs -Q"?

And which Emacs / Tramp version are you using?

> Thanks,
>
> Ravi A

Best regards, Michael.

ken

unread,
May 21, 2013, 4:03:20 AM5/21/13
to Michael Albinus, help-gn...@gnu.org, Ravi
On 05/21/2013 03:54 AM Michael Albinus wrote:
> Ravi <ra.ra...@gmail.com> writes:
>
>> Hi,
>
> Hi Ravi,
>
>> I am using tramp mode in Emacs to edit files over ssh. Though listing of
>> directories works fine when I open it over ssh, but filename auto complete
>> doesn't work at all.
>>
>> What can I do to further troubleshoot the problem?

;; To find version do C-x C-e at end of this line: tramp-version
;; Just for debugging.
(setq tramp-verbose 9)
(setq tramp-debug-buffer t)


> ....



Ravi

unread,
May 22, 2013, 2:34:30 AM5/22/13
to Michael Albinus, help-gn...@gnu.org
H
​i Michael,

Thanks for replying.​


Could you, please, give an example what does not work? Which keys have
> you entered, and what shall be the expected result?
>

When I am using tramp, I press C-x C-f and get this prompt
/scpc:myserver_name_changed.com:/home/​ I press TAB it waits for the
network to return the list of files in the directory but then it shows [No
match] in Mini Buffer.


> Do you load any completion package?

​No.​ Filename completion for local files works just out of box.



> Does the problem happen when you
> start "emacs -Q"?
>
​Yes



> And which Emacs / Tramp version are you using?
>
​2.2.3-24.1​

Ravi

unread,
May 22, 2013, 2:35:46 AM5/22/13
to geb...@mousecar.com, help-gn...@gnu.org, Michael Albinus
Hi Ken,

Thanks for replying.

Tramp version I am using is: ​2.2.3-24.1​

The debug output is available at: http://pastebin.com/PZuxs1St

Thanks,
Ravi



--
http://raviforyou.xolve.net <http://raviforyou.blogspot.com> ◄

Michael Albinus

unread,
May 22, 2013, 4:46:26 AM5/22/13
to Ravi, help-gn...@gnu.org
Ravi <ra.ra...@gmail.com> writes:

> Hi Ken,

Hi Ravi,

> The debug output is available at: http://pastebin.com/PZuxs1St

In the debug output, there is the following sequence (shortened):

00:10:03.198174 tramp-send-command (6) # tramp_perl_file_name_all_completions /home/username/ '' 0
00:10:03.513918 tramp-wait-for-regexp (6) #
///4a9849cafd12e16baecfd05f1384e262#$
00:10:03.514405 tramp-sh-handle-file-name-all-completions (1) # File error: tramp-sh-handle-file-name-all-completions: internal error accessing `/home/username/': `'

That means, that Tramp sends the command
"tramp_perl_file_name_all_completions /home/username/ '' 0", which is an
internal shell function which Tramp has declared earlier. It returns an
empty output, "///4a9849cafd12e16baecfd05f1384e262#$" is just the shell
prompt for Tramp.

That internal shell function does not work correctly; it shall return as
last output line "ok\n". 'Cause this line is missing, Tramp speaks about
an internal error.

So we need to debug that shell function, which is mainly the call of a
Perl script.

First step is to check, that there are no wrong connection properties
left in Tramp due to a previous connection. Could you, please, perform
"M-x tramp-cleanup-all-connections" and rerun the test?

I would also like to see the *whole* debug buffer of that test. If you
do not want to publish it due to internal sensitive information, you
might send it to me directly.

> Thanks,
> Ravi

Best regards, Michael.

Ravi

unread,
May 23, 2013, 8:21:44 AM5/23/13
to Michael Albinus, help-gn...@gnu.org
>
> Hi Ravi,
>

​Hi Michael,

In the debug output, there is the following sequence (shortened):
>
> 00:10:03.198174 tramp-send-command (6) #
> tramp_perl_file_name_all_completions /home/username/ '' 0
> 00:10:03.513918 tramp-wait-for-regexp (6) #
> ///4a9849cafd12e16baecfd05f1384e262#$
> 00:10:03.514405 tramp-sh-handle-file-name-all-completions (1) # File
> error: tramp-sh-handle-file-name-all-completions: internal error accessing
> `/home/username/': `'
>
> That means, that Tramp sends the command
> "tramp_perl_file_name_all_completions /home/username/ '' 0", which is an
> internal shell function which Tramp has declared earlier. It returns an
> empty output, "///4a9849cafd12e16baecfd05f1384e262#$" is just the shell
> prompt for Tramp.
>
> That internal shell function does not work correctly; it shall return as
> last output line "ok\n". 'Cause this line is missing, Tramp speaks about
> an internal error.
>

​Thanks, at least its some start! I do not know Perl and know little elisp
but will surely try to triage the problem as much as I can.​


So we need to debug that shell function, which is mainly the call of a
> Perl script.
>
> First step is to check, that there are no wrong connection properties
> left in Tramp due to a previous connection. Could you, please, perform
> "M-x tramp-cleanup-all-connections" and rerun the test?
>

​I performed the actions as you mentioned. Following are the results:

1. After ​"M-x tramp-cleanup-all-connections" , C-x C-f , enter path as
"/scpc:myserver_name_changed.com:/home/" and pres TAB. It asks for
passphrase and opens the connection, which succeeds. But it gives the error:

"ssh: Could not resolve hostname scpc: Name or service not known"

2. Do C-x C-f again, enter path: "/scpc:myserver_name_changed.com:/home/"
and press TAB. It will wait for the command to complete and will show "[No
match]" next to path in mini-buffer.​

I would also like to see the *whole* debug buffer of that test. If you
> do not want to publish it due to internal sensitive information, you
> might send it to me directly.
>

​The log ​is available in base64 encoding at: http://pastebin.com/qbbAFC8n
(you can copy paste text in a text editor, save it and run command "base64
-d <filename>" to get original contents)



> Best regards, Michael.
>

​Thanks a lot for you efforts Michael.
-Ravi​

Michael Albinus

unread,
May 23, 2013, 9:03:22 AM5/23/13
to Ravi, help-gn...@gnu.org
Ravi <ra.ra...@gmail.com> writes:

> Hi Michael,

Hi Ravi,

> Thanks, at least its some start! I do not know Perl and know little
> elisp but will surely try to triage the problem as much as I can.​
>
> The log is available in base64 encoding at:
> http://pastebin.com/qbbAFC8n
> (you can copy paste text in a text editor, save it and run command
> "base64 -d <filename>" to get original contents)

Thanks for this. In fact, "M-x base64-decode-region" in an Emacs buffer
is sufficient :-)

Well, it looks like there is a Perl problem on your remote host. Tramp
checks for Perl versions, but it might not be good enough in your case.

What happens, if you call the following in a remote shell on that host:

--8<---------------cut here---------------start------------->8---
which \perl5
--8<---------------cut here---------------end--------------->8---

And if it looks trustworthy, please call the following in the remote
shell:

--8<---------------cut here---------------start------------->8---
\perl5 -e 'sub case {
my $str = shift;
if ($ARGV[2]) {
return lc($str);
}
else {
return $str;
}
}
opendir(d, $ARGV[0]) || die("$ARGV[0]: $!\nfail\n");
@files = readdir(d); closedir(d);
foreach $f (@files) {
if (case(substr($f, 0, length($ARGV[1]))) eq case($ARGV[1])) {
if (-d "$ARGV[0]/$f") {
print "$f/\n";
}
else {
print "$f\n";
}
}
}
print "ok\n"
' /home/ '' 0
--8<---------------cut here---------------end--------------->8---

> Thanks a lot for you efforts Michael.
> -Ravi

Best regards, Michael.

Ravi

unread,
May 23, 2013, 10:23:34 AM5/23/13
to Michael Albinus, help-gn...@gnu.org
> Hi Ravi,
>
​Hi Michael,​



> Thanks for this. In fact, "M-x base64-decode-region" in an Emacs buffer
> is sufficient :-)
>
​Gee! Emacs rocks !



> Well, it looks like there is a Perl problem on your remote host. Tramp
> checks for Perl versions, but it might not be good enough in your case.
>
> What happens, if you call the following in a remote shell on that host:
>
> --8<---------------cut here---------------start------------->8---
> which \perl5
> --8<---------------cut here---------------end--------------->8---
>

​I get "/usr/local/bin/perl5​". But this is broken, because of a missing
library:

$ ldd /usr/local/redhat/packages/local/bin/perl5.00503
linux-gate.so.1 => (0xffffe000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00bf1000)
libdb.so.3 => not found
libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0xf7eb1000)
libdl.so.2 => /lib/libdl.so.2 (0x00810000)
libm.so.6 => /lib/libm.so.6 (0x00833000)
libc.so.6 => /lib/libc.so.6 (0x006b4000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xf7e7e000)
/lib/ld-linux.so.2 (0x00691000)

​And it will error out as:

"error while loading shared libraries: libdb.so.3: cannot open shared
object file: No such file or directory"​



> And if it looks trustworthy, please call the following in the remote
> shell:
>
> --8<---------------cut here---------------start------------->8---
> ​​
> \perl
> ​5​
> -e 'sub case {
> my $str = shift;
> if ($ARGV[2]) {
> return lc($str);
> }
> else {
> return $str;
> }
> }
> opendir(d, $ARGV[0]) || die("$ARGV[0]: $!\nfail\n");
> @files = readdir(d); closedir(d);
> foreach $f (@files) {
> if (case(substr($f, 0, length($ARGV[1]))) eq case($ARGV[1])) {
> if (-d "$ARGV[0]/$f") {
> print "$f/\n";
> }
> else {
> print "$f\n";
> }
> }
> }
> print "ok\n"
> ' /home/ '' 0
> --8<---------------cut here---------------end--------------->8---
>

​If I run the snippet with perl5 replaced with perl it will run fine with
following output:

./
../
username/
ok

​Yeah! now we know Perl package is the problem. What I have to do so that
tram uses "perl" instead of "perl5". You really helped in pinpointing the
issue with great precision!

Best regards, Michael.
>

​Thanks and Regards,
Ravi​

Michael Albinus

unread,
May 24, 2013, 3:17:13 AM5/24/13
to Ravi, help-gn...@gnu.org
Ravi <ra.ra...@gmail.com> writes:

> Hi Michael,

Hi Ravi,

> Yeah! now we know Perl package is the problem. What I have to do so
> that tram uses "perl" instead of "perl5".

Best would be to fix Perl5 on that remote machine. But I understand that
it might not be possible when the remote machine is not under your control.

Tramp checks several properties of a remote machine during connection
setup, like the Perl binary to be used. Since Tramp 2.2.7, such
properties can be overwritten by own values - exactly what you need. You
might add the following into your .emacs after loading Tramp:

(add-to-list 'tramp-connection-properties
(list (regexp-quote "your.server.name") "perl" "/path/to/perl"))

You could either install Tramp 2.2.7 from its ftp archive, or you could
switch to the development version of Emacs, which contains Tramp 2.2.8-pre.

> Thanks and Regards,
> Ravi

Best regards, Michael.

Ravi

unread,
May 24, 2013, 9:22:49 AM5/24/13
to Michael Albinus, help-gn...@gnu.org
Hi Ravi,
>
​Hi ​
Michael
​,​


Best would be to fix Perl5 on that remote machine. But I understand that
> it might not be possible when the remote machine is not under your control.
>
> Tramp checks several properties of a remote machine during connection
> setup, like the Perl binary to be used. Since Tramp 2.2.7, such
> properties can be overwritten by own values - exactly what you need. You
> might add the following into your .emacs after loading Tramp:
>
> (add-to-list 'tramp-connection-properties
> (list (regexp-quote "your.server.name") "perl"
> "/path/to/perl"))
>
> You could either install Tramp 2.2.7 from its ftp archive, or you could
> switch to the development version of Emacs, which contains Tramp 2.2.8-pre.
>

​Thanks a lot!! this ​is really great work you are doing, we all users
appreciate it :)



> Best regards, Michael.
>

​Thanks Again,
Ravi​
0 new messages