Skip to content

Dependency/edition bump, plus features#100

Open
dwink wants to merge 4 commits into
mainfrom
dharks/modernize
Open

Dependency/edition bump, plus features#100
dwink wants to merge 4 commits into
mainfrom
dharks/modernize

Conversation

@dwink
Copy link
Copy Markdown
Contributor

@dwink dwink commented Oct 21, 2025

  • adds a --verbose flag to list which shows the configured version as well as all installed versions of the app
  • adds a prune command which removes all versions not referenced in the config
  • replace serde_yaml with maintained serde_yaml_ng
  • 2024 edition
  • adjust files::delete_if_exists to handle deleting symlinks (previously, the code used exists() and is_dir() which always follow symlinks; now checks for symlink first.

David Harks added 4 commits October 20, 2025 20:05
* adds a `--verbose` flag to `list` which shows the configured version
  as well as all installed versions of the app
* adds a `prune` command which removes all versions not referenced in
  the config
* replace `serde_yaml` with maintained `serde_yaml_ng`
* 2024 edition
* adjust `files::delete_if_exists` to handle deleting symlinks
  (previously, the code used `exists()` and `is_dir()` which always
  follow symlinks; now checks for symlink first.
@dwink dwink requested a review from apmorton October 21, 2025 01:13
Comment thread src/main.rs
Comment on lines +468 to +470
unsafe {
std::env::set_var("PATH", updated_path);
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting an environment variable is unsafe now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Technically only in multithreaded contexts on non-Windows. Discussion here.

Comment thread src/app.rs
.join(&self.version))
}

pub fn versions(&self) -> Result<Vec<String>> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this (and prune_other_versions) are unfortunately fighting an uphill battle with some history:

/home/amorton/.cache/ozy/meter:
total 8.0K
drwxrwxr-x  3 amorton amorton  135 Mar  4  2025 ./
drwxrwxr-x 46 amorton amorton 4.0K Oct 16 04:51 ../
lrwxrwxrwx  1 amorton amorton   71 Jan 28  2025 348 -> /home/amorton/.cache/ozy/meter/348.8861341d-5179-414d-95ed-06f385fe5bdc/
drwxrwxr-x 15 amorton amorton 4.0K Jan 28  2025 348.8861341d-5179-414d-95ed-06f385fe5bdc/
-rw-rw-r--  1 amorton amorton    0 Jan 28  2025 348.lock
lrwxrwxrwx  1 amorton amorton   51 Jan 28  2025 353 -> /home/amorton/.cache/ozy/internal_install/meter/353/
-rw-rw-r--  1 amorton amorton    0 Jan 28  2025 353.lock
lrwxrwxrwx  1 amorton amorton   51 Mar  4  2025 359 -> /home/amorton/.cache/ozy/internal_install/meter/359/
-rw-rw-r--  1 amorton amorton    0 Mar  4  2025 359.lock

internal_install wasn't always a thing; we used to install to <version>.<uuid> and symlink. I actually preferred that since it meant there was exactly one directory tree per app, but 🤷

I think the most robust thing to do is:

  • look for .lock files and remove the .lock suffix
  • those are your installed versions

to uninstall

  • lock .lock
  • check if is a symlink, and if it is contained within the ozy install path follow it
  • if is a symlink, remove that first
  • atomically rename directories to remove to something random (possibly into ~/.cache/ozy/to_delete/` so we can easily resume interrupted unlinks?)
  • recursively remove the directory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting...do you know why internal_install was created/favored over the uuid directory/symlink?

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.

2 participants