qt5base-lts/tests/auto/corelib/io/qprocess
Thiago Macieira 29fceed2ff QProcess/Unix: ensure we don't accidentally execute something from CWD
Unless "." (or the empty string) is in $PATH, we're not supposed to find
executables in the current directory. This is how the Unix shells behave
and we match their behavior. It's also the behavior Qt had prior to 5.9
(commit 28666d167a). On Windows, searching
the current directory is the norm, so we keep that behavior.

This commit does not add an explicit check for an empty return from
QStandardPaths::findExecutable(). Instead, we allow that empty string to
go all the way to execve(2), which will fail with ENOENT. We could catch
it early, before fork(2), but why add code for the error case?

See https://kde.org/info/security/advisory-20220131-1.txt

[ChangeLog][Important Behavior Changes] When passed a simple program
name with no slashes, QProcess on Unix systems will now only search the
current directory if "." is one of the entries in the PATH environment
variable. This bug fix restores the behavior QProcess had before Qt 5.9.
If launching an executable in the directory set by setWorkingDirectory()
or inherited from the parent is intended, pass a program name starting
with "./". For more information and best practices about finding an
executable, see QProcess' documentation.

Pick-to: 5.15 6.2 6.3
Change-Id: I54f205f6b7314351b078fffd16cf7013c97ee9fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-09 11:26:32 -08:00
..
fileWriterProcess Remove the qmake project files 2021-01-07 15:32:28 +01:00
test Add missing dependencies of tests on their helper programs 2021-09-17 12:57:25 +02:00
testBatFiles
testDetached Remove the qmake project files 2021-01-07 15:32:28 +01:00
testExitCodes Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testForwarding Add missing dependencies of tests on their helper programs 2021-09-17 12:57:25 +02:00
testForwardingHelper Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testGuiProcess Remove the qmake project files 2021-01-07 15:32:28 +01:00
testProcessCrash Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessDeadWhileReading Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessEcho Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessEcho2 Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessEcho3 Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessEchoGui Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessEnvironment Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessEOF Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessHang Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessNormal Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessOutput Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testProcessSpacesArgs Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testSetNamedPipeHandleState Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testSetWorkingDirectory Remove the qmake project files 2021-01-07 15:32:28 +01:00
testSoftExit Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
testSpaceInName Remove Qt dependency from some test helper executables 2021-04-15 20:38:44 +02:00
.gitignore
BLACKLIST
CMakeLists.txt Add missing dependencies of tests on their helper programs 2021-09-17 12:57:25 +02:00
tst_qprocess.cpp QProcess/Unix: ensure we don't accidentally execute something from CWD 2022-02-09 11:26:32 -08:00