[KDE/Mac] Aligning the sockets in kdeinit5 and friends on OS X

David Faure faure at kde.org
Mon Feb 2 07:35:57 UTC 2015

On Monday 02 February 2015 15:24:21 Ian Wadham wrote:
>     frameworks/kcrash/src/kcrash.cpp
>     frameworks/kinit/src/kdeinit/kinit.cpp
>     frameworks/kinit/src/wrapper.cpp
> @David: Please can you confirm that these are the *only* relevant hits
> and that they will catch all the cases where the socket name is generated.

My grep-fu is as good as yours ;)

I was wondering why klauncher was not in the list, after all it's the one 
writing to that socket, to tell kinit what to do. The answer: because 
klauncher is started by kdeinit forking and passing the file descriptor as 
"command-line" argument (argv). So that explains it ;)

> Attached are three tentative patches to fix things so that the same name
> is generated everywhere in Frameworks on Apple OS X.  I am proposing
> to use "NODISPLAY", rather than the value of $DISPLAY or $MAC_DISPLAY.
> One reason is to make sure wrapper.cpp and kinit.cpp use the same name.

Works. But looks weird, no?
A Mac user looking at the socket name would really wonder what that NODISPLAY 
means. I wonder why not just remove that... but ok that's minor.

> @David: Some last questions.  Why does kinit.cpp use an indirect method
> called displayEnvVarName() to look for the socket name's suffix, but both
> crash.cpp and wrapper.cpp use a direct method called getDisplay()?  

Waldo's brain is hard to dissect, so many years after the fact :-)

One data point: it looks like wrapper.cpp used to be plain C.

> Should
> not all three be using identical code?  And could that be implemented by
> using a macro or an include file, rather than cloning code?

That would be good. The reason it's not done currently is that the common 
dependency for this code is the kinit framework, and that framework doesn't 
ship a library, only executables. So this can't be a proper shared lib, but 
indeed, you could try shipping the code all-inline or in a macro. A bit ugly, 
but duplication is arguably ugly too (it's ugly, but more hidden....).
I'm ok with kinit installing this code in a header file. A shared lib would be 

David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5

More information about the kde-mac mailing list