GNU bug report logs - #15494
[PATCH] 24.3.50; Processes running under TRAMP can't cleanly write to the middle of a buffer

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Mon, 30 Sep 2013 07:36:01 UTC

Severity: normal

Tags: patch

Done: Michael Albinus <michael.albinus <at> gmx.de>

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 15494 in the body.
You can then email your comments to 15494 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 bug-gnu-emacs <at> gnu.org:
bug#15494; Package emacs. (Mon, 30 Sep 2013 07:36:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Sep 2013 07:36:02 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 24.3.50;
 Processes running under TRAMP can't cleanly write to the middle of a
 buffer
Date: Mon, 30 Sep 2013 00:35:04 -0700
[Message part 1 (text/plain, inline)]
Hi.

I am observing that processes running over TRAMP overwrite all the
buffer contents after (point). This is irrelevant in the usual case
where the process output is going to the end of the buffer (there's
nothing after the point in that case). This is also something that works
fine with local (i.e. non-TRAMP) processes.

To be clear, an example emacs invocation appears below. This populates
the *scratch* buffer with

a b c
1 2 3

Then moves the point to the begging of the "1 2 3" line, and runs a
TRAMP process to insert the text "inserted". I would expect the
*scratch* buffer to end up with

a b c
inserted
1 2 3

If the process runs without TRAMP, this is indeed what happens. With
TRAMP, however, I get

a b c
inserted

Note that with TRAMP the "1 2 3" line got deleted. The example invocation:


 $ emacs -Q \
   --eval \
 '(defun test-filter(process output)
         (with-current-buffer (process-buffer process) (insert output)))' \
   --eval \
 '(defun test-sentinel(process event)
         )' \
   --eval \
 '(progn
    (insert "a b c\n1 2 3\n")
    (forward-line -1)
    (cd "/sudo::/tmp")
    (let ((process (start-file-process "echo" (get-buffer "*scratch*") "echo" "inserted")))
      (set-process-sentinel process `test-sentinel)
      (set-process-filter   process `test-filter)))'


This creates a process filter that simply inserts the process output,
and a sentinel that does nothing. The (cd "/sudo::/tmp") form is there
to force the process to run with TRAMP. Every TRAMP-based path I've
tried tickles this bug for me. Removing that form makes the process run
without TRAMP, and I do not see the buggy behavior then.

I'm observing this issue with the latest emacs24 release and with the
latest emacs built from the sources as of 2013/09/30. Emacs 23.4.1
appears to NOT have this bug. This is on a machine running Debian.

I'm attaching a patch that fixes this issue for me. The cause appears to
be a bit of code that deletes the system prompt from the TRAMP output.
There's a bug in that code that deletes more than just the prompt in the
case described above.

[0001-TRAMP-processes-no-longer-delete-their-buffer-conten.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15494; Package emacs. (Mon, 30 Sep 2013 07:53:01 GMT) Full text and rfc822 format available.

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

From: Dima Kogan <dima <at> secretsauce.net>
To: 15494 <at> debbugs.gnu.org
Subject: Improved patch
Date: Mon, 30 Sep 2013 00:52:14 -0700
[Message part 1 (text/plain, inline)]
I'm attaching a smaller patch that solves this in a somewhat cleaner
way.

[0001-TRAMP-processes-no-longer-delete-their-buffer-conten.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15494; Package emacs. (Wed, 24 Feb 2016 04:08:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 15494 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#15494: [PATCH] 24.3.50;
 Processes running under TRAMP can't cleanly write to the middle of a
 buffer
Date: Wed, 24 Feb 2016 15:07:12 +1100
Dima Kogan <dima <at> secretsauce.net> writes:

> Hi.
>
> I am observing that processes running over TRAMP overwrite all the
> buffer contents after (point). This is irrelevant in the usual case
> where the process output is going to the end of the buffer (there's
> nothing after the point in that case). This is also something that works
> fine with local (i.e. non-TRAMP) processes.
>
> To be clear, an example emacs invocation appears below. This populates
> the *scratch* buffer with
>
> a b c
> 1 2 3
>
> Then moves the point to the begging of the "1 2 3" line, and runs a
> TRAMP process to insert the text "inserted". I would expect the
> *scratch* buffer to end up with
>
> a b c
> inserted
> 1 2 3
>
> If the process runs without TRAMP, this is indeed what happens. With
> TRAMP, however, I get
>
> a b c
> inserted
>
> Note that with TRAMP the "1 2 3" line got deleted. The example invocation:
>
>  $ emacs -Q \
>    --eval \
>  '(defun test-filter(process output)
>          (with-current-buffer (process-buffer process) (insert output)))' \
>    --eval \
>  '(defun test-sentinel(process event)
>          )' \
>    --eval \
>  '(progn
>     (insert "a b c\n1 2 3\n")
>     (forward-line -1)
>     (cd "/sudo::/tmp")
>     (let ((process (start-file-process "echo" (get-buffer "*scratch*") "echo" "inserted")))
>       (set-process-sentinel process `test-sentinel)
>       (set-process-filter   process `test-filter)))'
>
> This creates a process filter that simply inserts the process output,
> and a sentinel that does nothing. The (cd "/sudo::/tmp") form is there
> to force the process to run with TRAMP. Every TRAMP-based path I've
> tried tickles this bug for me. Removing that form makes the process run
> without TRAMP, and I do not see the buggy behavior then.
>
> I'm observing this issue with the latest emacs24 release and with the
> latest emacs built from the sources as of 2013/09/30. Emacs 23.4.1
> appears to NOT have this bug. This is on a machine running Debian.
>
> I'm attaching a patch that fixes this issue for me. The cause appears to
> be a bit of code that deletes the system prompt from the TRAMP output.
> There's a bug in that code that deletes more than just the prompt in the
> case described above.

The patch makes sense to me.  Michael?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Wed, 24 Feb 2016 06:56:02 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dima <at> secretsauce.net>:
bug acknowledged by developer. (Wed, 24 Feb 2016 06:56:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 15494-done <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
Subject: Re: bug#15494: [PATCH] 24.3.50;
 Processes running under TRAMP can't cleanly write to the middle of a
 buffer
Date: Wed, 24 Feb 2016 07:55:27 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

Hi,

>> I'm attaching a patch that fixes this issue for me. The cause appears to
>> be a bit of code that deletes the system prompt from the TRAMP output.
>> There's a bug in that code that deletes more than just the prompt in the
>> case described above.
>
> The patch makes sense to me.  Michael?

I'm very sorry, but I've overlooked this bug report completely :-(

Fortunately, there was another bug report #16120, which speaks about the
same problem. And the solution is identical to what Dima proposed. It
was merged into the Emacs sources back in February 2014.

I'm closing this bug.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Mar 2016 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 148 days ago.

Previous Next


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