TencentDB-Agent-Memory icon indicating copy to clipboard operation
TencentDB-Agent-Memory copied to clipboard

[Bug] 脚本有 root 检测 bug 导致无限循环

Open MoonMao42 opened this issue 6 months ago • 2 comments

OpenClaw Version | OpenClaw 版本

hermes v0.14

Plugin Version | 插件版本

0.3.4

Operating System | 操作系统

debian12

System Specification | 系统配置

4c4g

Describe the bug | 问题描述

su - $USERNAME 当 $USERNAME 已经是 root 时,等于 su - root,执行后仍然是 root。 脚本被复制到临时文件后再次执行,再次命中 id -u == 0 的分支,无限循环。

第 36-38 行

USERNAME=$(whoami) # root 执行 → USERNAME="root" USER_HOME=$(eval echo ~$USERNAME) # → "/root"

第 68-91 行

if [ "$(id -u)" -eq 0 ]; then echo "[memory-tencentdb] Running as root, switching to $USERNAME for installation..." # ... su - $USERNAME -c "bash $TEMP_SCRIPT" </dev/null # su - root → 还是 root! # ... fi

To Reproduce | 复现步骤

  1. 以 root 身份登录服务器
  2. 执行: bash git clone https://github.com/Tencent/TencentDB-Agent-Memory.git cd TencentDB-Agent-Memory bash scripts/install_hermes_memory_tencentdb.sh
  3. 观察输出:同一行 "[memory-tencentdb] Running as root, switching to root for installation..." 被无限打印

Expected behavior | 预期行为

su - admin -c "bash install_hermes_memory_tencentdb.sh" 降级普通用户权限 或者增强报错显示: 以 root 执行,没指定目标用户→ 提示: [ERROR] Running as root but no target user specified. Set TARGET_USER= or run as the target user

Error Logs / Screenshots | 报错日志/截图

No response

Additional context | 补充信息

No response

MoonMao42 avatar May 19 '26 14:05 MoonMao42

感谢提出!我们已经关注到了该bug,会尽快修复

Maxwell-Code07 avatar May 19 '26 15:05 Maxwell-Code07

该问题已修复,将随下个版本发出

noFloat avatar May 21 '26 09:05 noFloat