unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* "Connection broken" message appearing in odd places in buffers
@ 2011-09-14 22:04 Lars Magne Ingebrigtsen
  2011-09-14 22:14 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-14 22:04 UTC (permalink / raw)
  To: emacs-devel

When a network connection is shut down, Emacs helpfully inserts a string
like "Process smtpmail connection broken by remote peer" in the process
buffer.  (It's probably a feature, but I could live without it.)

However, the odd thing is that it seems to be output in ... odd places.
Here's the smtpmail trace buffer:

---------
220 hermes.netfonds.no ESMTP Exim 4.72 Thu, 15 Sep 2011 00:01:53 +0200
250-hermes.netfonds.no Hello cm-84.215.51.58.getinternet.no [84.215.51.58]
250-SIZE 52428800
250-PIPELINING
250-STARTTLS
250 HELP
220 TLS go ahead
250-hermes.netfonds.no Hello cm-84.215.51.58.getinternet.no [84.215.51.58]
250-SIZE 52428800
250-PIPELINING
250-AUTH PLAIN
250 HELP

Process smtpmail connection broken by remote peer
AUTH PLAIN <omitted>
235 Authentication succeeded
MAIL FROM:<larsi@gnus.org> SIZE=1530
250 OK

[...]

250 OK id=1R3xWj-0001jq-Mt
QUIT
221 hermes.netfonds.no closing connection
---------

So the "broken by remote peer" string is inserted way up there, and not
where you'd expect -- at the end of the buffer.

This seems like a bug to me, I think, but I thought I'd ask here first
if anybody knows what this is about.

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Connection broken" message appearing in odd places in buffers
  2011-09-14 22:04 "Connection broken" message appearing in odd places in buffers Lars Magne Ingebrigtsen
@ 2011-09-14 22:14 ` Lars Magne Ingebrigtsen
  2011-09-14 22:46   ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-14 22:14 UTC (permalink / raw)
  To: emacs-devel

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> This seems like a bug to me, I think, but I thought I'd ask here first
> if anybody knows what this is about.

It's this code in status_notify that's the culprit:

	      /* Insert new output into buffer
		 at the current end-of-output marker,
		 thus preserving logical ordering of input and output.  */
	      if (XMARKER (p->mark)->buffer)
		Fgoto_char (p->mark);
	      else
		SET_PT_BOTH (ZV, ZV_BYTE);

And if I added a trace to output the process-mark throughout the
conversation, I get this:

Mark: #<marker at 363 in *trace of SMTP session to hermes.netfonds.no*>
235 Authentication succeeded
Mark: #<marker at 363 in *trace of SMTP session to hermes.netfonds.no*>
250 OK
Mark: #<marker at 363 in *trace of SMTP session to hermes.netfonds.no*>
250 Accepted
Mark: #<marker at 363 in *trace of SMTP session to hermes.netfonds.no*>
354 Enter message, ending with "." on a line by itself
Sending email...done
Mark: #<marker at 363 in *trace of SMTP session to hermes.netfonds.no*>
250 OK id=1R3xha-0001tb-Ic
Mark: #<marker at 363 in *trace of SMTP session to hermes.netfonds.no*>

So the process-mark stays at character 363, and that's where it outputs
the message.  So the question is, I guess -- why doesn't the marker
increase?  Because the output from the process gets inserted at the end
of the buffer.

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Connection broken" message appearing in odd places in buffers
  2011-09-14 22:14 ` Lars Magne Ingebrigtsen
@ 2011-09-14 22:46   ` Lars Magne Ingebrigtsen
  2011-09-14 22:52     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-14 22:46 UTC (permalink / raw)
  To: emacs-devel

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> So the process-mark stays at character 363, and that's where it outputs
> the message.  So the question is, I guess -- why doesn't the marker
> increase? 

It's as if this code doesn't get run, for some reason, in
read_process_output. 

      /* Make sure the process marker's position is valid when the
	 process buffer is changed in the signal_after_change above.
	 W3 is known to do that.  */
      if (BUFFERP (p->buffer)
	  && (b = XBUFFER (p->buffer), b != current_buffer))
	set_marker_both (p->mark, p->buffer, BUF_PT (b), BUF_PT_BYTE (b));
      else
	set_marker_both (p->mark, p->buffer, PT, PT_BYTE);

And from reading the code, that just seems impossible.          

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Connection broken" message appearing in odd places in buffers
  2011-09-14 22:46   ` Lars Magne Ingebrigtsen
@ 2011-09-14 22:52     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-14 22:52 UTC (permalink / raw)
  To: emacs-devel

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> And from reading the code, that just seems impossible.          

D'oh.  smtpmail uses an output filter.  That just inserts everything at
the end of the buffer.

Double d'oh.

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-14 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-14 22:04 "Connection broken" message appearing in odd places in buffers Lars Magne Ingebrigtsen
2011-09-14 22:14 ` Lars Magne Ingebrigtsen
2011-09-14 22:46   ` Lars Magne Ingebrigtsen
2011-09-14 22:52     ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).