GNU bug report logs - #80054
Tramp adb erases the current buffer

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 22 Dec 2025 17:54:01 UTC

Severity: normal

To reply to this bug, email your comments to 80054 AT debbugs.gnu.org.

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

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


Report forwarded to michael.albinus <at> gmx.de, luangruo <at> yahoo.com, bug-gnu-emacs <at> gnu.org:
bug#80054; Package emacs. (Mon, 22 Dec 2025 17:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to michael.albinus <at> gmx.de, luangruo <at> yahoo.com, bug-gnu-emacs <at> gnu.org. (Mon, 22 Dec 2025 17:54:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Tramp adb erases the current buffer
Date: Mon, 22 Dec 2025 19:50:25 +0200
'erase-buffer' in 'tramp-adb-handle-file-name-all-completions' has such
disastrous effect that any function that uses completions such as e.g.
'(directory-files "/adb::/")' or when 'icomplete-mode' is enabled
completely erases the buffer where 'C-x d /adb::/ RET' was invoked.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80054; Package emacs. (Tue, 23 Dec 2025 09:13:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Juri Linkov <juri <at> linkov.net>
Cc: luangruo <at> yahoo.com, 80054 <at> debbugs.gnu.org
Subject: Re: bug#80054: Tramp adb erases the current buffer
Date: Tue, 23 Dec 2025 10:12:22 +0100
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> linkov.net> writes:

Hi Juri,

> 'erase-buffer' in 'tramp-adb-handle-file-name-all-completions' has such
> disastrous effect that any function that uses completions such as e.g.
> '(directory-files "/adb::/")' or when 'icomplete-mode' is enabled
> completely erases the buffer where 'C-x d /adb::/ RET' was invoked.

Ouch. Could you, pls, test the appended patch?

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80054; Package emacs. (Tue, 23 Dec 2025 17:59:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: luangruo <at> yahoo.com, 80054 <at> debbugs.gnu.org
Subject: Re: bug#80054: Tramp adb erases the current buffer
Date: Tue, 23 Dec 2025 19:50:37 +0200
>> 'erase-buffer' in 'tramp-adb-handle-file-name-all-completions' has such
>> disastrous effect that any function that uses completions such as e.g.
>> '(directory-files "/adb::/")' or when 'icomplete-mode' is enabled
>> completely erases the buffer where 'C-x d /adb::/ RET' was invoked.
>
> Ouch. Could you, pls, test the appended patch?
> [...]
> -	 (unless (tramp-adb-send-command-and-check
> -		  v (format "(%s -a %s; echo tramp_exit_status $?) | cat"
> -			    (tramp-adb-get-ls-command v)
> -			    (tramp-shell-quote-argument localname))
> -                  nil t)
> -	   (erase-buffer))
> -	 (mapcar
> - [...]
> +	 (when (tramp-adb-send-command-and-check
> +		v (format "(%s -a %s; echo tramp_exit_status $?) | cat"
> +			  (tramp-adb-get-ls-command v)
> +			  (tramp-shell-quote-argument localname))
> +                nil t)
> +	   (mapcar

With this patch (directory-files "/adb::/") returns only ("." ".."),
but omits all other existing files.  What gives the correct result
is to run the command unconditionally, not erase the buffer in any case,
and then continue with 'mapcar', etc.

The problem is that 'ls' sometimes returns 1, even when run
successfully, e.g.:

  adb shell "(ls -1 -a /; echo tramp_exit_status $?) | cat"

returns 1 when there are some files with permission warnings.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80054; Package emacs. (Tue, 23 Dec 2025 18:46:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Juri Linkov <juri <at> linkov.net>
Cc: luangruo <at> yahoo.com, 80054 <at> debbugs.gnu.org
Subject: Re: bug#80054: Tramp adb erases the current buffer
Date: Tue, 23 Dec 2025 19:44:53 +0100
Juri Linkov <juri <at> linkov.net> writes:

Hi Juri,

>> [...]
>> -	 (unless (tramp-adb-send-command-and-check
>> -		  v (format "(%s -a %s; echo tramp_exit_status $?) | cat"
>> -			    (tramp-adb-get-ls-command v)
>> -			    (tramp-shell-quote-argument localname))
>> -                  nil t)
>> -	   (erase-buffer))
>> -	 (mapcar
>> - [...]
>> +	 (when (tramp-adb-send-command-and-check
>> +		v (format "(%s -a %s; echo tramp_exit_status $?) | cat"
>> +			  (tramp-adb-get-ls-command v)
>> +			  (tramp-shell-quote-argument localname))
>> +                nil t)
>> +	   (mapcar
>
> With this patch (directory-files "/adb::/") returns only ("." ".."),
> but omits all other existing files.  What gives the correct result
> is to run the command unconditionally, not erase the buffer in any case,
> and then continue with 'mapcar', etc.
>
> The problem is that 'ls' sometimes returns 1, even when run
> successfully, e.g.:
>
>   adb shell "(ls -1 -a /; echo tramp_exit_status $?) | cat"
>
> returns 1 when there are some files with permission warnings.

But then, Tramp cannot parse the ls output due to the error messages?

I cannot reproduce the problem locally. Could you, pls retry with
tramp-verbose set to 6? And send me the Tramp debug buffer afterwards?

Thanks, and best regards, Michael.




This bug report was last modified 1 day ago.

Previous Next


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