all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Magnus Henoch <mange@freemail.hu>
To: emacs-pretest-bug@gnu.org
Subject: 23.0.50; ^D inserted into network streams
Date: Sun, 02 Dec 2007 14:51:58 +0100	[thread overview]
Message-ID: <871wa56w75.fsf@freemail.hu> (raw)

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

             reply	other threads:[~2007-12-02 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-02 13:51 Magnus Henoch [this message]
2007-12-03  6:10 ` 23.0.50; ^D inserted into network streams Richard Stallman
2007-12-24  5:56   ` YAMAMOTO Mitsuharu
2007-12-24 21:55     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871wa56w75.fsf@freemail.hu \
    --to=mange@freemail.hu \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.