From brechbuehler at gmail.com  Sat Oct 27 00:30:05 2007
From: brechbuehler at gmail.com (brechbuehler at gmail.com)
Date: Sat, 27 Oct 2007 00:30:05 +0200 (CEST)
Subject: [Rd] x11(....) kills R without DISPLAY (PR#10379)
Message-ID: <20071026223005.3CF422834619@mail.pubhealth.ku.dk>

Full_Name: Christian Brechbuehler
Version: 2.4.1, 2.5.1, 
OS: Ubuntu GNU/Linux
Submission from: (NULL) (24.61.47.236)


Context:
'X11' starts a graphics device driver on the display given by argument
'display'.

Problem:
If the environment variable DISPLAY is not set, the R process dies with exit
status 1.

Example (start R without DISPLAY from bash):
  % DISPLAY= R
  > x11("localhost:11.0")                        # this is my valid DISPLAY
  Error: Couldn't find per display information
  %

History:
This was reported before (e.g.,
https://stat.ethz.ch/pipermail/ess-help/2006-April/003464.html), but search
turns up no R Bug Report.

Reportedly this problem was introduced between R 2.2.1 and R 2.3.0.  The
following versions are affected:
  R 2.4.1 (Patched), 2007-03-25, svn.rev 40917, x86_64-unknown-linux-gnu
  R 2.5.1 (Patched), 2007-09-16, svn.rev 43071, x86_64-unknown-linux-gnu 
  R 2.6.0 (Patched), 2007-10-16, svn.rev 43176, x86_64-unknown-linux-gnu 
  R 2.6.0 (Patched), 2007-10-25, svn.rev 43271, x86_64-unknown-linux-gnu 
  R 2.7.0 (Under development (unstable)), 2007-10-25, svn.rev 43273,
x86_64-unknown-linux-gnu


Further Observations:

(A) If DISPLAY is set but not a valid X11 server, R dies equally.

(B) If DISPLAY is set to an X11 server on which I don't have access, the x11
call fails as follows:
| Error in x11("localhost:11.0") : 
|    X11 fatal IO error: please save work and shut down R
|
| Enter a frame number, or 0 to exit   
| 
| 1: x11("localhost:11.0")
|
| Selection:
I.e., the R session survives.  But it is not possible to start an X11 graphics
device driver.

(C) If DISPLAY is set to an X11 server on which I have access, the x11 call
succeeds, and it opens a window on the server named in the 'display' argument. 
Nothing happens on DISPLAY, which is appropriate.

My conjecture: R seems to first connect to the server given by the DISPLAY
environment variable, performing no visible operations, before heeding the
'display' argument.

(D) It is possible to swich between X11 servers (a.k.a. displays) on the fly by
using graphics.off() followed by x11(my.new.display).

When Googling, I found the error string "Couldn't find per display information"
sometimes associated with the Xt library.

I'd be happy to answer any questions that may help clarify the issue.



[Rd] x11(....) kills R without DISPLAY (PR#10379)
brechbuehler at gmail.com