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

Đang mở Phù hợp với người mới
#5,193 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, linux, shell
Lĩnh vực
backend, cli

Hướng nghiên cứu

Bắt đầu với check_system_dir.sh, check_executable.sh, core_steamcmd.sh và core_exit.sh; sau đó theo dõi thứ tự check.sh thực hiện các bước kiểm tra này trước khi check_logs.sh tạo thư mục nhật ký. Xác nhận mã thoát cho từng lỗi được báo cáo khi thư mục nhật ký không tồn tại, bao gồm cả trường hợp tra cứu IP công khai hoặc tải mô-đun thất bại. Công việc hoàn tất khi các bước kiểm tra trả về trạng thái khác không như mong đợi, bất kể thư mục nhật ký có tồn tại hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Shell
Star
4.9k
Fork
870
Merge trung bình
18 giờ 44 phút
Pull request đã merge (30 ngày)
148

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GameServerManagers/LinuxGSM

Tất cả issue của GameServerManagers/LinuxGSM

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.