redhog / InfiniteGlass

Window manager with infinite desktop, infinite zoom and infinite window resolution
https://redhog.github.io/InfiniteGlass/
GNU General Public License v3.0
35 stars 5 forks source link

ICE and IPv6 #94

Open IanTrudel opened 10 months ago

IanTrudel commented 10 months ago

ICE seems to have troubles with IPv6 addresses. I hadn't noticed until now. Running the make command is indeed opening Xephyr, which is configured with -nolisten tcp. Shouldn't it use UNIX sockets?

xinit: XFree86_VT property unexpectedly has 0 items instead of 1
Copying 1
inet6/home:35539,inet/home:42161,local/unix:@/tmp/.ICE-unix/466144,unix/unix:/tmp/.ICE-unix/466144
Starting renderer without debugger
_IceTransSocketINETConnect() no usable address for home:35539
NEW CONN <glass_ghosts.session.Server object at 0x7f0b58a82fd0>
NEW CONN DONE <glass_ghosts.session.Server object at 0x7f0b58a82fd0> 139686708870720 {139686708870720: <glass_ghosts.session.Server.Connection object at 0x7f0b58a97e40>} 94084425539392 139686708870720

After blocking IPv6 in grub:

xinit: XFree86_VT property unexpectedly has 0 items instead of 1
Copying 1
_IceTransSocketOpenCOTSServer: Unable to open socket for inet6
_IceTransOpen: transport open failed for inet6/home:
_IceTransMakeAllCOTSServerListeners: failed to open listener for inet6
inet/home:33729,local/unix:@/tmp/.ICE-unix/8487,unix/unix:/tmp/.ICE-unix/8487
redhog commented 10 months ago

Maybe add -nolisten udp too? It is listening to unix sockets too (local/unix:@/tmp/.ICE-unix/466144,unix/unix:/tmp/.ICE-unix/466144)... Seems like by default it wants to listen to everything and doesn't fail very gracefully?

IanTrudel commented 10 months ago
GLASS_DEBUGGER="" BUILD="build" XSERVERPATH="/usr/bin/Xephyr" XSERVEROPTS=":100 -ac -screen 1280x768x24 -host-cursor -extension MIT-SHM -nolisten tcp -nolisten udp" scripts/xstartup.sh

_XSERVTransTransNoListen: unable to find transport: udp

This is confusing. The hardest thing about InfiniteGlass is reproducibility. For example, I managed to make it run on Arch Linux in a VM but not on an actual machine. Currently testing on Rocky Linux (on another machine) and still has troubles. The fixes in the esoteric branch improved things, including make run-in-docker but something ain't right. Also tried xhost + and used xauth to remove the IPv6 address.

By the way, GNOME is ending its support for X11 in favour of Wayland. I'm willing to commit to InfiniteGlass and be an active contributor.

IanTrudel commented 10 months ago

A simple ICE client-server revealed that those are only warnings. They do not prevent a connection from being established. I had to read the document that you referred in REFERENCES.MD and try a few things out. Still left with a blank Xephyr window and no explanation for it, though.

IanTrudel commented 10 months ago

Here is a bit more info on the topic. You may close this issue if you think we can move on.

Sample output from ice_server:

IceTransSocketOpenCOTSServer: Unable to open socket for inet6
_IceTransOpen: transport open failed for inet6/home:
_IceTransMakeAllCOTSServerListeners: failed to open listener for inet6
Number of transports: 3
Listening on: inet/home:44015
Listening on: local/unix:@/tmp/.ICE-unix/1233756
Listening on: unix/unix:/tmp/.ICE-unix/1233756
Accepted a connection

Building instructions

gcc ice_client.c -o ice_client -lICE
gcc ice_server.c -o ice_server -lICE

ice_server.c

#include <stdio.h>
#include <stdlib.h>
//#include <ICE/ICElib.h>
#include "/usr/include/X11/ICE/ICElib.h"

void protocolSetupProc(IceConn iceConn, int opcode, IcePointer clientData, int *authCountRet, char ***authNamesRet, IcePointer **authDataRet) {
  *authCountRet = 0;
  *authNamesRet = NULL;
  *authDataRet = NULL;
}

void ioErrorProc(IceConn iceConn) {
  printf("IO error occurred.\n");
}

int main() {
  IceListenObj *listenObjs;
  int numTransports;
  IceConn iceConn;
  IceAcceptStatus status;
  char errorString[128];
  int errorLength = sizeof(errorString);

  IceIOErrorHandler(ioErrorProc);

  if (!IceListenForConnections(&numTransports, &listenObjs, errorLength, errorString)) {
    printf("Failed to listen for ICE connections. Error: %s\n", errorString);
    return 1;
  }

  printf("Number of transports: %d\n", numTransports);
  for (int i = 0; i < numTransports; ++i) {
    char *addr = IceGetListenConnectionString(listenObjs[i]);
    printf("Listening on: %s\n", addr);
    free(addr);
  }

  while (1) {
    iceConn = IceAcceptConnection(listenObjs[0], &status);
    if (iceConn) {
      printf("Accepted a connection\n");
      IceSetShutdownNegotiation(iceConn, False);
    } else {
      printf("Failed to accept connection.\n");
      break;
    }
  }

  IceFreeListenObjs(numTransports, listenObjs);
  return 0;
}

ice_client.c

#include <stdio.h>
#include <stdlib.h>
//#include <ICE/ICElib.h>
#include "/usr/include/X11/ICE/ICElib.h"

void ioErrorProc(IceConn iceConn) {
  printf("IO error occurred.\n");
}

int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Usage: %s <port_number>\n", argv[0]);
    return 1;
  }

  int port_number = atoi(argv[1]);
  char networkId[50];
  snprintf(networkId, sizeof(networkId), "localhost:%d", port_number);

  IceConn iceConn;
  char errorString[128];
  int errorLength = sizeof(errorString);
  int majorOpcodeCheck = 0;  // Opcode to check; 0 typically means "don't care"

  IceIOErrorHandler(ioErrorProc);

  iceConn = IceOpenConnection(networkId, NULL, False, majorOpcodeCheck, errorLength, errorString);

  if (iceConn) {
    printf("Connected to ICE server.\n");
  } else {
    printf("Failed to connect to ICE server. Error: %s\n", errorString);
    return 1;
  }

  IceCloseConnection(iceConn);
  return 0;
}
redhog commented 9 months ago

"By the way, GNOME is ending its support for X11 in favour of Wayland. I'm willing to commit to InfiniteGlass and be an active contributor."

As you've noticed, I've had very little time for InfiniteGlass (or any other hobby dev for that sake) lately, and I will have even less soon, as me and my girlfriend are expecting a child in January.

That said, it is awesome if you want to do development, and I will try to answer any questions I can!

IanTrudel commented 9 months ago

This is a fantastic news! May you all be a happy family!

Your guidance will be more than enough. One thing that would really be helpful is to see your development workflow when you work (and debug) on InfiniteGlass. You could perhaps make a small narrated video whenever you have time. I'm still not finding my footing when working on it, spending my time rereading my notes, your documentation, the issue tracker, etc.

Last time I couldn't run the unit test anymore (see #95) with the error ModuleNotFoundError: No module named 'InfiniteGlass' despite InfiniteGlass being able to run. It's strange, the least to say. I wanted to run the test suite again with the few changes made on #92 (malformed SVG).

I should be able to make progress on #88. I have been using pdm for a while now (on various projects) and it handles venv, dependencies and cython extremely well.

redhog commented 9 months ago

When you got that error, had you enabled the python virtualenv?

IanTrudel commented 9 months ago

When you got that error, had you enabled the python virtualenv?

Yes, I did enable it.