_install doesn't handle download failure

Open Beginner friendly
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
shell
Domain
cli

Research direction

Start in rgbenv at _install, especially lines 334-346, and trace the commands run when the downloaded tempfile is not a valid tarball. Verify the tar failure handling with a failed download or invalid archive; done means later extraction, moving, changing directories, and make steps are not attempted after the download failure.

Written by the indexing model from the issue text.

Description

The _install function will fail pretty messily in case of a number of errors, but particularly in case of the download failing.

https://github.com/gbdev/rgbenv/blob/251577417781a4e8b70da719cf1808e5ecbf6d89/rgbenv#L334-L346

if $tempfile is not a valid tarball, i.e. if the download fails:

  • tar -t will fail
  • $dirname will be empty, ideally
  • tar -x will fail
  • mv will fail, trying to move the versions directory into itself
  • cd will fail
  • make will be invoked in the version directory, probably "no makefile found" error
  • a message will be printed saying that "You may still use this version, just with missing tools."

The most basic thing to add would be checking tar's exit status, which would catch a lot of potential problems.

Dominant language
Shell
Stars
12
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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 gbdev/rgbenv

All issues in gbdev/rgbenv

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.