all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 23.0.50; ^D inserted into network streams
@ 2007-12-02 13:51 Magnus Henoch
  2007-12-03  6:10 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Magnus Henoch @ 2007-12-02 13:51 UTC (permalink / raw)
  To: emacs-pretest-bug

When sending binary data (in particular, data where newlines are more
than 250 bytes apart) on a network connection, Emacs sometimes inserts
^D bytes.  This seems to be a heisenbug; it doesn't always happen.

A test case:

;; Make a netcat receiver: nc -l -p 10000 >/tmp/output

(defun test-stream-pollution (file host port)
  (interactive 
   (list
    (read-file-name "Send file: " nil nil t)
    (read-string "Connect to host (default `127.0.0.1'): "
		 nil nil "127.0.0.1")
    (read-number "Connect to port: " 10000)))
  (let* ((conn (open-network-stream "pollution" nil host port)))
    (set-process-coding-system conn 'binary 'binary)
    (with-temp-buffer 
      (insert-file-contents-literally file)
      (message "Sending file...")
      (process-send-region conn (point-min) (point-max))
      (message "Sending file...done"))
    (delete-process conn)))

If the file sent is binary by the above definition, the two copies of
the file will sometimes differ in that a ^D is inserted every 250th
byte.

The following patch seems to fix the problem.  Is it the proper fix?
Should it be applied to both trunk and branch(es)?  Do more fields need
initialization?

2007-12-02  Magnus Henoch  <mange@freemail.hu>

	* process.c (make_process): Initialize pty_flag to 0.

--- a/src/process.c
+++ b/src/process.c
@@ -634,6 +634,7 @@ make_process (name)
   p->raw_status_new = 0;
   p->status = Qrun;
   p->mark = Fmake_marker ();
+  p->pty_flag = 0;
 
 #ifdef ADAPTIVE_READ_BUFFERING
   p->adaptive_read_buffering = 0;




In GNU Emacs 23.0.50.2 (powerpc-unknown-netbsd4.99.36, GTK+ Version 2.12.0)
 of 2007-12-02 on zemdatav
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: C/l

Minor modes in effect:
  display-time-mode: t
  jabber-activity-mode: t
  jabber-mode-line-mode: t
  iswitchb-mode: t
  icomplete-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

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

end of thread, other threads:[~2007-12-24 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-02 13:51 23.0.50; ^D inserted into network streams Magnus Henoch
2007-12-03  6:10 ` Richard Stallman
2007-12-24  5:56   ` YAMAMOTO Mitsuharu
2007-12-24 21:55     ` Richard Stallman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.