povray icon indicating copy to clipboard operation
povray copied to clipboard

Unix, DISPLAY not set, +D option, problem after render

Open LeForgeron opened this issue 8 years ago • 1 comments

the input file is irrelevant. Recommended for test is (as sp.pov) #version 3.7; global_settings{ assumed_gamma 1.0} background { srgb 0.5 } sphere { 20*z, 2 pigment { color srgb <1,0,0> } }

$ unset DISPLAY $ povray -Isp.pov +H600 +W800 +A0.01 +D

After the run:

  • the cursor is invisible on the terminal
  • the echo of input is invisible
  • the output of commands (typed without seeing them) ignore line feed
  • interaction with mouse is different (no more copy paste, insert funny char instead)

A short way back to usable terminal is issuing stty sane, but it does not restore the cursor nor the mouse.

Notice that the +D option is default in configuration, so it might not need to be explicit on the command line.

A suitable behaviour would be to restore the terminal to its initial state.

LeForgeron avatar Nov 21 '16 18:11 LeForgeron

Running povray v3.8 beta 1 which uses Simple DirectMedia Layer 1.2 I can duplicate this issue.

Running versions of povray updated to use Simple DirectMedia Layer 2.0, we run cleanly without a display as if -d (text mode was used). My guess is SDL2.0 is perhaps creating a dummy X server / window when it cannot attach to one. In any case the result is reasonable - if likely a little confusing to the user.

Running versions of povray updated to use X11(Xlib), we get "Segmentation fault (core dumped)" in a way like what happens with an invalid DISPLAY value using SDL1.2 as seen with issue #157.


FWIW. In my povr branch at the top of function: "static vfeDisplay *UnixDisplayCreator" in vfe/unix/unixconsole.cpp I've added the code:

    if (gDisplayMode != DISP_MODE_TEXT)
    {
        bool errWithDISPLAY_ENV = false;
        const char* envPtr = nullptr;
        if (envPtr = std::getenv("DISPLAY"))
        {
            if (strlen(envPtr) <= 0)
                errWithDISPLAY_ENV = true;
        }
        else
        {
            errWithDISPLAY_ENV = true;
        }
        if (errWithDISPLAY_ENV)
        {
            fprintf(stderr, "\nProbable Error:\nDISPLAY environment variable necessary for preview window is "
                            "not set\nor invalid: \"%s\"\nSwitching to text only mode.\n\n",envPtr);
            gDisplayMode = DISP_MODE_TEXT;
        }
        bool errWithX11 = (XOpenDisplay(NULL)) ? 0 : 1;
        if (!errWithDISPLAY_ENV && errWithX11)
        {
            fprintf(stderr, "\nError:\nUnable to open a preview display window. The DISPLAY variable used\n"
                            "was: \"%s\"\nSwitching to text only mode.\n\n",envPtr);
            gDisplayMode = DISP_MODE_TEXT;
        }
    }

Which I believe addresses this issue and #157 no matter SDL1.2, SDL2.0 or X11(Xlib) preview window code.

wfpokorny avatar Aug 04 '21 10:08 wfpokorny