>>>> Hamish Macdonald <hamishm(a)lucent.com> writes:
Hamish> When I use gnuclient to attempt to edit or view a file for
Hamish> which I do not have read permissions, the file-error raised
Hamish> causes gnuserv to die, requiring gnuserv to be restarted.
Followup: I did some more investigation, and discovered that on an
error raised by the evaluation of the client request,
gnuserv-process-filter tries to write back the error to the client
using the gnuserv-current-client variable, except that in my case,
gnuserv-edit-files has nil-ed out gnuserv-current-client as seen in
the lisp code below (from gnuserv.el). This nil is then passed to
gnuserv, which can't parse a "%d/%d" client-id/length out of the
result. The sscanf in gnuserv.c:handle_response should probably have
its return value (the number of items scanned) examined. In my case,
sscanf can't scan an integer, leaving the result_len variable
undefined, since it is never initialized to zero. On my machine,
gnuserv exits with a stderr error message I never see.
For now, I've worked around the problem by commenting out the nil-ing
of gnuserv-current-client in gnuserv-edit-files.
Regards,
Hamish.
----------------------------------------------------------------------
;; "Execute" a client connection, called by gnuclient. This is the
;; backbone of gnuserv.el.
(defun gnuserv-edit-files (type list &rest flags)
"For each (line-number . file) pair in LIST, edit the file at line-number.
The visited buffers are memorized, so that when \\[gnuserv-edit] is invoked
in such a buffer, or when it is killed, or the client's device deleted, the
client will be invoked that the edit is finished.
TYPE should either be a (tty TTY TERM PID) list, or (x DISPLAY) list.
If a flag is `quick', just edit the files in Emacs.
If a flag is `view', view the files read-only."
(let (quick view)
(mapc (lambda (flag)
(case flag
(quick (setq quick t))
(view (setq view t))
[...]
(client (make-gnuclient :id gnuserv-current-client
:device device
:frame new-frame)))
=> (setq gnuserv-current-client nil)
;; If the device was created by this client, push it to the list.
(and (/= old-device-num (length (device-list)))
(push device gnuserv-devices))
(and (frame-iconified-p frame)
(deiconify-frame frame))
;; Visit all the listed files.
(while list
(let ((line (caar list)) (path (cdar list)))
(select-frame frame)
;; Visit the file.
(funcall (if view
gnuserv-view-file-function
gnuserv-find-file-function)
path)
(goto-line line)
[...]
--=-=-=--