* Binary network communication appears broken
@ 2008-03-27 16:51 Harald Hanche-Olsen
2008-03-27 18:52 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Harald Hanche-Olsen @ 2008-03-27 16:51 UTC (permalink / raw)
To: emacs-pretest-bug
I discovered this because it breaks mew:
(This is with CVS emacs as of yesterday.
I spent many hours debugging my way to this simple test case.)
Define this function:
(defun test-net (coding)
(interactive "SUse coding: ")
(make-network-process
:name "testproc"
:host 'local :service 9898 :family 'ipv4
:buffer "*testproc*"
:coding coding
:filter (lambda (proc string)
(setq *test* string ))
:sentinel (lambda (proc string)
(delete-process proc))))
Set up a network service on port 9898 on localhost that just echos a
short string, then disconnect. The string should contain some
non-ASCII character. I used the string "målbar" (encoded as latin-1)
with a newline appended, total 7 bytes. (I used a one line shell
script under tcpserver. I suppose you could use inetd as well.)
Now run: M-x test-net RET binary RET
(Also tested with raw-text and no-conversion, same result.)
The string *test* now contains a string that appears to be 5
characters long: (insert *test*) certainly inserts 5 characters,
though (length *test*) returns 7. The string appears to be "m_ar\n",
where there is really a Chinese character in the position I indicated
with an underscore. (I am bending over backwards to avoid making this
a unicode encoded email. The character in question is #x5b22, if you
must know.) However, if I examine the characters of the text using
aref, it turns out to contain what I expected, except ?å is replaced
by #x5b22 again.
- Harald
PS. Please Cc me on replies, as I am not on the list. It appears
to be impossible to sign up for this list?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Binary network communication appears broken
2008-03-27 16:51 Binary network communication appears broken Harald Hanche-Olsen
@ 2008-03-27 18:52 ` Stefan Monnier
2008-03-27 20:09 ` Harald Hanche-Olsen
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2008-03-27 18:52 UTC (permalink / raw)
To: Harald Hanche-Olsen; +Cc: emacs-pretest-bug
> I discovered this because it breaks mew:
> (This is with CVS emacs as of yesterday.
> I spent many hours debugging my way to this simple test case.)
> Define this function:
> (defun test-net (coding)
> (interactive "SUse coding: ")
> (make-network-process
> :name "testproc"
> :host 'local :service 9898 :family 'ipv4
> :buffer "*testproc*"
> :coding coding
> :filter (lambda (proc string)
> (setq *test* string ))
> :sentinel (lambda (proc string)
> (delete-process proc))))
Thank you very much for your efforts.
Does the patch below help?
Stefan
--- coding.c.~1.374.~ 2008-03-25 11:59:11.000000000 -0400
+++ coding.c 2008-03-27 14:51:31.000000000 -0400
@@ -7030,10 +7030,10 @@
|| (! NILP (CODING_ATTR_POST_READ (attrs))
&& NILP (dst_object)))
{
- coding->dst_object = code_conversion_save (1, 1);
+ coding->dst_multibyte = !CODING_FOR_UNIBYTE (coding);
+ coding->dst_object = code_conversion_save (1, coding->dst_multibyte);
coding->dst_pos = BEG;
coding->dst_pos_byte = BEG_BYTE;
- coding->dst_multibyte = !CODING_FOR_UNIBYTE (coding);
}
else if (BUFFERP (dst_object))
{
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Binary network communication appears broken
2008-03-27 18:52 ` Stefan Monnier
@ 2008-03-27 20:09 ` Harald Hanche-Olsen
0 siblings, 0 replies; 3+ messages in thread
From: Harald Hanche-Olsen @ 2008-03-27 20:09 UTC (permalink / raw)
To: monnier; +Cc: emacs-pretest-bug
+ Stefan Monnier <monnier@iro.umontreal.ca>:
> Thank you very much for your efforts.
No problem. It still beats writing my own emacs from scratch, by quite
a few orders of magnitude. 8-) A big part of the problem was that I
would get characters in a buffer that weren't really characters, and
then emacs would crash when trying to display this non-characters. Or
at least that is how it seemed to me.
> Does the patch below help?
Yes indeed! To prove it, I am responding from the patched emacs.
Thank you.
- Harald
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-27 20:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27 16:51 Binary network communication appears broken Harald Hanche-Olsen
2008-03-27 18:52 ` Stefan Monnier
2008-03-27 20:09 ` Harald Hanche-Olsen
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).