Skip to content

Conversation

@tomchon
Copy link
Contributor

@tomchon tomchon commented Jan 5, 2026

https://project.feishu.cn/taosdata_td/defect/detail/6653994369

This pull request refactors and improves the install.sh and remove.sh scripts to enhance consistency, clarity, and robustness in TDengine's installation and removal processes. The main changes include standardizing variable naming, improving directory handling and user prompts, refining symbolic link creation, and providing clearer user guidance for non-root installations.

Refactoring and Variable Standardization:

  • Renamed variables for consistency and clarity, such as changing taosDir/driver_path to taos_dir/driver_dir, and default_path to default_dir throughout install.sh. This improves code readability and reduces the risk of errors. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Installation Logic and Directory Handling:

  • Improved logic for detecting user/root mode, defaulting install directories, and prompting users for custom install locations. Enhanced handling of symbolic links for configuration, data, and log directories, especially for root users. [1] [2] [3] [4] [5]
  • Refined the creation and cleanup of installation subdirectories and symbolic links to prevent conflicts and ensure correct permissions. [1] [2] [3] [4]

User Experience Improvements:

  • Enhanced prompts and log messages for users, including clearer instructions when installing as a non-root user, and a new note in the post-install summary about directory permissions for non-root installations. [1] [2] [3]
  • Updated the usage message in remove.sh to clarify the meaning and usage of the -d flag.

Symbolic Link and Path Adjustments:

  • Modified how binaries and uninstall scripts are handled, removing unnecessary copying and linking of uninstall scripts, and ensuring the correct bin directory is added to the user's PATH. [1] [2] [3]

Removal Script Enhancements:

  • Updated the removal logic to include new node types (snode and xnode) in the data cleanup process, ensuring a more thorough uninstallation.

Copilot AI review requested due to automatic review settings January 5, 2026 09:17
@tomchon tomchon requested a review from feici02 as a code owner January 5, 2026 09:17
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @tomchon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the installation and removal scripts for TDengine, focusing on robustness, clarity, and an improved user experience. The changes standardize internal variable naming, enhance directory handling logic for both root and non-root users, and provide more explicit guidance during and after the installation process. The removal script is also updated to ensure a more complete cleanup, making the overall lifecycle management of TDengine more reliable.

Highlights

  • Script Refactoring: Standardized variable names like "taosDir" to "taos_dir" and "default_path" to "default_dir" across "install.sh" for improved readability and consistency.
  • Enhanced Directory Management: Improved logic for detecting user mode (root/non-root), setting default installation directories, and handling symbolic links for configuration, data, and log directories, especially for root users.
  • User Experience: Updated installation prompts and post-install messages to provide clearer guidance, particularly for non-root installations, including a new note on directory permissions.
  • Streamlined Binary Handling: Modified binary and uninstall script handling by removing unnecessary copying and linking of uninstall scripts, and ensuring the correct binary directory is added to the user's PATH.
  • Comprehensive Removal: The "remove.sh" script now includes "snode" and "xnode" in its data cleanup process for a more thorough uninstallation and clarifies the usage of its "-d" flag.
  • Default Version Mode: Changed the default "verMode" in "install.sh" from "edge" to "cluster".

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the installation and removal scripts to improve consistency, clarity, and robustness. The changes include standardizing variable names, improving directory handling, and providing clearer user guidance. My review identified a high-severity security issue related to insecure file permissions (chmod 777) and a medium-severity regression where the log directory for non-root users is not cleaned up on re-installation. I have provided code suggestions to address these issues. Overall, these changes are a significant improvement to the installation process.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the installation and removal scripts for TDengine to improve consistency, directory handling, and user experience. The changes standardize variable naming conventions, enhance symbolic link management, and provide clearer guidance for both root and non-root installations.

Key changes:

  • Standardized variable naming from camelCase to snake_case (taosDirtaos_dir, driver_pathdriver_dir, default_pathdefault_dir)
  • Improved symbolic link creation logic for configuration, data, and log directories in root installations
  • Added support for new node types (snode and xnode) in the removal script's data cleanup

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packaging/tools/install.sh Refactored variable naming, improved directory setup logic, enhanced user prompts, updated PATH configuration for non-root users, added note about directory permissions for non-root installations
packaging/tools/remove.sh Updated usage message for -d flag, added snode and xnode to data cleanup list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# set -x

verMode=edge
verMode=cluster
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The verMode has been changed from "edge" to "cluster". This appears to be a configuration change that may not be intentional for this refactoring PR. This change affects the behavior at line 948 where it conditionally adds "audit 1" to the config file, and at line 432 where it creates the share directory. Please verify this change is intentional and document it in the PR description if so.

Suggested change
verMode=cluster
verMode=edge

Copilot uses AI. Check for mistakes.
fi
#rm -rf ${v15_java_app_dir} || :
cp -rf ${script_dir}/driver/* ${driver_path}/ && chmod 777 ${driver_path}/*
cp -rf ${script_dir}/driver/* ${driver_dir}/ && chmod 777 ${driver_dir}/*
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The line cp -rf ${script_dir}/driver/* ${driver_dir}/ && chmod 777 ${driver_dir}/* makes all shared libraries in driver_dir world-writable, allowing any local user to modify code that will later be loaded by TDengine binaries and system services. A local attacker can overwrite libtaos.so or related libraries and wait for a privileged process (e.g., a daemon or root user) to restart, achieving arbitrary code execution with that process's privileges. Tighten the permissions on these libraries so they are only writable by trusted administrators (for example, owned by root and not writable by group/others) instead of using mode 777.

Suggested change
cp -rf ${script_dir}/driver/* ${driver_dir}/ && chmod 777 ${driver_dir}/*
cp -rf ${script_dir}/driver/* ${driver_dir}/ && chmod 755 ${driver_dir}/*

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants