From: rittle@comm.mot.com (Loren James Rittle)
Subject: bug and fix in server.el
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 6 Jan 1993 10:18:41 GMT

Dear GNU Emacs maintainer:

I have tracked down a bug in server.el (18.56 & 18.58 and most
likely, earlier releases as well).

The problem:

If two or more emacsclient's send in requests to server at about
the same time, it is possible that server.el will receive more
than one client's line of input at a time from server (IMHO from
looking at all the pieces, this can happen any time server.el
gets behind in processing requests from server).  The process
filter in server.el didn't handle this case at all.  The result
was a mess and a confused server.el.

I am so glad that I obtained all the source to the text editor I
use daily.  I happily provide the source diff needed to fix this
problem.

Regards,
Loren J. Rittle

The bug fix diffs:

*** /usr/local/lib/emacs/lisp/server.el	Mon Sep  2 19:28:21 1991
--- server.el	Wed Jan  6 15:21:03 1993
***************
*** 2,6 ****
  ;; Copyright (C) 1986, 1987, 1990 Free Software Foundation, Inc.
  ;; Author William Sommerfeld, wesommer@athena.mit.edu.
! ;; Changes by peck@sun.com and by rms.
  
  ;; This file is part of GNU Emacs.
--- 2,6 ----
  ;; Copyright (C) 1986, 1987, 1990 Free Software Foundation, Inc.
  ;; Author William Sommerfeld, wesommer@athena.mit.edu.
! ;; Changes by peck@sun.com and by rms and by rittle@comm.mot.com.
  
  ;; This file is part of GNU Emacs.
***************
*** 133,143 ****
    (server-log string)
    (setq string (concat server-previous-string string))
!   (if (not (and (eq ?\n (aref string (1- (length string))))
! 		(eq 0 (string-match "Client: " string))))
!       ;; If input is not complete, save it for later.
        (setq server-previous-string string)
!     ;; If it is complete, process it now, and discard what was saved.
!     (setq string (substring string (match-end 0)))
      (setq server-previous-string "")
      (let ((client (list (substring string 0 (string-match " " string))))
  	  (files nil)
--- 133,145 ----
    (server-log string)
    (setq string (concat server-previous-string string))
!   ;; Setup server-previous-string in case we fall through while loop.
    (setq server-previous-string string)
!   (while (eq 0 (string-match "Client: \\(.*\n\\)" string))
!     ;; While a complete record is available:
!     ;; process it, and discard it from the input string.
!     (if (eq (length string) (1+ (match-end 0)))
  	(setq server-previous-string "")
+       (setq server-previous-string (substring string (match-end 0))))
+     (setq string (substring string (match-beginning 1) (match-end 1)))
      (let ((client (list (substring string 0 (string-match " " string))))
  	  (files nil)
***************
*** 157,163 ****
        ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
        (setq server-clients (cons client server-clients))
        (switch-to-buffer (nth 1 client))
        (message (substitute-command-keys
! 		"When done with a buffer, type \\[server-edit].")))))
  
  (defun server-visit-files (files client)
--- 159,173 ----
        ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
        (setq server-clients (cons client server-clients))
+       ;; local addition to allow emacs to open a new window for our client,
+       ;; if needed.  Considered to be needed, if name not *scratch*.
+       ;(if (not (string-equal "*scratch*" (buffer-name (window-buffer))))
+ 	;  (split-window-vertically))
        (switch-to-buffer (nth 1 client))
        (message (substitute-command-keys
! 		"When done with a buffer, type \\[server-edit]."))
!       ;; local addition to allow emacs to pop to front when a client first
!       ;; accesses it. NOTE: x-pop-window is a local addition to emacs.
!       ;(x-pop-window)
!       (setq string server-previous-string))))
  
  (defun server-visit-files (files client)

x-gateway: rodan.UU.NET from bug-vm to gnu.emacs.vm.bug; Thu, 7 Jan 1993 15:09:26 EST
Date: Thu, 7 Jan 1993 15:08:29 -0500
From: kyle@crystal.wonderworks.com (Kyle Jones)
Subject: Unable to load vm.elc
Newsgroups: gnu.emacs.vm.bug