Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new vnode data repair tool (dmRepairCopy) for data recovery via SSH or local copy, alongside a meta-reader utility for manual metadata inspection and repair. It implements enhanced table-level privilege filtering for system table queries, addresses client-side double-free vulnerabilities, and fixes DST-related inaccuracies in time truncation. Other significant changes include the addition of a flexible deployment mode, optimized log rotation, and expanded test coverage for subquery pruning and CASE WHEN conditions. Review feedback highlights several critical issues in the new repair tool, including the incorrect use of dot notation for nested JSON lookups, potential buffer overflows when handling shell-quoted paths, and fragile parsing of remote directory listings.
| // Fetch a remote file to a local path via SSH. | ||
| // Returns 0 on success, -1 on error. | ||
| static int32_t dmSshFetchFile(const char *host, const char *remotePath, const char *localPath) { | ||
| char qHost[320], qRemote[PATH_MAX + 4], qLocal[PATH_MAX + 4]; |
There was a problem hiding this comment.
The buffers qRemote and qLocal are too small to hold the output of dmShellQuote. Since dmShellQuote can expand each character (e.g., a single quote becomes 4 characters), a path of length PATH_MAX could require up to 4 * PATH_MAX + 3 bytes. Using PATH_MAX + 4 will lead to truncation and subsequent command failure for long paths containing special characters. This issue also exists in other functions in this file (e.g., dmValidateSourceDisksRemote, dmCopyNonTsdbFiles, dmGetRemoteFileSize, dmCopySourceFileSets).
char qHost[1024], qRemote[PATH_MAX * 4 + 4], qLocal[PATH_MAX * 4 + 4];| uError("repair: shell quote failed in dmSshFetchFile"); | ||
| return -1; | ||
| } | ||
| char cmd[2048]; |
There was a problem hiding this comment.
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Description
implement copy mode data recovery.
Issue(s)
Checklist
Please check the items in the checklist if applicable.