aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorAleksandr <ivansduck@gmail.com>2022-02-10 16:47:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:52 +0300
commitea6c5b7f172becca389cacaff7d5f45f6adccbe6 (patch)
treed16cef493ac1e092b4a03ab9437ec06ffe3d188f /util
parent37de222addabbef336dcaaea5f7c7645a629fc6d (diff)
downloadydb-ea6c5b7f172becca389cacaff7d5f45f6adccbe6.tar.gz
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/charset/benchmark/to_lower/metrics/ya.make4
-rw-r--r--util/charset/benchmark/utf8_to_wide/metrics/ya.make4
-rw-r--r--util/charset/ut/ya.make4
-rw-r--r--util/datetime/ut/ya.make4
-rw-r--r--util/digest/ut/ya.make4
-rw-r--r--util/draft/ut/ya.make4
-rw-r--r--util/folder/ut/ya.make4
-rw-r--r--util/generic/benchmark/fastclp2/metrics/ya.make4
-rw-r--r--util/generic/benchmark/log2/metrics/ya.make4
-rw-r--r--util/generic/benchmark/rotate_bits/metrics/ya.make4
-rw-r--r--util/generic/benchmark/vector_count_ctor/metrics/ya.make4
-rw-r--r--util/generic/string.pxd4
-rw-r--r--util/generic/ut/ya.make8
-rw-r--r--util/memory/benchmark/pool/metrics/ya.make4
-rw-r--r--util/memory/ut/ya.make4
-rw-r--r--util/network/ut/ya.make4
-rw-r--r--util/random/benchmark/prng/metrics/ya.make4
-rw-r--r--util/random/ut/ya.make4
-rw-r--r--util/stream/ut/ya.make4
-rw-r--r--util/string/benchmark/float_to_string/metrics/ya.make4
-rw-r--r--util/string/benchmark/join/metrics/ya.make4
-rw-r--r--util/string/benchmark/subst_global/metrics/ya.make4
-rw-r--r--util/string/ut/ya.make4
-rw-r--r--util/system/atomic_ut.cpp18
-rw-r--r--util/system/benchmark/cpu_id/metrics/ya.make4
-rw-r--r--util/system/benchmark/create_destroy_thread/metrics/ya.make4
-rw-r--r--util/system/shellcommand.cpp202
-rw-r--r--util/system/shellcommand.h6
-rw-r--r--util/system/shellcommand_ut.cpp98
-rw-r--r--util/system/ut/stdin_osfhandle/main.cpp30
-rw-r--r--util/system/ut/stdin_osfhandle/ya.make26
-rw-r--r--util/system/ut/ya.make24
-rw-r--r--util/system/yassert.cpp22
-rw-r--r--util/tests/sym_versions/test_glibc.py2
-rw-r--r--util/tests/ya_util_tests.inc8
35 files changed, 270 insertions, 270 deletions
diff --git a/util/charset/benchmark/to_lower/metrics/ya.make b/util/charset/benchmark/to_lower/metrics/ya.make
index 5bb3461a8d..52428664c6 100644
--- a/util/charset/benchmark/to_lower/metrics/ya.make
+++ b/util/charset/benchmark/to_lower/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/charset/benchmark/utf8_to_wide/metrics/ya.make b/util/charset/benchmark/utf8_to_wide/metrics/ya.make
index c406e25bee..e16123bc5f 100644
--- a/util/charset/benchmark/utf8_to_wide/metrics/ya.make
+++ b/util/charset/benchmark/utf8_to_wide/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/charset/ut/ya.make b/util/charset/ut/ya.make
index 6526815e92..c3574cc63d 100644
--- a/util/charset/ut/ya.make
+++ b/util/charset/ut/ya.make
@@ -10,8 +10,8 @@ SRCS(
wide_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
REQUIREMENTS(ram:17)
END()
diff --git a/util/datetime/ut/ya.make b/util/datetime/ut/ya.make
index c2bc714059..0c1acb4b47 100644
--- a/util/datetime/ut/ya.make
+++ b/util/datetime/ut/ya.make
@@ -10,6 +10,6 @@ SRCS(
datetime/uptime_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/digest/ut/ya.make b/util/digest/ut/ya.make
index 245b2cf6d2..5557ed8bd2 100644
--- a/util/digest/ut/ya.make
+++ b/util/digest/ut/ya.make
@@ -10,6 +10,6 @@ SRCS(
digest/sequence_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/draft/ut/ya.make b/util/draft/ut/ya.make
index 37ab9413c5..33265f02c1 100644
--- a/util/draft/ut/ya.make
+++ b/util/draft/ut/ya.make
@@ -16,6 +16,6 @@ SRCS(
memory_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/folder/ut/ya.make b/util/folder/ut/ya.make
index 64877d9b58..c77353ea82 100644
--- a/util/folder/ut/ya.make
+++ b/util/folder/ut/ya.make
@@ -12,6 +12,6 @@ SRCS(
folder/pathsplit_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/generic/benchmark/fastclp2/metrics/ya.make b/util/generic/benchmark/fastclp2/metrics/ya.make
index b2d17ebad3..2cd33c8057 100644
--- a/util/generic/benchmark/fastclp2/metrics/ya.make
+++ b/util/generic/benchmark/fastclp2/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/generic/benchmark/log2/metrics/ya.make b/util/generic/benchmark/log2/metrics/ya.make
index eb987e38d2..2cbdda35fa 100644
--- a/util/generic/benchmark/log2/metrics/ya.make
+++ b/util/generic/benchmark/log2/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/generic/benchmark/rotate_bits/metrics/ya.make b/util/generic/benchmark/rotate_bits/metrics/ya.make
index ac27d2f845..7cd7b66f9d 100644
--- a/util/generic/benchmark/rotate_bits/metrics/ya.make
+++ b/util/generic/benchmark/rotate_bits/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/generic/benchmark/vector_count_ctor/metrics/ya.make b/util/generic/benchmark/vector_count_ctor/metrics/ya.make
index c48f89b564..0713760c81 100644
--- a/util/generic/benchmark/vector_count_ctor/metrics/ya.make
+++ b/util/generic/benchmark/vector_count_ctor/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/generic/string.pxd b/util/generic/string.pxd
index c25f7392a1..ffcf591910 100644
--- a/util/generic/string.pxd
+++ b/util/generic/string.pxd
@@ -3,8 +3,8 @@ from libcpp.string cimport string as _std_string
cdef extern from "<util/generic/strbuf.h>" nogil:
cdef cppclass TStringBuf:
- TStringBuf() except +
- TStringBuf(const char*) except +
+ TStringBuf() except +
+ TStringBuf(const char*) except +
TStringBuf(const char*, size_t) except +
const char* data()
char* Data()
diff --git a/util/generic/ut/ya.make b/util/generic/ut/ya.make
index 6eaf24cc5f..69fc3f705a 100644
--- a/util/generic/ut/ya.make
+++ b/util/generic/ut/ya.make
@@ -3,8 +3,8 @@ UNITTEST_FOR(util)
OWNER(g:util)
SUBSCRIBER(g:util-subscribers)
-FORK_TESTS()
-
+FORK_TESTS()
+
SRCS(
generic/adaptor_ut.cpp
generic/algorithm_ut.cpp
@@ -56,8 +56,8 @@ SRCS(
generic/scope_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
IF (NOT OS_IOS AND NOT ARCH_PPC64LE)
# Abseil fails to build (with linkage error) on ios and with compilation error on PowerPC
# (somewhere in unscaledcycleclock.cc).
diff --git a/util/memory/benchmark/pool/metrics/ya.make b/util/memory/benchmark/pool/metrics/ya.make
index c671bc5c1c..75dc9b37b3 100644
--- a/util/memory/benchmark/pool/metrics/ya.make
+++ b/util/memory/benchmark/pool/metrics/ya.make
@@ -3,12 +3,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/memory/ut/ya.make b/util/memory/ut/ya.make
index d3a988617d..a8f28f1d0f 100644
--- a/util/memory/ut/ya.make
+++ b/util/memory/ut/ya.make
@@ -11,6 +11,6 @@ SRCS(
memory/tempbuf_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/network/ut/ya.make b/util/network/ut/ya.make
index 1ba03e167c..7bf3e91561 100644
--- a/util/network/ut/ya.make
+++ b/util/network/ut/ya.make
@@ -18,6 +18,6 @@ SRCS(
network/socket_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/random/benchmark/prng/metrics/ya.make b/util/random/benchmark/prng/metrics/ya.make
index 1f56aac0bd..37b4b835ac 100644
--- a/util/random/benchmark/prng/metrics/ya.make
+++ b/util/random/benchmark/prng/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/random/ut/ya.make b/util/random/ut/ya.make
index 5080b339de..9c2cc693c4 100644
--- a/util/random/ut/ya.make
+++ b/util/random/ut/ya.make
@@ -14,6 +14,6 @@ SRCS(
random/shuffle_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/stream/ut/ya.make b/util/stream/ut/ya.make
index f0176dd7b4..c1414bc2cf 100644
--- a/util/stream/ut/ya.make
+++ b/util/stream/ut/ya.make
@@ -25,6 +25,6 @@ SRCS(
stream/zlib_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/string/benchmark/float_to_string/metrics/ya.make b/util/string/benchmark/float_to_string/metrics/ya.make
index 4b8c4cc07d..24b522e8a6 100644
--- a/util/string/benchmark/float_to_string/metrics/ya.make
+++ b/util/string/benchmark/float_to_string/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/string/benchmark/join/metrics/ya.make b/util/string/benchmark/join/metrics/ya.make
index 08ff3a149f..fcb948f61f 100644
--- a/util/string/benchmark/join/metrics/ya.make
+++ b/util/string/benchmark/join/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/string/benchmark/subst_global/metrics/ya.make b/util/string/benchmark/subst_global/metrics/ya.make
index d8c30ad460..ee90840c5e 100644
--- a/util/string/benchmark/subst_global/metrics/ya.make
+++ b/util/string/benchmark/subst_global/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/string/ut/ya.make b/util/string/ut/ya.make
index 6e80812825..e1e3690f45 100644
--- a/util/string/ut/ya.make
+++ b/util/string/ut/ya.make
@@ -19,6 +19,6 @@ SRCS(
string/ascii_ut.cpp
)
-INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
-
+INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc)
+
END()
diff --git a/util/system/atomic_ut.cpp b/util/system/atomic_ut.cpp
index 07211ffba7..9806f9c441 100644
--- a/util/system/atomic_ut.cpp
+++ b/util/system/atomic_ut.cpp
@@ -212,16 +212,16 @@ using TAltAtomic = volatile TChooser<TAtomicBase, long, long long>::TdType;
#endif
class TTTest: public TAtomicTest<TAltAtomic> {
-public:
+public:
TString Name() const noexcept override {
- return "TAtomicTest<TAltAtomic>";
- }
+ return "TAtomicTest<TAltAtomic>";
+ }
static TString StaticName() noexcept {
- return "TAtomicTest<TAltAtomic>";
- }
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TTTest);
-
+ return "TAtomicTest<TAltAtomic>";
+ }
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TTTest);
+
#endif
diff --git a/util/system/benchmark/cpu_id/metrics/ya.make b/util/system/benchmark/cpu_id/metrics/ya.make
index 8c55def99b..e2860a7ec4 100644
--- a/util/system/benchmark/cpu_id/metrics/ya.make
+++ b/util/system/benchmark/cpu_id/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/system/benchmark/create_destroy_thread/metrics/ya.make b/util/system/benchmark/create_destroy_thread/metrics/ya.make
index d526487e1a..4912369927 100644
--- a/util/system/benchmark/create_destroy_thread/metrics/ya.make
+++ b/util/system/benchmark/create_destroy_thread/metrics/ya.make
@@ -6,12 +6,12 @@ SUBSCRIBER(g:util-subscribers)
PY2TEST()
-SIZE(LARGE)
+SIZE(LARGE)
TAG(
ya:force_sandbox
sb:intel_e5_2660v1
- ya:fat
+ ya:fat
)
TEST_SRCS(main.py)
diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp
index b1989b5c8c..6ac9eae94f 100644
--- a/util/system/shellcommand.cpp
+++ b/util/system/shellcommand.cpp
@@ -54,8 +54,8 @@ using TExitStatus = DWORD;
// #define DBG(stmt) stmt
namespace {
- constexpr static size_t DATA_BUFFER_SIZE = 128 * 1024;
-
+ constexpr static size_t DATA_BUFFER_SIZE = 128 * 1024;
+
#if defined(_unix_)
void SetUserGroups(const passwd* pw) {
int ngroups = 1;
@@ -265,14 +265,14 @@ private:
}
};
- struct TPipePump {
- TRealPipeHandle* Pipe;
- IOutputStream* OutputStream;
- IInputStream* InputStream;
- TAtomic* ShouldClosePipe;
- TString InternalError;
- };
-
+ struct TPipePump {
+ TRealPipeHandle* Pipe;
+ IOutputStream* OutputStream;
+ IInputStream* InputStream;
+ TAtomic* ShouldClosePipe;
+ TString InternalError;
+ };
+
#if defined(_unix_)
void OnFork(TPipes& pipes, sigset_t oldmask, char* const* argv, char* const* envp, const std::function<void()>& afterFork) const;
#else
@@ -448,66 +448,66 @@ public:
Communicate(pi);
return nullptr;
}
-
- inline static void* ReadStream(void* data) noexcept {
- TPipePump* pump = reinterpret_cast<TPipePump*>(data);
- try {
- int bytes = 0;
- TBuffer buffer(DATA_BUFFER_SIZE);
-
- while (true) {
- bytes = pump->Pipe->Read(buffer.Data(), buffer.Capacity());
+
+ inline static void* ReadStream(void* data) noexcept {
+ TPipePump* pump = reinterpret_cast<TPipePump*>(data);
+ try {
+ int bytes = 0;
+ TBuffer buffer(DATA_BUFFER_SIZE);
+
+ while (true) {
+ bytes = pump->Pipe->Read(buffer.Data(), buffer.Capacity());
if (bytes > 0) {
- pump->OutputStream->Write(buffer.Data(), bytes);
+ pump->OutputStream->Write(buffer.Data(), bytes);
} else {
- break;
+ break;
}
- }
+ }
if (pump->Pipe->IsOpen()) {
- pump->Pipe->Close();
+ pump->Pipe->Close();
}
- } catch (...) {
- pump->InternalError = CurrentExceptionMessage();
- }
- return nullptr;
- }
-
- inline static void* WriteStream(void* data) noexcept {
- TPipePump* pump = reinterpret_cast<TPipePump*>(data);
- try {
- int bytes = 0;
- int bytesToWrite = 0;
- char* bufPos = nullptr;
- TBuffer buffer(DATA_BUFFER_SIZE);
-
- while (true) {
- if (!bytesToWrite) {
- bytesToWrite = pump->InputStream->Read(buffer.Data(), buffer.Capacity());
- if (bytesToWrite == 0) {
+ } catch (...) {
+ pump->InternalError = CurrentExceptionMessage();
+ }
+ return nullptr;
+ }
+
+ inline static void* WriteStream(void* data) noexcept {
+ TPipePump* pump = reinterpret_cast<TPipePump*>(data);
+ try {
+ int bytes = 0;
+ int bytesToWrite = 0;
+ char* bufPos = nullptr;
+ TBuffer buffer(DATA_BUFFER_SIZE);
+
+ while (true) {
+ if (!bytesToWrite) {
+ bytesToWrite = pump->InputStream->Read(buffer.Data(), buffer.Capacity());
+ if (bytesToWrite == 0) {
if (AtomicGet(pump->ShouldClosePipe)) {
- break;
+ break;
}
- continue;
- }
- bufPos = buffer.Data();
- }
-
- bytes = pump->Pipe->Write(bufPos, bytesToWrite);
- if (bytes > 0) {
- bytesToWrite -= bytes;
- bufPos += bytes;
- } else {
- break;
- }
- }
+ continue;
+ }
+ bufPos = buffer.Data();
+ }
+
+ bytes = pump->Pipe->Write(bufPos, bytesToWrite);
+ if (bytes > 0) {
+ bytesToWrite -= bytes;
+ bufPos += bytes;
+ } else {
+ break;
+ }
+ }
if (pump->Pipe->IsOpen()) {
- pump->Pipe->Close();
+ pump->Pipe->Close();
}
- } catch (...) {
- pump->InternalError = CurrentExceptionMessage();
- }
- return nullptr;
- }
+ } catch (...) {
+ pump->InternalError = CurrentExceptionMessage();
+ }
+ return nullptr;
+ }
TString GetQuotedCommand() const;
};
@@ -549,9 +549,9 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) {
if (InputMode != TShellCommandOptions::HANDLE_INHERIT) {
startup_info.hStdInput = pipes.InputPipeFd[0];
} else {
- // Don't leave hStdInput unfilled, otherwise any attempt to retrieve the operating-system file handle
- // that is associated with the specified file descriptor will led to errors.
- startup_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
+ // Don't leave hStdInput unfilled, otherwise any attempt to retrieve the operating-system file handle
+ // that is associated with the specified file descriptor will led to errors.
+ startup_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
}
PROCESS_INFORMATION process_info;
@@ -561,7 +561,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) {
TString cmd = UseShell ? "cmd /A /Q /S /C \"" + qcmd + "\"" : qcmd;
// winapi can modify command text, copy it
- Y_ENSURE_EX(cmd.size() < MAX_COMMAND_LINE, yexception() << "Command is too long (length=" << cmd.size() << ")");
+ Y_ENSURE_EX(cmd.size() < MAX_COMMAND_LINE, yexception() << "Command is too long (length=" << cmd.size() << ")");
TTempArray<wchar_t> cmdcopy(MAX_COMMAND_LINE);
Copy(cmd.data(), cmd.data() + cmd.size(), cmdcopy.Data());
*(cmdcopy.Data() + cmd.size()) = 0;
@@ -644,18 +644,18 @@ void ShellQuoteArgSp(TString& dst, TStringBuf argument) {
ShellQuoteArg(dst, argument);
}
-bool ArgNeedsQuotes(TStringBuf arg) noexcept {
+bool ArgNeedsQuotes(TStringBuf arg) noexcept {
if (arg.empty()) {
- return true;
+ return true;
}
- return arg.find_first_of(" \"\'\t&()*<>\\`^|") != TString::npos;
-}
-
+ return arg.find_first_of(" \"\'\t&()*<>\\`^|") != TString::npos;
+}
+
TString TShellCommand::TImpl::GetQuotedCommand() const {
TString quoted = Command; /// @todo command itself should be quoted too
for (const auto& argument : Arguments) {
- // Don't add unnecessary quotes. It's especially important for the windows with a 32k command line length limit.
- if (QuoteArguments && ArgNeedsQuotes(argument)) {
+ // Don't add unnecessary quotes. It's especially important for the windows with a 32k command line length limit.
+ if (QuoteArguments && ArgNeedsQuotes(argument)) {
::ShellQuoteArgSp(quoted, argument);
} else {
quoted.append(" ").append(argument);
@@ -731,8 +731,8 @@ void TShellCommand::TImpl::OnFork(TPipes& pipes, sigset_t oldmask, char* const*
}
if (Nice) {
- // Don't verify Nice() call - it does not work properly with WSL https://github.com/Microsoft/WSL/issues/1838
- ::Nice(Nice);
+ // Don't verify Nice() call - it does not work properly with WSL https://github.com/Microsoft/WSL/issues/1838
+ ::Nice(Nice);
}
if (afterFork) {
afterFork();
@@ -751,7 +751,7 @@ void TShellCommand::TImpl::OnFork(TPipes& pipes, sigset_t oldmask, char* const*
<< "unknown error" << Endl;
}
- _exit(-1);
+ _exit(-1);
}
#endif
@@ -901,29 +901,29 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
#endif
try {
-#if defined(_win_)
- TPipePump pumps[3] = {0};
- pumps[0] = {&pi->ErrorFd, error};
- pumps[1] = {&pi->OutputFd, output};
-
- TVector<THolder<TThread>> streamThreads;
- streamThreads.emplace_back(new TThread(&TImpl::ReadStream, &pumps[0]));
- streamThreads.emplace_back(new TThread(&TImpl::ReadStream, &pumps[1]));
-
- if (input) {
- pumps[2] = {&pi->InputFd, nullptr, input, &pi->Parent->ShouldCloseInput};
- streamThreads.emplace_back(new TThread(&TImpl::WriteStream, &pumps[2]));
- }
-
- for (auto& threadHolder : streamThreads)
- threadHolder->Start();
-#else
- TBuffer buffer(DATA_BUFFER_SIZE);
- TBuffer inputBuffer(DATA_BUFFER_SIZE);
+#if defined(_win_)
+ TPipePump pumps[3] = {0};
+ pumps[0] = {&pi->ErrorFd, error};
+ pumps[1] = {&pi->OutputFd, output};
+
+ TVector<THolder<TThread>> streamThreads;
+ streamThreads.emplace_back(new TThread(&TImpl::ReadStream, &pumps[0]));
+ streamThreads.emplace_back(new TThread(&TImpl::ReadStream, &pumps[1]));
+
+ if (input) {
+ pumps[2] = {&pi->InputFd, nullptr, input, &pi->Parent->ShouldCloseInput};
+ streamThreads.emplace_back(new TThread(&TImpl::WriteStream, &pumps[2]));
+ }
+
+ for (auto& threadHolder : streamThreads)
+ threadHolder->Start();
+#else
+ TBuffer buffer(DATA_BUFFER_SIZE);
+ TBuffer inputBuffer(DATA_BUFFER_SIZE);
int bytes;
int bytesToWrite = 0;
char* bufPos = nullptr;
-#endif
+#endif
TWaitResult waitPidResult;
TExitStatus status = 0;
@@ -939,7 +939,7 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
#if defined(_unix_)
waitpid(pi->Parent->Pid, &status, WNOHANG);
#else
- WaitForSingleObject(pi->Parent->Pid /* process_info.hProcess */, pi->Parent->PollDelayMs /* ms */);
+ WaitForSingleObject(pi->Parent->Pid /* process_info.hProcess */, pi->Parent->PollDelayMs /* ms */);
Y_UNUSED(status);
#endif
// DBG(Cerr << "wait result: " << waitPidResult << Endl);
@@ -947,8 +947,8 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
break;
}
}
-/// @todo factor out (poll + wfmo)
-#if defined(_unix_)
+/// @todo factor out (poll + wfmo)
+#if defined(_unix_)
bool haveIn = false;
bool haveOut = false;
bool haveErr = false;
@@ -1011,7 +1011,7 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
if (input && ((fds[0].revents & POLLOUT) == POLLOUT)) {
haveIn = true;
}
-
+
if (haveOut) {
bytes = pi->OutputFd.Read(buffer.Data(), buffer.Capacity());
DBG(Cerr << "transferred " << bytes << " bytes of output" << Endl);
@@ -1053,7 +1053,7 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
DBG(Cerr << "transferred " << bytes << " bytes of input" << Endl);
}
-#endif
+#endif
}
DBG(Cerr << "process finished" << Endl);
@@ -1068,7 +1068,7 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
if (WIFEXITED(status) && processExitCode == 0) {
cleanExit = true;
} else if (WIFSIGNALED(status)) {
- processExitCode = -WTERMSIG(status);
+ processExitCode = -WTERMSIG(status);
}
#else
if (waitPidResult == WAIT_OBJECT_0) {
diff --git a/util/system/shellcommand.h b/util/system/shellcommand.h
index 8730627fe5..f56a458351 100644
--- a/util/system/shellcommand.h
+++ b/util/system/shellcommand.h
@@ -480,6 +480,6 @@ void ShellQuoteArg(TString& dst, TStringBuf arg);
/// Appends to dst: space, quoted arg
void ShellQuoteArgSp(TString& dst, TStringBuf arg);
-
-/// Returns true if arg should be quoted
-bool ArgNeedsQuotes(TStringBuf arg) noexcept;
+
+/// Returns true if arg should be quoted
+bool ArgNeedsQuotes(TStringBuf arg) noexcept;
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp
index 9d849279d2..5ee48ccf90 100644
--- a/util/system/shellcommand_ut.cpp
+++ b/util/system/shellcommand_ut.cpp
@@ -84,19 +84,19 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
UNIT_ASSERT_VALUES_EQUAL(cmd.GetQuotedCommand(), "echo hello");
}
- Y_UNIT_TEST(TestOnlyNecessaryQuotes) {
- TShellCommandOptions options;
- options.SetQuoteArguments(true);
- TShellCommand cmd("echo");
+ Y_UNIT_TEST(TestOnlyNecessaryQuotes) {
+ TShellCommandOptions options;
+ options.SetQuoteArguments(true);
+ TShellCommand cmd("echo");
cmd << "hey"
<< "hello&world";
- cmd.Run();
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetError(), "");
- UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput(), "hey hello&world" NL);
- UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
- UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 == cmd.GetExitCode());
- }
-
+ cmd.Run();
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetError(), "");
+ UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput(), "hey hello&world" NL);
+ UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
+ UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 == cmd.GetExitCode());
+ }
+
Y_UNIT_TEST(TestRun) {
TShellCommand cmd("echo");
cmd << "hello";
@@ -312,7 +312,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
cmd.Terminate();
cmd.Wait();
UNIT_ASSERT(TShellCommand::SHELL_ERROR == cmd.GetStatus());
- UNIT_ASSERT(cmd.GetExitCode().Defined() && -15 == cmd.GetExitCode());
+ UNIT_ASSERT(cmd.GetExitCode().Defined() && -15 == cmd.GetExitCode());
}
sleep(1);
UNIT_ASSERT(!NFs::Exists(tmpfile));
@@ -368,17 +368,17 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
rc = SigProcMask(SIG_SETMASK, &oldmask, nullptr);
UNIT_ASSERT(rc == 0);
}
-#else
- // This ut is windows-only
- Y_UNIT_TEST(TestStdinProperlyConstructed) {
- TShellCommandOptions options;
- options.SetErrorStream(&Cerr);
-
- TShellCommand cmd(BinaryPath("util/system/ut/stdin_osfhandle/stdin_osfhandle"), options);
- cmd.Run().Wait();
- UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
- UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 == cmd.GetExitCode());
- }
+#else
+ // This ut is windows-only
+ Y_UNIT_TEST(TestStdinProperlyConstructed) {
+ TShellCommandOptions options;
+ options.SetErrorStream(&Cerr);
+
+ TShellCommand cmd(BinaryPath("util/system/ut/stdin_osfhandle/stdin_osfhandle"), options);
+ cmd.Run().Wait();
+ UNIT_ASSERT(TShellCommand::SHELL_FINISHED == cmd.GetStatus());
+ UNIT_ASSERT(cmd.GetExitCode().Defined() && 0 == cmd.GetExitCode());
+ }
#endif
Y_UNIT_TEST(TestInternalError) {
TString input = (TString("a") * 2000).append("\n");
@@ -392,32 +392,32 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
UNIT_ASSERT(TShellCommand::SHELL_INTERNAL_ERROR == cmd.GetStatus());
UNIT_ASSERT_VALUES_UNEQUAL(cmd.GetInternalError().size(), 0u);
}
- Y_UNIT_TEST(TestHugeOutput) {
- TShellCommandOptions options;
- TGuardedStringStream stream;
- options.SetOutputStream(&stream);
- options.SetUseShell(true);
-
- TString input = TString(7000, 'a');
- TString command = TStringBuilder{} << "echo " << input;
- TShellCommand cmd(command, options);
- cmd.Run().Wait();
-
- UNIT_ASSERT_VALUES_EQUAL(stream.Str(), input + NL);
- }
- Y_UNIT_TEST(TestHugeError) {
- TShellCommandOptions options;
- TGuardedStringStream stream;
- options.SetErrorStream(&stream);
- options.SetUseShell(true);
-
- TString input = TString(7000, 'a');
- TString command = TStringBuilder{} << "echo " << input << ">&2";
- TShellCommand cmd(command, options);
- cmd.Run().Wait();
-
- UNIT_ASSERT_VALUES_EQUAL(stream.Str(), input + NL);
- }
+ Y_UNIT_TEST(TestHugeOutput) {
+ TShellCommandOptions options;
+ TGuardedStringStream stream;
+ options.SetOutputStream(&stream);
+ options.SetUseShell(true);
+
+ TString input = TString(7000, 'a');
+ TString command = TStringBuilder{} << "echo " << input;
+ TShellCommand cmd(command, options);
+ cmd.Run().Wait();
+
+ UNIT_ASSERT_VALUES_EQUAL(stream.Str(), input + NL);
+ }
+ Y_UNIT_TEST(TestHugeError) {
+ TShellCommandOptions options;
+ TGuardedStringStream stream;
+ options.SetErrorStream(&stream);
+ options.SetUseShell(true);
+
+ TString input = TString(7000, 'a');
+ TString command = TStringBuilder{} << "echo " << input << ">&2";
+ TShellCommand cmd(command, options);
+ cmd.Run().Wait();
+
+ UNIT_ASSERT_VALUES_EQUAL(stream.Str(), input + NL);
+ }
Y_UNIT_TEST(TestPipeInput) {
TShellCommandOptions options;
options.SetAsync(true);
diff --git a/util/system/ut/stdin_osfhandle/main.cpp b/util/system/ut/stdin_osfhandle/main.cpp
index fe2ea836a9..35c12e67d1 100644
--- a/util/system/ut/stdin_osfhandle/main.cpp
+++ b/util/system/ut/stdin_osfhandle/main.cpp
@@ -1,15 +1,15 @@
-#include <io.h>
-#include <stdio.h>
-#include <windows.h>
-
-int main() {
- auto handle = (unsigned long long)_get_osfhandle(0);
- fprintf(stderr, "_get_osfhandle(0)=%llu\n", handle);
- // It look's like classic windows undocumented behaviour
- // https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle
- // _get_osfhandle returns INVALID_HANDLE_VALUE - 1 without any sign of error if specified fd was closed.
- // Working with such handle will lead to future various errors.
- if (handle + 1 == (unsigned long long)INVALID_HANDLE_VALUE)
- return 1;
- return 0;
-}
+#include <io.h>
+#include <stdio.h>
+#include <windows.h>
+
+int main() {
+ auto handle = (unsigned long long)_get_osfhandle(0);
+ fprintf(stderr, "_get_osfhandle(0)=%llu\n", handle);
+ // It look's like classic windows undocumented behaviour
+ // https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle
+ // _get_osfhandle returns INVALID_HANDLE_VALUE - 1 without any sign of error if specified fd was closed.
+ // Working with such handle will lead to future various errors.
+ if (handle + 1 == (unsigned long long)INVALID_HANDLE_VALUE)
+ return 1;
+ return 0;
+}
diff --git a/util/system/ut/stdin_osfhandle/ya.make b/util/system/ut/stdin_osfhandle/ya.make
index d71ab22e69..a21cb037ec 100644
--- a/util/system/ut/stdin_osfhandle/ya.make
+++ b/util/system/ut/stdin_osfhandle/ya.make
@@ -1,14 +1,14 @@
-PROGRAM()
-
-OWNER(g:util)
+PROGRAM()
+
+OWNER(g:util)
SUBSCRIBER(g:util-subscribers)
-
-SRCS(
- main.cpp
-)
-
-NO_UTIL()
-
-BUILD_ONLY_IF(OS_WINDOWS)
-
-END()
+
+SRCS(
+ main.cpp
+)
+
+NO_UTIL()
+
+BUILD_ONLY_IF(OS_WINDOWS)
+
+END()
diff --git a/util/system/ut/ya.make b/util/system/ut/ya.make
index 127e7c261e..919bbae969 100644
--- a/util/system/ut/ya.make
+++ b/util/system/ut/ya.make
@@ -13,12 +13,12 @@ TIMEOUT(300)
SIZE(MEDIUM)
-IF (OS_DARWIN)
- SIZE(LARGE)
- TAG(ya:fat ya:force_sandbox ya:exotic_platform)
- TIMEOUT(3600)
-ENDIF()
-
+IF (OS_DARWIN)
+ SIZE(LARGE)
+ TAG(ya:fat ya:force_sandbox ya:exotic_platform)
+ TIMEOUT(3600)
+ENDIF()
+
PEERDIR(
library/cpp/testing/benchmark
)
@@ -77,12 +77,12 @@ SRCS(
system/yassert_ut.cpp
)
-IF (OS_WINDOWS)
- DEPENDS(
- util/system/ut/stdin_osfhandle
- )
-ENDIF()
-
+IF (OS_WINDOWS)
+ DEPENDS(
+ util/system/ut/stdin_osfhandle
+ )
+ENDIF()
+
REQUIREMENTS(ram:12)
END()
diff --git a/util/system/yassert.cpp b/util/system/yassert.cpp
index 0f586648b7..fd35a8a12f 100644
--- a/util/system/yassert.cpp
+++ b/util/system/yassert.cpp
@@ -17,8 +17,8 @@
#include <stdarg.h>
#include <stdio.h>
-#ifdef CLANG_COVERAGE
-extern "C" {
+#ifdef CLANG_COVERAGE
+extern "C" {
// __llvm_profile_write_file may not be provided if the executable target uses NO_CLANG_COVERAGE() macro and
// arrives as test's dependency via DEPENDS() macro.
// That's why we provide a weak no-op implementation for __llvm_profile_write_file,
@@ -26,10 +26,10 @@ extern "C" {
Y_WEAK int __llvm_profile_write_file(void) {
return 0;
}
-}
-
-#endif
-
+}
+
+#endif
+
namespace {
struct TPanicLockHolder: public TAdaptiveLock {
};
@@ -82,11 +82,11 @@ namespace NPrivate {
#ifndef WITH_VALGRIND
PrintBackTrace();
#endif
-#ifdef CLANG_COVERAGE
- if (__llvm_profile_write_file()) {
- Cerr << "Failed to dump clang coverage" << Endl;
- }
-#endif
+#ifdef CLANG_COVERAGE
+ if (__llvm_profile_write_file()) {
+ Cerr << "Failed to dump clang coverage" << Endl;
+ }
+#endif
abort();
} catch (...) {
abort();
diff --git a/util/tests/sym_versions/test_glibc.py b/util/tests/sym_versions/test_glibc.py
index c76359c54c..04486232c4 100644
--- a/util/tests/sym_versions/test_glibc.py
+++ b/util/tests/sym_versions/test_glibc.py
@@ -26,4 +26,4 @@ def iter_binaries():
for p in iter_binaries():
- globals()['test_' + os.path.basename(p).replace('-', '_')] = functools.partial(yc.process.check_glibc_version, p)
+ globals()['test_' + os.path.basename(p).replace('-', '_')] = functools.partial(yc.process.check_glibc_version, p)
diff --git a/util/tests/ya_util_tests.inc b/util/tests/ya_util_tests.inc
index 57855aee6b..2789c911f2 100644
--- a/util/tests/ya_util_tests.inc
+++ b/util/tests/ya_util_tests.inc
@@ -1,4 +1,4 @@
-IF (OS_DARWIN)
- SIZE(LARGE)
- TAG(ya:fat ya:force_sandbox ya:exotic_platform)
-ENDIF()
+IF (OS_DARWIN)
+ SIZE(LARGE)
+ TAG(ya:fat ya:force_sandbox ya:exotic_platform)
+ENDIF()