Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

msk(1) package install continues on failed download #354

Open

Description

@mknos

Hello,

If my msk.conf points to the wrong thing, or if the package mirror is not configured properly, the download might get a http 404 error. In this case, a package has not been fetched. msk(1) should not proceed with any install steps. I think it is more correct to just show an error: "Unable to fetch package from $ATTEMPTED_URL" and exit.

# msk install doom
Download doom...
Bad response code: 404

Install 'doom'...
gunzip: unspecified error from inflate
failed to read file
/usr/share/games/doom/install_desktop_launcher.sh: Command not found
post-installation command returned 127

Activity

  1. klange commented on Feb 12, 2026

    @klange
    Owner

    msk actually does try to check for failure at each step and bail, but:

    1. fetch doesn't actually return an error code on 404, so we continue to the next step. On its own, this would be expected behavior - we would need a flag to have a 404 return an error code: curl has --fail, for example.
    2. fetch still creates the destination file, so tar opens an empty file, which it doesn't care about initially, and passes to gunzip.
    3. gunzip correctly fails and returns an error code, but tar never sees this: it does not wait on gunzip at all (which ends up orphaned and is cleaned up by init when tar itself finishes).
    4. tar's extract_file fails to read a header with fopen, prints an error message, and ends extracting, but does not return an error code, so we continue to the next step.
    5. rm is happy to remove the empty temp file, and we continue to the next step.
    6. msk sees the failure of the post-install script not existing and finally bails.
  2. klange commented on Feb 12, 2026

    @klange
    Owner

    Fixing the first issue in fetch is a little annoying as we have a second version of it in the repository that uses mbedtls to support SSL/TLS connections. I would really like to re-implement that in a way where the original fetch is still the frontend and the mbedtls integration comes from an optional library that is dlopened, similar to how JPEG and PNG support is optional in libtoaru_graphics or how we used to support a Cairo backend in the compositor.

  3. mknos commented on Feb 12, 2026

    @mknos
    Author

    Having fetch exit with a failure code would be ideal. Even if it optionally supported fetch -o outputfile similar to wget & curl, and fetch is careful not to open() the file on 404, that is still more correct than creating an empty file even if the network is completely down (or the webserver is alive but the URL is wrong).

    At least curl is correct in this case and won't create a file, e.g. if the hostname fails to resolve.

  4. klange commented on Feb 12, 2026

    @klange
    Owner

    fetch has an -o argument, and msk uses it here.

    The main problem is that fetch is in need of many improvements and should be significantly refactored, so implementing a quick fix here is not worthwhile until those other improvements can be made.

  5. klange commented on Feb 12, 2026

    @klange
    Owner

    msk itself really needs to be rewritten, but that's a different matter - and already has a very old ticket in #214.

  6. added
    MSK
    on Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MSK

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions