Recently several of my colleagues bumped into an interesting problem.
We use LD_PRELOAD environment variable in couple of places. For those of you not familiar with it: LD_PRELOAD is an environment variable which allows you to specify dynamic libraries which will be loaded before all other libraries. This technique allows you to intercept calls to standard libraries is used by many debugging and analysis tools. Or you could alter behaviour of tsndard libraries for different purposes (e.g. fault injection).
As other variables like PATH or LD_LIBRARY_PATH, this variable may contain list of library namesseparated by colons. But... for compatibility with legacy systems it is possible to separate LD_PRELOAD elements by spaces. And older systems did not understand escaping so it turns oout it is impossible to put full library paths into LD_PRELOAD if they contain spaces.
But here is the trick. You may put library directory name(s) with spaces into LD_LIBRARY_PATH (which is kind of a PATH but for dynamically linked/loaded libraries) and put short library name(s) into LD_PRELOAD. Of course, short library file name must not contain spaces but this is less of a limitation.
Posted in Software | Software engineering frolov's blog | add new comment
Submitted by frolov on Mon, 2005-09-19 16:30.



