[Bug]: A failed command exits with 0 when core_exit.sh is downloaded on exit

Aperta
#5,191 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #5192 di @borzaka — integrata

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
bash, linux, shell
Ambito
backend, cli

Direzione di ricerca

Read core_modules.sh and core_dl.sh, focusing on core_exit.sh(), fn_fetch_module, and fn_fetch_file around the local exitcode declaration. Reproduce with a fresh instance and the reported start command inside tmux, then compare its exit code before and after core_exit.sh is present. Done means the first failing run returns its original nonzero code; linked pull request #5192 is merged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

command: start distro: Debian engine: null game: Teamspeak 3 info: tmux reproducible: always severity: low status: fixed in develop 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 or cron, I want a failed command to return a non-zero exit code on a new instance too, 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

The command exits with the code it set, as it does on later runs (1 for the tmuxception error below).

Actual behavior

If lgsm/modules/core_exit.sh has not been downloaded yet, it is downloaded on exit and the command exits with 0. The same command exits with 1 once the file exists.

Further information

core_exit.sh() in core_modules.sh loads the module with fn_fetch_module, and fn_fetch_file (core_dl.sh) sources it inside its own function. When the file is missing, fn_fetch_file first declares local exitcode="" (line 505), which the curl result and fn_script_log_pass "Downloading ..." set to 0, so core_exit.sh exits with that local instead of the caller's code. Once the file exists the download branch is skipped, so only the exit that downloads core_exit.sh is affected, usually the first failing command on a new instance. The pattern is already in v21.3.2; #4159 only changed local exitcode=$? to local exitcode="". A fix is to download core_exit.sh without running it, keep exitcode, and then load it as before. Related but different exit code fixes: #5060, #5109, #5113.

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

Not run: found by code review and reproduced on a new develop instance, which has nothing to update or validate yet.

Relevant log output
# New ts3server instance from develop (11103431), Debian 13 (WSL2), run inside a tmux session.
$ ./ts3server start; echo $?
[ FAIL ] Starting ts3server: tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session.
...
fetching GitHub [ core_exit.sh ] ... OK
0
$ ./ts3server start; echo $?
[ FAIL ] Starting ts3server: tmuxception error: Sorry Cobb you cannot start a tmux session inside of a tmux session.
...
1
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. Inside a tmux session, run LGSM_GITHUBBRANCH=develop ./ts3server start; echo $?. It fails with the tmuxception error, fetches core_exit.sh last and prints 0.
  3. Run the same command again. It prints 1.

🤖 Generated with Claude Code

Lingua principale
Shell
Stelle
4.9k
Fork
870
Merge medio
18h 44m
PR unite (30g)
148

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GameServerManagers/LinuxGSM

Tutte le issue di GameServerManagers/LinuxGSM

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.