[Cmake-commits] CMake branch, next, updated. v3.4.2-2047-g664b407

Brad King brad.king at kitware.com
Wed Jan 20 09:00:01 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  664b407ec54aa38ddb189128ba2baf81e78efab7 (commit)
       via  1787269ef3c476ee1176c92c54e5b22f9cb7f3fe (commit)
      from  6c1b1d9c251ddd98093e37dfe1c9d605ba0ebe00 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=664b407ec54aa38ddb189128ba2baf81e78efab7
commit 664b407ec54aa38ddb189128ba2baf81e78efab7
Merge: 6c1b1d9 1787269
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 20 09:00:00 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jan 20 09:00:00 2016 -0500

    Merge topic 'cmake-E-time-quoting' into next
    
    1787269e cmake: Fix `-E time` argument passing to child


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1787269ef3c476ee1176c92c54e5b22f9cb7f3fe
commit 1787269ef3c476ee1176c92c54e5b22f9cb7f3fe
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 20 08:45:55 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 20 08:55:23 2016 -0500

    cmake: Fix `-E time` argument passing to child
    
    Since this command was introduced in 2002 it has incorrectly constructed
    the child process command line by concatenating arguments separated by
    spaces with no quoting.  Fix this by passing the command argument vector
    directly to RunSingleCommand without an intermediate quoting and
    re-parsing step.
    
    Reported-by: Andrey Pokrovskiy <wonder.mice at gmail.com>

diff --git a/Help/release/dev/cmake-E-time-quoting.rst b/Help/release/dev/cmake-E-time-quoting.rst
new file mode 100644
index 0000000..23b17c5
--- /dev/null
+++ b/Help/release/dev/cmake-E-time-quoting.rst
@@ -0,0 +1,7 @@
+cmake-E-time-quoting
+--------------------
+
+* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments
+  with spaces or special characters through to the child process.  This
+  may break scripts that worked around the bug with their own extra
+  quoting or escaping.
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 8dd902b..1dc304c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -554,7 +554,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
     // Clock command
     else if (args[1] == "time" && args.size() > 2)
       {
-      std::string command = cmJoin(cmMakeRange(args).advance(2), " ");
+      std::vector<std::string> command(args.begin()+2, args.end());
 
       clock_t clock_start, clock_finish;
       time_t time_start, time_finish;
@@ -562,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       time(&time_start);
       clock_start = clock();
       int ret =0;
-      cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &ret);
+      cmSystemTools::RunSingleCommand(command, 0, 0, &ret);
 
       clock_finish = clock();
       time(&time_finish);
diff --git a/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt
new file mode 100644
index 0000000..50d9b03
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error: cmake version .*
+Usage: .* -E <command> \[arguments\.\.\.\]
+Available commands:
diff --git a/Tests/RunCMake/CommandLine/E_time-stdout.txt b/Tests/RunCMake/CommandLine/E_time-stdout.txt
new file mode 100644
index 0000000..a51446a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_time-stdout.txt
@@ -0,0 +1,3 @@
+^hello  world
+Elapsed time: [^
+]*$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 8068973..e3b73ff 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -12,6 +12,9 @@ run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append)
 run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename)
 run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate)
 
+run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello  world")
+run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time)
+
 run_cmake_command(E___run_iwyu-no-iwyu ${CMAKE_COMMAND} -E __run_iwyu -- command-does-not-exist)
 run_cmake_command(E___run_iwyu-bad-iwyu ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist -- command-does-not-exist)
 run_cmake_command(E___run_iwyu-no--- ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist command-does-not-exist)

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/cmake-E-time-quoting.rst                       |    7 +++++++
 Source/cmcmd.cxx                                                |    4 ++--
 .../E_time-no-arg-result.txt}                                   |    0
 .../{E-no-arg-stderr.txt => E_time-no-arg-stderr.txt}           |    0
 Tests/RunCMake/CommandLine/E_time-stdout.txt                    |    3 +++
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake                   |    3 +++
 6 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 Help/release/dev/cmake-E-time-quoting.rst
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CommandLine/E_time-no-arg-result.txt} (100%)
 copy Tests/RunCMake/CommandLine/{E-no-arg-stderr.txt => E_time-no-arg-stderr.txt} (100%)
 create mode 100644 Tests/RunCMake/CommandLine/E_time-stdout.txt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list