Re: Does CLX understand xauth protocol?
Fred Gilham <[email protected]> Mon, 11 Dec 2006 13:49:35 -0800
| Newsgroups | gmane.lisp.clx.devel |
|---|---|
| Message-ID | <[email protected]> |
Rildo Pragana <[email protected]> wrote: > Hi, > > What should I expect to do so CLX can work? > I have tried with several lisps (sbcl, clisp, and ecl). In all cases I > get a message like "X-Error: Connection failure to X11.0 server > display 0: No protocol specified", > when doing (xlib:open-display ""). Of course, all other toolkits and > applications (mostly written in C) work as expected with the same > :local X server. Even in tcl/tk, I'm able to do "send" from one > interpreter to others. > If I disable access control (by doing "xhost +"), then all CLX > programs work. > What's wrong with CLX? I think there's a bug in the open-display function in display.lisp. Currently it's (defun open-display (host &key (display 0) protocol authorization-name authorization-data) ;; Implementation specific routine to setup the buffer for a ;; specific host and display. This must interface with the local ;; network facilities, and will probably do special things to ;; circumvent the nework when displaying on the local host. ;; ;; A string must be acceptable as a host, but otherwise the possible types ;; for host and protocol are not constrained, and will likely be very ;; system dependent. The default protocol is system specific. Authorization, ;; if any, is assumed to come from the environment somehow. (declare (type integer display)) (declare (clx-values display)) ;; Get the authorization mechanism from the environment. Handle the ;; special case of a host name of "" and "unix" which means the ;; protocol is :local (when (null authorization-name) (multiple-value-setq (authorization-name authorization-data) (get-best-authorization host display (if (member host '("" "unix") :test #'equal) :local protocol)))) ;; PROTOCOL is the network protocol (something like :TCP :DNA or :CHAOS). See OPEN-X-STREAM. (let* ((stream (open-x-stream host display protocol)) (disp (make-buffer *output-buffer-size* #'make-display-internal :host host :display display :output-stream stream :input-stream stream)) (ok-p nil)) (unwind-protect (progn (display-connect disp :authorization-name authorization-name :authorization-data authorization-data) (setf (display-authorization-name disp) authorization-name) (setf (display-authorization-data disp) authorization-data) (initialize-resource-allocator disp) (initialize-predefined-atoms disp) (initialize-extensions disp) (setq ok-p t)) (unless ok-p (close-display disp :abort t))) disp)) In this case the special casing of "" and "unix" for host names to indicate a local protocol is only done in the call to get-best-authorization. But I think it also needs to be done in the open-display call as well. The following diffs seem to work. I'm not quite sure why the first diff is there. I think it fixes some other problem. But the second diff I did myself to fix the problem described above. *** clx-release/display.lisp Tue Aug 22 17:33:28 2006 --- clx_0/display.lisp Mon Dec 11 13:41:34 2006 *************** *** 350,357 **** gethostname(3) - is used instead." (destructuring-bind (host display screen protocol) (get-default-display display-name) ! (declare (ignore screen)) ! (open-display host :display display :protocol protocol))) (defun open-display (host &key (display 0) protocol authorization-name authorization-data) ;; Implementation specific routine to setup the buffer for a --- 350,358 ---- gethostname(3) - is used instead." (destructuring-bind (host display screen protocol) (get-default-display display-name) ! (let ((display (open-display host :display display :protocol protocol))) ! (setf (display-default-screen display) (nth screen (display-roots display))) ! display))) (defun open-display (host &key (display 0) protocol authorization-name authorization-data) ;; Implementation specific routine to setup the buffer for a *************** *** 368,380 **** ;; Get the authorization mechanism from the environment. Handle the ;; special case of a host name of "" and "unix" which means the ;; protocol is :local (when (null authorization-name) (multiple-value-setq (authorization-name authorization-data) ! (get-best-authorization host ! display ! (if (member host '("" "unix") :test #'equal) ! :local ! protocol)))) ;; PROTOCOL is the network protocol (something like :TCP :DNA or :CHAOS). See OPEN-X-STREAM. (let* ((stream (open-x-stream host display protocol)) (disp (make-buffer *output-buffer-size* #'make-display-internal --- 369,379 ---- ;; Get the authorization mechanism from the environment. Handle the ;; special case of a host name of "" and "unix" which means the ;; protocol is :local + (when (member host '("" "unix") :test #'equal) + (setf protocol :local)) (when (null authorization-name) (multiple-value-setq (authorization-name authorization-data) ! (get-best-authorization host display protocol))) ;; PROTOCOL is the network protocol (something like :TCP :DNA or :CHAOS). See OPEN-X-STREAM. (let* ((stream (open-x-stream host display protocol)) (disp (make-buffer *output-buffer-size* #'make-display-internal Hope this helps. -- Fred Gilham [email protected] All languages have Lisp syntax, of course, except that so many of them insist on encrypting it using a mechanism called "grammar." -- Drew McDermott _______________________________________________ Portable-clx mailing list [email protected] http://lists.metacircles.com/cgi-bin/mailman/listinfo/portable-clx See http://www.cliki.net/clx for darcs URL(s)