[PATCH:libXt 3/3] Convert ALLOCATE_LOCAL + sprintf to XtAsprintf
walter harms
wharms at bfs.de
Tue Mar 8 05:25:40 PST 2011
the only place where a change is, is CombineAppUserDefaults()
can you set XAPPLRESDIR to see if both paths generate the same error ?
re,
wh
Am 08.03.2011 12:45, schrieb Cyril Brulebois:
> Alan Coopersmith <alan.coopersmith at oracle.com> (07/03/2011):
>> Perhaps a difference in the setting of $HOME or one of the other
>> environment variables that GetRootDirName checks for the homedir?
>
> Indeed, '/' when starting from init, '/root' when starting later as
> root. I tried unsetting a few variables (HOME, USER, etc.), but I
> couldn't reproduce this behaviour after init; so I configured root's
> homedir to be '/', and could reproduce the issue with just running
> 'xdm'. yay.
>
>> I can't see why that would make XtAsprintf operate any differently
>> though.
>
> Now, both XtAsprintf and asprintf return the same path, which is
> nice. But I *think* there's some side effect somewhere.
>
> The core left behind says:
> | Program terminated with signal 11, Segmentation fault.
> | #0 XtOpenDisplay (app=0x0, displayName=0x9a0d788 ":0", applName=0x80660b9 "xlogin",
> | className=0x80660b2 "Xlogin", urlist=0x0, num_urs=0, argc=0x8069ef0, argv=0x8067c2c)
> | at ../../src/Display.c:313
> | 313 UNLOCK_APP(app);
>
> So, one may ask (and Julien did): “WTH would app be NULL as this point?”
>
> The codepath, from XtOpenDisplay is (all of those under src/):
> ... XtAsprintf or asprintf
> Initialize.c: CombineAppUserDefaults
> Initialize.c: XtScreenDatabase
> Initialize.c: _XtDisplayInitialize
> Display.c: XtOpenDisplay
>
> So, let's add a check in Display.c:
> | XtOpenDisplay(…) {
> | …
> | fprintf(stderr, "[before init] app=%p\n", app);
> | _XtDisplayInitialize(d, pd, applName, urlist, num_urs, argc, argv);
> | fprintf(stderr, "[after init] app=%p\n", app);
> | …
> | }
> (xdm.log has the output.)
>
> And tada!
> 1. app is non-NULL before calling _XtDisplayInitialize
> 2. app is non-NULL (and the same value, woot) afterwards, if using
> asprintf().
> 3. app is NULL afterwards, if using XtAsprintf().
>
> KiBi.
>
>
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list