pppd namespace pollution
Till Straumann
strauman at slac.stanford.edu
Fri Mar 21 17:00:26 UTC 2003
Ralf Corsepius wrote:
>Am Fre, 2003-03-21 um 09.46 schrieb Valette Eric:
>
>>Till Straumann wrote:
>>
>>>Here are some symbols defined and globally exported by pppd.
>>>I didn't even include things like "link_down", "exit_code", "write_char"
>>>just the worst ones:
>>>
>>> debug output modem netmask protocols status user
>>>
--snip --
>>While I agree with the namespace polution problem, I think its easy to
>>understand why things are like that :
>> - The sources for the program originally come from system where
>>namespace polution is not a problem as each process has its own address
>>space,
>> - If you modify all the globals, tracking changes of the original
>>packages and apply them becomes a nightmare,
>>
>Exactly. That's why I say, that renaming globals can only be considered
>as a workaround and a systematic solution is needed, instead.
>
Well, some kludge is not hard to find:
1) build the library.
2) find exported symbols: nm --defined-only -g libxxx.a
3) sed the sources, adding a unique prefix to all exported globals.
[there's a risk of corrupting
commenting text, e.g.
int debug; /* set debug to print debug messages */
becomes
int pppxz67_debug; /* set pppxz67_debug to print pppxz67_debug
messages */
but that's probably acceptable.]
If the prefix is properly chosen, it can easily be removed again (useful
when tracking changes
of the original package).
Even with such an approach I'm a proponent of maintaining separate
libraries.
-- Till
More information about the users
mailing list