Skip to content

Improve error handling across all scripts#297

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782412133-improve-error-handling
Open

Improve error handling across all scripts#297
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1782412133-improve-error-handling

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Systematically adds error checking to ~570 unchecked commands across 177 shell scripts that previously failed silently.

Key patterns fixed:

|| return 1 added to unchecked commands in build/install functions:

  • cd — ~66 instances; a failed cd causes all subsequent commands to run in the wrong directory
  • wget / git clone — ~33 instances; failed downloads proceeded to build broken/missing sources
  • make / cmake — ~150 instances; failed builds were silently ignored
  • tar / unzip — ~18 instances; failed extractions left partial/missing files
  • mv — ~74 instances; failed moves left files in wrong locations

mkdir -p flag added to ~50 mkdir calls to prevent failures on pre-existing directories.

Piped command patterns fixed (silent failures when left side of pipe fails):

# kweb.sh, reminiscence.sh — wget|tar split into:
wget -q <url> || return 1
tar -xf <file> || return 1
rm -f <file>

# kodi-extra.sh — wget|apt-key split into:
wget -qO /tmp/kodi-repo.gpg.key <url> || return 1
apt-key add /tmp/kodi-repo.gpg.key >/dev/null

Dead error variable fixed in openbor.sh:

# Before: error= set but never checked
error="This script is intended for Raspberry Pis only..."
# After: uses RetroPie's error propagation mechanism
md_ret_errors+=("This script is intended for Raspberry Pis only...")
return 1

install-extras.sh fixes:

  • git pull origin — unchecked; now exits on failure
  • cp, rm — used in && chains that swallowed errors; replaced with explicit if ! cmd; then ... exit 1; fi
  • Complex cp ... && rm ... chains — wrapped in { ... || exit 1; } to catch both failures
  • Bare exitexit 0 / exit 1 for explicit exit codes
  • VERSION file read without existence check

Link to Devin session: https://app.devin.ai/sessions/a097d510c3ec42ff871f3bbf2d17cc75
Requested by: @Exarkuniv

- Add '|| return 1' to unchecked cd, wget, git clone, make, cmake,
  tar, unzip, and mv commands in build/install functions
- Add -p flag to mkdir commands to prevent failures on existing dirs
- Fix piped wget|tar patterns in kweb.sh and reminiscence.sh by
  splitting into separate commands with error checks
- Fix piped wget|apt-key pattern in kodi-extra.sh
- Fix dead error variable in openbor.sh - use md_ret_errors and return 1
- Fix install-extras.sh: add error checks on git pull, cp, rm, and
  complex shell chains; use proper exit codes
- Fix complex chains in install-extras.sh using { ... || ...; } syntax

177 files changed across emulators, ports, libretrocores, and
supplementary scriptmodules.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Exarkuniv Exarkuniv self-assigned this Jun 25, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant