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

Open Beginner friendly
#5,193 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash, linux, shell
Domain
backend, cli

Research direction

Start with check_system_dir.sh, check_executable.sh, core_steamcmd.sh, and core_exit.sh; then trace how check.sh orders these checks before check_logs.sh creates the log directory. Confirm the exit code for each reported failure when the log directory is absent, including a failed public IP lookup or module download. Done means the checks return the expected nonzero status regardless of whether the log directory exists.

Written by the indexing model from the issue text.

Description

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

Dominant language
Shell
Stars
4.9k
Forks
870
Avg merge
18h 44m
Merged PRs (30d)
148

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GameServerManagers/LinuxGSM

All issues in GameServerManagers/LinuxGSM

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.