starship: I Can't Download Starship on my Ubuntu System.

Bug Report

Current Behavior

When I try to download starship using the curl command. It shows this error saying it can’t open a tmp file and then it forcely exits the installation process.

Expected Behavior

it is meant to run the normal installation process.

Additional context/Screenshots

image

Possible Solution

Environment

  • Starship version: [the output of starship --version]
  • Shell type: [fish, zsh]
  • Shell version: [the output of fish --version or zsh --version]
  • Shell plugin manager: [if present, e.g. oh-my-fish, oh-my-zsh, fisher, antigen]
  • Terminal emulator: [e.g. iTerm, Hyper, Terminator]
  • Operating system: [e.g. macOS 10.13.4, Windows 10]

Relevant Shell Configuration

# Your configuration here

Starship Configuration

# Your configuration here

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Looks like curl is not behaving as expected. It’s told to create /tmp/tmp.ouRILl1Dhi.tar.gz but it only creates /tmp/tmp.ouRILl1Dhi. Or am I misunderstanding something here?

Yes: curl isn’t creating /tmp/tmp.ouRILl1Dhi, mktemp is. Apparently, snapped curl is blocked from writing to /tmp.

Additionally, the installer’s current use of mktemp exposes the user to a symlink attack:

file="$(mktemp).tar.gz"
# mktemp creates /tmp/tmp.ouRILl1Dhi

# attacker creates symlink /tmp/tmp.ouRILl1Dhi.tar.gz to (e.g.) /etc/passwd

curl -o $file $url
# curl writes to /etc/passwd via /tmp/tmp.ouRILl1Dhi.tar.gz symlink

mktemp is intended to atomically generate and reserve a unique filename. Deriving a different filename from mktemp’s output defeats that.

To fix this, ask mktemp to create the file you actually want to use:

file="$(mktemp tmp.XXXXXXXXXX.tar.gz)"

Hmm, okay I’ll do some poking around. I fired up a Linode just now and it did have wget by default, but I believe those images are slightly tweaked from the base images (and also it’s probably Ubuntu Server, not Ubuntu Desktop).

Thanks for all your help in debugging this!

Yep, that solved it. Ran sudo snap remove curl, then installed it via apt and restarted the shell (to refresh the new location of curl) and now it works as expected. Thanks!

Also, another thing. The download with the snap curl was corrupted. I added the .tar.gz extension to the downloaded file and tar said the file was corrupted. I figured that was a separate issue, but it looks to be the same.