Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better user-group creating in postinst, BaseDaemon::getDefaultCorePath [#METR-23811] #295

Merged
merged 1 commit into from
Jan 9, 2017

Conversation

proller
Copy link
Contributor

@proller proller commented Dec 30, 2016

No description provided.

@@ -188,6 +188,9 @@ static std::string getCanonicalPath(std::string && path)
return path;
}

std::string Server::getDefaultCorePath() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style.

@@ -701,6 +703,10 @@ void BaseDaemon::closeLogs()
logger().warning("Logging to console but received signal to close log file (ignoring).");
}

std::string BaseDaemon::getDefaultCorePath () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style.

@@ -61,6 +61,8 @@ class Server : public BaseDaemon
private:

void attachSystemTables(const std::string & path, bool has_zookeeper) const;

std::string getDefaultCorePath() override;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing const.

@@ -436,19 +436,21 @@ static void terminate_handler()
}


static std::string createDirectory(const std::string & _path)
static std::string createDirectory(const std::string & _path, bool strip_file = 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ancient code. Why not to throw away and use Poco::File::createDirectories instead?

if (core_path.empty())
core_path = getDefaultCorePath();

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to catch. Let it fail.

core_path = !log_path.empty() ? log_path : "/opt/";
try {
createDirectory(core_path, false);
} catch (...) { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

} catch (...) { }

Poco::File cores = core_path;
if ( !( cores.exists() && cores.isDirectory() ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for whitespace in inner side of parens (style).


try {
createDirectory(core_path, false);
} catch (...) { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silent catching of all exceptions is prohibited in style.

@@ -34,7 +34,7 @@ function make_control {
do
case "$DAEMON_PKG" in
'clickhouse-server' )
add_daemon_impl clickhouse-server-base '' 'clickhouse-server binary'
add_daemon_impl clickhouse-server-base 'adduser' 'clickhouse-server binary'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read this just now:

useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.

What if people are installing debian package on non-debian system (this way is used in practice)? Dependencies are cost too much... I am not sure that adduser gives enough comparing to useradd. BTW, I call these kind of programs "trash-scripts".

#mkdir -p /var/log/clickhouse
#chmod 1775 /var/log/clickhouse
#chown root:metrika /var/log/clickhouse
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to cleanup.

@alexey-milovidov alexey-milovidov merged commit c58cb0c into ClickHouse:master Jan 9, 2017
taiyang-li added a commit to bigo-sg/ClickHouse that referenced this pull request Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants