[Bug]: Checks that fail before the log directory exists exit with 0

未关闭 适合新手
#5,193 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
bash, linux, shell
领域
backend, cli

调研方向

从 check_system_dir.sh、check_executable.sh、core_steamcmd.sh 和 core_exit.sh 开始;然后追踪 check.sh 在 check_logs.sh 创建日志目录之前按什么顺序执行这些检查。确认日志目录不存在时每种已报告故障的退出码,包括公共 IP 查询失败或模块下载失败。无论日志目录是否存在,检查都返回预期的非零状态,即为完成。

由索引模型根据 Issue 内容生成。

描述

command: start distro: Debian engine: null game: Teamspeak 3 reproducible: always severity: low type: bug
Severity

severity: low

Reproducibility

reproducible: always

Regression

regression: no

Affects latest release

latest-release: yes

User story

As a server admin who runs LinuxGSM from scripts, I want a failed check to return a non-zero exit code even when the log directory does not exist yet, so that the failure is not reported as success.

Script name

ts3server (any server is affected)

Game

Teamspeak 3

Linux distro

Debian 13

Command

command: start

Expected behavior

Cannot access .../serverfiles: No such directory and executable was not found exit with 1, as they do once the log directory exists.

Actual behavior

If the log directory does not exist (a new instance before install, a deleted log directory, or an LGSM_LOGDIR that does not exist), these checks print [ FAIL ] but exit with 0. If the public IP lookup failed, they exit with 2.

Further information

check_system_dir.sh, check_executable.sh and fn_check_steamcmd_user (core_steamcmd.sh) call fn_script_log_fail only if [ -d "${lgsmlogdir}" ], and only fn_script_log_fail sets exitcode=1. core_exit.sh then exits with whatever an earlier step left: the public IP lookup in info_game.sh (0, or 2 when it fails), or the local exitcode in fn_fetch_file (0) when the module was downloaded on this run. check.sh runs these checks before check_logs.sh, which creates the log directory. fn_script_log already skips writing when the log directory is missing, so the guard is not needed. check_root.sh has the same guard but sets exitcode=1 itself. Related: #5191.

Pre-checks
  • I ran update and validate before reporting this issue.

Not run: reproduced on a new develop instance, which has nothing to update or validate yet.

Relevant log output
# New ts3server instance from develop (eb8f34ae), Debian 13 (WSL2).
$ ./ts3server start; echo $?
[ FAIL ] Starting ts3server: Cannot access /home/borzaka/lgsm-test/.../serverfiles: No such directory
0
# Installed instance, log directory and executable removed:
$ ./ts3server start; echo $?
[ FAIL ] Starting ts3server: executable was not found
* /home/borzaka/lgsm-test/.../serverfiles/ts3server
0
Steps to reproduce
  1. Create a new instance: curl -Lo linuxgsm.sh https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/develop/linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh ts3server.
  2. Without installing, run ./ts3server start; echo $? (or stop, monitor). It prints [ FAIL ] ... Cannot access .../serverfiles and 0.
  3. On an installed instance (log directory present), move serverfiles away and run ./ts3server start; echo $?. The same error exits with 1. Move log away too and it exits with 0 again.

🤖 Generated with Claude Code

主要语言
Shell
星标
4.9k
派生
870
平均合并
18 小时 44 分钟
30 天内合并 PR
148

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

GameServerManagers/LinuxGSM 的其他 Issue

查看 GameServerManagers/LinuxGSM 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。