Subject: Re: bug#23883: 24.4.51; tramp sometimes reports "Args out of range" error when resuming editing a remote file after a period of inactivity

From: Michael Albinus <[email-masked]>
Date: Mon, 08 Aug 2016 11:28:52 +0200

Version: 25.2

Hi Michael,

> And here we are. Tramp claims a problem. The preserved position from
> above is given to `tramp-process-actions' as argument, for further
> handling. And because it is not valid anymore (remember, a large value),
> it is out of the scope of the current buffer contents. Error.
>
>> You asked about the remote file name: they are mainly Perl source
>> code, but the same thing happens with a variety of file types.  I am
>> hoping that you can figure out what method is causing the problem from
>> the debug trace.  If not, can you tell me which ones should be
>> checked?  I can trace through the code while it is working and try to
>> figure out which method is being called.
>
> Well, likely it is sufficient to reset the preserved position when the
> buffer is cleaned up. Something like this:
>
> *** /home/albinus/src/tramp/lisp/tramp-sh.el.~608444a67599b876fa6c861338e6ebe4b8468d31~	2016-07-29 14:55:39.779097246 +0200
> --- /home/albinus/src/tramp/lisp/tramp-sh.el	2016-07-29 14:51:04.279291259 +0200
> ***************
> *** 4668,4674 ****
>   	    (tramp-error vec 'file-error "Awake did fail")))
>         (file-error
>          (tramp-cleanup-connection vec t)
> !        (setq p nil)))
>
>       ;; New connection must be opened.
>       (condition-case err
> --- 4668,4675 ----
>   	    (tramp-error vec 'file-error "Awake did fail")))
>         (file-error
>          (tramp-cleanup-connection vec t)
> !        (setq pos (with-current-buffer (tramp-get-connection-buffer vec) (point))
> ! 	     p nil)))
>
>       ;; New connection must be opened.
>       (condition-case err
>
> The line numbers in tramp-sh.el might differ (I've applied the patch in
> Tramp's master repo), but you shall find where to apply.
>
> Could you, pls, tell whether it works for you?

I've committed a modified version of this patch to the Emacs and Tramp
repositories, closing this bug. If it doesn't work for you, feel free to
reopen.

>>   -- Michael

Best regards, Michael.