From dc7807b13bd140d9cd519e5770e7f0580a1a7365 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Mon, 2 Jul 2018 01:19:24 +0000 Subject: [PATCH 1/2] slib/mp_rpc_server: TIRPC: force a listen() call on the server socket With earlier versions of RPC and TIRPC it seems that svctcp_create() calles listen() on the socket (as seen by debugger and strace). Tooltalk expects this behavior. However, with newer systems (ArchLinux 5/18+ and similar bleeding edge versions of SuSE's equivalent: Tumbleweed), this behavior seems to have changed. ttsession goes into an infinite loop trying to accept() a connection in the TIRPC library (via svc_getreqset()). It appears listen() is no longer called on the socket when it is created via svctcp_create(). The hack in this commit, always causes listen() to be called on the socket, and seems to resolve the problem. But it is a hack I think. I don't know if this is the correct behavior of svctcp_create() or we were just lucky before. --- cde/lib/tt/slib/Imakefile | 3 ++- cde/lib/tt/slib/mp_rpc_server.C | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cde/lib/tt/slib/Imakefile b/cde/lib/tt/slib/Imakefile index cd713a2b9..dba66d1d7 100644 --- a/cde/lib/tt/slib/Imakefile +++ b/cde/lib/tt/slib/Imakefile @@ -14,9 +14,10 @@ DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES) #include "../tooltalk.tmpl" -DEFINES = +DEFINES = $(TIRPC_DEFINES) INCLUDES = $(TIRPCINC) -I. -I../lib + SRCS = \ mp_ce_attrs.C mp_observer.C mp_observer_utils.C \ mp_otype.C mp_otype_utils.C mp_ptype.C \ diff --git a/cde/lib/tt/slib/mp_rpc_server.C b/cde/lib/tt/slib/mp_rpc_server.C index 37336f65e..1fe1aab29 100644 --- a/cde/lib/tt/slib/mp_rpc_server.C +++ b/cde/lib/tt/slib/mp_rpc_server.C @@ -158,9 +158,32 @@ init(void (*service_fn)(struct svc_req *, SVCXPRT *)) _tt_syslog(0, LOG_ERR, "setsockopt(SO_SNDBUF): %m"); } _transp = svctcp_create(_socket, buffersize, buffersize); + if (_transp == (SVCXPRT *)0) { return(0); } + +#if defined(OPT_TIRPC) + /* JET: HACK WARNING 7/1/18 + * + * With earlier versions of RPC and TIRPC it seems that + * svctcp_create() calles listen() on the socket (as seen by + * debugger and strace). This is the expected behavior in TT. + * + * However, with newer systems (ArchLinux 5/18+ and similar + * bleeding edge versions of SuSE's equivalent: Tumbleweed), + * this behavior seems to have changed. + * + * ttsession goes into an infinite loop trying to accept() a + * connection in the TIRPC library. It appears listen() is no + * longer called on the socket via svctcp_create(). The hack + * below, always causes listen() to be called on the socket. + * We do not care if it fails, or is called twice on the same + * socket. + */ + listen(_socket, 5); +#endif + if ( !svc_register(_transp, _program, _version, (SERVICE_FN_TYPE)service_fn, IPPROTO_TCP) || !svc_register(_transp, _program, 1, From a7ec1c618234c9466d3b280e8174669121fb5c40 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Mon, 2 Jul 2018 14:44:58 -0600 Subject: [PATCH 2/2] dwtm/WmResource.c: Stop printing garbage when XmeRenderTableGetDefaultFont() fails. --- cde/programs/dtwm/WmResource.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c index 4408ba73a..e9dbd74ef 100644 --- a/cde/programs/dtwm/WmResource.c +++ b/cde/programs/dtwm/WmResource.c @@ -4482,11 +4482,18 @@ MakeAppearanceResources (WmScreenData *pSD, AppearanceData *pAData, Boolean make if (! XmeRenderTableGetDefaultFont(pAData->fontList, &(pAData->font))) { - sprintf((char *)wmGD.tmpBuffer, ((char *)GETMESSAGE(62, 23, "failed to load font: %.100s\0")), (char*) pAData->fontList); - Warning((char *)wmGD.tmpBuffer); +#if 0 + /* This always prints garbage on failure, which seems to + * always happen at least 1-3 times on startup. + */ + sprintf((char *)wmGD.tmpBuffer, + ((char *)GETMESSAGE(62, 23, "failed to load font: %.100s\0")), (char*) pAData->fontList); +#endif + Warning("XmeRenderTableGetDefaultFont() failed, trying a fixed font"); + #if defined(CSRG_BASED) || defined(__linux__) - /* HACK to try get _some_ font anyway (fontList seems to end up as an empty list on - * some modern systems; investigate) */ + /* HACK to try get _some_ font anyway (fontList seems to end + * up as an empty list on some modern systems; investigate) */ pAData->font = XLoadQueryFont(wmGD.display, "fixed"); if (pAData->font == NULL) {