Skip to content

Switching from a cargo-home to flat layout breaks updates #210

@zanieb

Description

@zanieb

In uv 0.4.30, we used the default install path resulting in the following receipt:

{
  "binaries": [
    "uv",
    "uvx"
  ],
  "binary_aliases": {},
  "cdylibs": [],
  "cstaticlibs": [],
  "install_layout": "cargo-home",
  "install_prefix": "/Users/zb/.cargo",
  "modify_path": true,
  "provider": {
    "source": "cargo-dist",
    "version": "0.23.0"
  },
  "source": {
    "app_name": "uv",
    "name": "uv",
    "owner": "astral-sh",
    "release_type": "github"
  },
  "version": "0.4.30"
}

In uv 0.5.0, we switched to a flat layout by specifying target install paths. However, this results in unexpected update behavior. uv self update places the executables in ~/.cargo instead of ~/.cargo/bin. The previous version's executables are not removed. The receipt contains the new version so subsequent update attempts fail.

This appears to be caused by not loading the install_layout from the receipt at

self.current_version_installed_by = Some(provider);
self.install_prefix = Some(receipt.install_prefix);
self.modify_path = receipt.modify_path;

The layout is not passed to the installer and it is hard-coded to flat: https://gist.github.com/zanieb/9dca39f62651087794bbb31fa377d72a#file-uv-installer-sh-L1018-L1020

The update results in the receipt:

{
  "binaries": [
    "uv",
    "uvx"
  ],
  "binary_aliases": {},
  "cdylibs": [],
  "cstaticlibs": [],
  "install_layout": "flat",
  "install_prefix": "/Users/zb/.cargo",
  "modify_path": true,
  "provider": {
    "source": "cargo-dist",
    "version": "0.25.1"
  },
  "source": {
    "app_name": "uv",
    "name": "uv",
    "owner": "astral-sh",
    "release_type": "github"
  },
  "version": "0.5.0"
}

This may be related to #113

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions