From a74e54bc8fab57c02eabda907e7b5d10451d0a99 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 23 Apr 2019 10:36:34 +0200 Subject: [PATCH] unix: don't assert on UV_PROCESS_WINDOWS_* flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UV_PROCESS_WINDOWS_HIDE_CONSOLE and UV_PROCESS_WINDOWS_HIDE_GUI were whitelisted on Windows but not Unices. Now they are. Bug introduced in commit 4c2dcca27 ("win: support more fine-grained windows hiding") which I reviewed but where I failed to spot it. Mea culpa. Fixes: https://github.com/libuv/libuv/issues/2266 PR-URL: https://github.com/libuv/libuv/pull/2278 Reviewed-By: Colin Ihrig Reviewed-By: Kyle Edwards Reviewed-By: Refael Ackermann Reviewed-By: Santiago Gimeno Reviewed-By: Saúl Ibarra Corretgé --- src/unix/process.c | 2 ++ test/test-spawn.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/unix/process.c b/src/unix/process.c index 101c9c53..ea1f852d 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -431,6 +431,8 @@ int uv_spawn(uv_loop_t* loop, UV_PROCESS_SETGID | UV_PROCESS_SETUID | UV_PROCESS_WINDOWS_HIDE | + UV_PROCESS_WINDOWS_HIDE_CONSOLE | + UV_PROCESS_WINDOWS_HIDE_GUI | UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS); diff --git a/test/test-spawn.c b/test/test-spawn.c index e5fc308a..fea1165d 100644 --- a/test/test-spawn.c +++ b/test/test-spawn.c @@ -1406,6 +1406,12 @@ TEST_IMPL(spawn_setuid_fails) { options.flags |= UV_PROCESS_SETUID; options.uid = 0; + /* These flags should be ignored on Unices. */ + options.flags |= UV_PROCESS_WINDOWS_HIDE; + options.flags |= UV_PROCESS_WINDOWS_HIDE_CONSOLE; + options.flags |= UV_PROCESS_WINDOWS_HIDE_GUI; + options.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; + r = uv_spawn(uv_default_loop(), &process, &options); #if defined(__CYGWIN__) ASSERT(r == UV_EINVAL);