From 00540a8345c35703aeaab072fd9e4727c9b61d5a Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 3 Apr 2015 21:42:10 -0700 Subject: [PATCH] Remove special handling for (DY)LD_LIBRARY_PATH in QProcess. This provides the ability to pass a *real* clear environment to a QProcess, rather than (DY)LD_LIBRARY_PATH always being copied over from the current environment behind-the-scenes. This is important to users because passing a truly clear environment is now possible. [ChangeLog][Important Behavior Changes] (DY)LD_LIBRARY_PATH will no longer "stick" in the process environment when starting a QProcess. This means that if a QProcess is started with a clear environment, it will not specially inherit (DY)LD_LIBRARY_PATH from the parent process. This should not affect most applications, but if the old behavior is desired, one can simply pass a clear QProcessEnvironment with the (DY)LD_LIBRARY_PATH values added, to the QProcess. Change-Id: I51d1bc14905c5cc126fb02d91dddc2faade41a3c Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_unix.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index ffdf6f9e2e0..46b557d6e03 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -299,18 +299,6 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm if (environment.isEmpty()) return 0; - // if LD_LIBRARY_PATH exists in the current environment, but - // not in the environment list passed by the programmer, then - // copy it over. -#if defined(Q_OS_MAC) - static const char libraryPath[] = "DYLD_LIBRARY_PATH"; -#else - static const char libraryPath[] = "LD_LIBRARY_PATH"; -#endif - const QByteArray envLibraryPath = qgetenv(libraryPath); - bool needToAddLibraryPath = !envLibraryPath.isEmpty() && - !environment.contains(QProcessEnvironmentPrivate::Key(QByteArray(libraryPath))); - char **envp = new char *[environment.count() + 2]; envp[environment.count()] = 0; envp[environment.count() + 1] = 0; @@ -327,9 +315,6 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm envp[(*envc)++] = ::strdup(key.constData()); } - if (needToAddLibraryPath) - envp[(*envc)++] = ::strdup(QByteArray(QByteArray(libraryPath) + '=' + - envLibraryPath).constData()); return envp; }