[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

23.0.50; ^D inserted into network streams

From: Magnus Henoch
Subject: 23.0.50; ^D inserted into network streams
Date: Sun, 02 Dec 2007 14:51:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (berkeley-unix)

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)
    (read-file-name "Send file: " nil nil t)
    (read-string "Connect to host (default `'): "
                 nil nil "")
    (read-number "Connect to port: " 10000)))
  (let* ((conn (open-network-stream "pollution" nil host port)))
    (set-process-coding-system conn 'binary 'binary)
      (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

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

2007-12-02  Magnus Henoch  <address@hidden>

        * 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;
   p->adaptive_read_buffering = 0;

In GNU Emacs (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]