Environment: Do not leave stray ':' in LD_LIBRARY_PATH

A empty path segment in LD_LIBRARY_PATH is *not* ignored and treated
as '.' IIRC.

So make sure to not leave a ':' in first place of LD_LIBRARY_PATH or set
an empty LD_LIBRARY_PATH on Linux.

Change-Id: I99ec2e333c6c0205334daf14ac6a2373c6e465ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tobias Hunger
2018-07-25 13:02:18 +02:00
parent 7f6c48e017
commit cc25aa4caf

View File

@@ -49,8 +49,10 @@ public:
toReplace.append(':');
toReplace.append(lib.path());
if (ldLibraryPath.startsWith(toReplace))
set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length()));
if (ldLibraryPath.startsWith(toReplace + ':'))
set("LD_LIBRARY_PATH", ldLibraryPath.remove(0, toReplace.length() + 1));
else if (ldLibraryPath == toReplace)
unset("LD_LIBRARY_PATH");
}
}
};