Am 08.08.12 09:05, schrieb Frederic Koehler: > Thanks for the feedback; here are some revised patches > and a third group of patches which fix enough segfaults > by removing implicit function definitions > to allow CDE to startup on x64, albeit to a very buggy desktop. > > ================== > Avoid an infinite loop in ttsession (tooltalk daemon) when /etc/mtab > is a symlink, using lstat instead of stat. > > > diff --git a/cde/lib/tt/lib/util/tt_file_system.C > b/cde/lib/tt/lib/util/tt_file_system.C > index 8d98ff9..ef96dc3 100644 > --- a/cde/lib/tt/lib/util/tt_file_system.C > +++ b/cde/lib/tt/lib/util/tt_file_system.C > @@ -427,9 +427,10 @@ updateFileSystemEntries () > pollfd poll_fd; > while (mount_table_stat.st_size == 0) { > (void)poll (&poll_fd, 0, 100); > - if (stat(TtMntTab, &mount_table_stat)) { > + // Must use lstat here; mtab is often a symlink
I'd like to raise the question if we want such C++ style comments or if we shouldn't stick with pure C comments? (Which I personally would prefer, so stay compatible with older compilers) > + if (lstat(TtMntTab, &mount_table_stat)) { > return; > - } > + } > } > > FILE *mount_table = ttOpenMntTbl(TtMntTab, "r"); > ===================== > Define a final fallback for loading default window manager font; > before exiting, forcefully try to load "fixed" font. This is sufficient > to allow systems where fontList is set to an empty list to startup dtwm, > for now. > > diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c > index 7c3d49c..af86d8c 100644 > --- a/cde/programs/dtwm/WmResource.c > +++ b/cde/programs/dtwm/WmResource.c > @@ -4433,7 +4433,17 @@ MakeAppearanceResources (WmScreenData *pSD, > AppearanceData *pAData, Boolean make > { > sprintf((char *)wmGD.tmpBuffer, ((char *)GETMESSAGE(62, 23, "failed to > load font: %.100s\0")), (char*) pAData->fontList); > Warning((char *)wmGD.tmpBuffer); > +#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) */ > + pAData->font = XLoadQueryFont(wmGD.display, "fixed"); > + if (pAData->font == NULL) { > + ExitWM(WM_ERROR_EXIT_VALUE); > + } > +#else > ExitWM(WM_ERROR_EXIT_VALUE); > +#endif > + > } > > #ifndef NO_MULTIBYTE > ==================== > Fix some implicit declarations of functions by adding appropriate > #includes, etc. These implicit definitions cause segfaults on x64 because > the implicit return type is a 32-bit signed int, rather than a pointer type. > diff --git a/cde/lib/DtSvc/DtUtil1/DtsMM.c b/cde/lib/DtSvc/DtUtil1/DtsMM.c > index dd82d6f..e59bc5e 100644 > --- a/cde/lib/DtSvc/DtUtil1/DtsMM.c > +++ b/cde/lib/DtSvc/DtUtil1/DtsMM.c > @@ -43,6 +43,7 @@ > #include <sys/param.h> > #endif > #include <string.h> > +#include <libgen.h> > #define X_INCLUDE_DIRENT_H > #define XOS_USE_XT_LOCKING > #include <X11/Xos_r.h> > diff --git a/cde/lib/DtSvc/DtUtil1/DtsMM.h b/cde/lib/DtSvc/DtUtil1/DtsMM.h > index 2deba8e..aadc239 100644 > --- a/cde/lib/DtSvc/DtUtil1/DtsMM.h > +++ b/cde/lib/DtSvc/DtUtil1/DtsMM.h > @@ -137,6 +137,10 @@ extern int use_in_memory_db; > extern DtDtsMMDatabase *_DtDtsMMGet(const char *name); > extern char **_DtDtsMMListDb(void); > > +/* FIXME: document */ > +extern int *_DtDtsMMGetDbName(DtDtsMMDatabase *db, DtShmBoson boson); > + > + > /* Name Comparison functions: > * These routines can be passed in to the corresponding sort function to > * sort by name. > diff --git a/cde/lib/tt/lib/util/tt_file_system.C > b/cde/lib/tt/lib/util/tt_file_system.C > index 8d98ff9..ef96dc3 100644 > --- a/cde/lib/tt/lib/util/tt_file_system.C > +++ b/cde/lib/tt/lib/util/tt_file_system.C > @@ -427,9 +427,10 @@ updateFileSystemEntries () > pollfd poll_fd; > while (mount_table_stat.st_size == 0) { > (void)poll (&poll_fd, 0, 100); > - if (stat(TtMntTab, &mount_table_stat)) { > + // Must use lstat here; mtab is often a symlink > + if (lstat(TtMntTab, &mount_table_stat)) { > return; > - } > + } > } > > FILE *mount_table = ttOpenMntTbl(TtMntTab, "r"); > diff --git a/cde/programs/dtwm/Button.c b/cde/programs/dtwm/Button.c > index 1d7213d..9cfad52 100644 > --- a/cde/programs/dtwm/Button.c > +++ b/cde/programs/dtwm/Button.c > @@ -38,6 +38,7 @@ static char SCCSID[] = "OSF/Motif: @(#)Button.c 1.19 > 95/05/01"; > #include <X11/cursorfont.h> > #include "ButtonP.h" > #include <Xm/ManagerP.h> > +#include <Xm/DrawP.h> > #include <Dt/Control.h> > #include <Dt/MacrosP.h> > #include <Dt/DtStrDefs.h> > diff --git a/cde/programs/dtwm/UI.c b/cde/programs/dtwm/UI.c > index dbe2f7d..1a4e7d7 100644 > --- a/cde/programs/dtwm/UI.c > +++ b/cde/programs/dtwm/UI.c > @@ -59,6 +59,7 @@ > #include <Xm/SeparatoG.h> > #include <Xm/DialogS.h> > #include <Xm/ColorObjP.h> > +#include <Xm/TextF.h> > > #include <X11/Xatom.h> > #include <X11/keysymdef.h> > diff --git a/cde/programs/dtwm/WmInitWs.c b/cde/programs/dtwm/WmInitWs.c > index f9e5b80..2f77f9a 100644 > --- a/cde/programs/dtwm/WmInitWs.c > +++ b/cde/programs/dtwm/WmInitWs.c > @@ -81,6 +81,7 @@ typedef struct > #include <Dt/DtP.h> > #include <Dt/Message.h> > #include <Dt/WsmM.h> > +#include <Dt/EnvControlP.h> > #endif /* WSM */ > > /* Busy is also defined in the BMS -> bms.h. This conflicts with > diff --git a/cde/programs/dtwm/WmProperty.c b/cde/programs/dtwm/WmProperty.c > index 2995c3c..798553b 100644 > --- a/cde/programs/dtwm/WmProperty.c > +++ b/cde/programs/dtwm/WmProperty.c > @@ -54,6 +54,7 @@ static char rcsid[] = "$TOG: WmProperty.c /main/7 > 1997/12/02 10:00:00 bill $" > #include "WmColormap.h" > #include "WmError.h" > #include "WmResParse.h" > +#include "WmIconBox.h" > > > > diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c > index 7c3d49c..af86d8c 100644 > --- a/cde/programs/dtwm/WmResource.c > +++ b/cde/programs/dtwm/WmResource.c > @@ -4433,7 +4433,17 @@ MakeAppearanceResources (WmScreenData *pSD, > AppearanceData *pAData, Boolean make > { > sprintf((char *)wmGD.tmpBuffer, ((char *)GETMESSAGE(62, 23, "failed to > load font: %.100s\0")), (char*) pAData->fontList); > Warning((char *)wmGD.tmpBuffer); > +#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) */ > + pAData->font = XLoadQueryFont(wmGD.display, "fixed"); > + if (pAData->font == NULL) { > + ExitWM(WM_ERROR_EXIT_VALUE); > + } > +#else > ExitWM(WM_ERROR_EXIT_VALUE); > +#endif > + > } > > #ifndef NO_MULTIBYTE > diff --git a/cde/programs/dtwm/WmWrkspace.c b/cde/programs/dtwm/WmWrkspace.c > index 462f182..8ded58f 100644 > --- a/cde/programs/dtwm/WmWrkspace.c > +++ b/cde/programs/dtwm/WmWrkspace.c > @@ -41,6 +41,7 @@ static char rcsid[] = "$XConsortium: WmWrkspace.c /main/7 > 1996/10/23 17:26:33 rs > #include "WmGlobal.h" > #include "WmHelp.h" > #include "WmResNames.h" > +#include "WmIPlace.h" > #include <X11/Xutil.h> > #include "WmICCC.h" > #include <Xm/Xm.h> > > On Tue, 2012-08-07 at 13:28 -0600, Jon Trulson wrote: >> On Tue, 7 Aug 2012, Frederic Koehler wrote: >> >>> Hi, I was trying to figure out why CDE does not want to run on some >>> distros, including >>> the latest release of Fedora. These two patches are enough to get dtwm to >>> run. >>> The first is important, because it allows ToolTalk to work which dtwm is >>> reliant on (without the server starting >>> no tooltalk reliant program seems to be able to do anything at all). >>> The second is a hack for issues with font loading; I'm not sure it's the >>> "correct" hack even. >>> Still this does not seem to be enough to make starting full cde work yet, >>> but I send these patches >>> since finding the cause of tooltalk issue was a big pain. >>> >> >> Hi, comments below... >> >>> ----------------------- >>> >>> For this first patch, ttsession (tooltalk daemon) was looping forever >>> polling /etc/mtab; it turns >>> out this is because in some distros (Fedora) it is a symlink of size zero. >>> Since the infinite loop which is caused is a workaround for something >>> ancient, it's probably >>> safe to just remove. >>> >>> diff --git a/cde/lib/tt/lib/util/tt_file_system.C >>> b/cde/lib/tt/lib/util/tt_file_ >>> index 8d98ff9..326694a 100644 >>> --- a/cde/lib/tt/lib/util/tt_file_system.C >>> +++ b/cde/lib/tt/lib/util/tt_file_system.C >>> @@ -421,17 +421,6 @@ updateFileSystemEntries () >>> >>> firsttime = 0; >>> >>> - // XXX Due to bug #1126575 - MNTTAB temporarily goes to >>> - // size 0 during automounter updates. The file stats >>> - // OK, but has no data in it. >>> - pollfd poll_fd; >>> - while (mount_table_stat.st_size == 0) { >>> - (void)poll (&poll_fd, 0, 100); >>> - if (stat(TtMntTab, &mount_table_stat)) { >>> - return; >>> - } >>> - } >>> - >> >> Nice find! Though I would prefer that: >> >> - maybe this block is just ifdef'd out when either 'linux' or >> 'CSRG_BASED' is defined >> >> or >> >> - maybe use lstat() rather than stat(). >> >> lstat should work properly even if the target is a symlink. >> >> I would offer to make this change, but I do not have a machine that I >> can reproduce this on, so no way to test it. >> >> [...] >>> >>> fontList ends up being an empty list, causing dtwm to exit. >>> Workaround by forcing load of "fixed" font. >>> >>> diff --git a/cde/programs/dtwm/WmResource.c b/cde/programs/dtwm/WmResource.c >>> index 7c3d49c..c680dee 100644 >>> --- a/cde/programs/dtwm/WmResource.c >>> +++ b/cde/programs/dtwm/WmResource.c >>> @@ -4431,9 +4431,9 @@ MakeAppearanceResources (WmScreenData *pSD, >>> AppearanceData >>> >>> if (! XmeRenderTableGetDefaultFont(pAData->fontList, &(pAData->font))) >>> { >>> - sprintf((char *)wmGD.tmpBuffer, ((char *)GETMESSAGE(62, 23, "failed >>> to l >>> - Warning((char *)wmGD.tmpBuffer); >>> - ExitWM(WM_ERROR_EXIT_VALUE); >>> + /* HACK to get font anyway (fontList seems to end up NULL on >>> + * some modern systems? */ >>> + pAData->font = XLoadQueryFont(wmGD.display, "fixed"); >>> } >>> >>> #ifndef NO_MULTIBYTE >>> >> >> Yes, a bit hacky :) Though, I'd love to know why it is null. >> >> If you could: >> >> - Leave the warning there >> - use idef blocks (for linux and CSRG_BASED) to omit the 'ExitWM' >> call >> - check the return value of your 'pAData->font = >> XLoadQueryFont(wmGD.display, "fixed");', exiting (via ExitWM) if it fails. >> >> I'll make these changes if you'd like. >> > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > cdesktopenv-devel mailing list > cdesktopenv-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ cdesktopenv-devel mailing list cdesktopenv-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel