add install-path writability preflight and path context on install errors#196
Open
jaemk wants to merge 1 commit into
Open
add install-path writability preflight and path context on install errors#196jaemk wants to merge 1 commit into
jaemk wants to merge 1 commit into
Conversation
…PathNotWritable`, name the install path in install errors
- new opt-in builder setter `check_install_path_writable(bool)` (default off,
all backends): probe `bin_install_path` writability before the download and
fail with the new `Error::InstallPathNotWritable { path }` on a definite
permission refusal, before any bytes are fetched. Indeterminate probe results
proceed. Sync and async flows. (#112)
- install-step IO failures now always name the install path: `PermissionDenied`
from self_replace / move-to-dest becomes `InstallPathNotWritable`; any other
IO error is rewrapped with "installing to {path}" context, preserving the
`ErrorKind`.
- the crate never escalates privileges (documented non-goal); a new Permissions
section in the crate docs shows detecting the error and relaunching elevated
via the `restart` module as the application's choice.
- hermetic integration tests in tests/permissions.rs prove a refused preflight
downloads nothing (recording client, zero requests) with async parity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #112.
check_install_path_writable(bool)builder setter (default off, all backends): probebin_install_pathwritability immediately before the download and fail with the newError::InstallPathNotWritable { path }on a definite permission refusal, before any bytes are fetched. Indeterminate probe results proceed. Sync and async flows.PermissionDeniedfrom self_replace / move-to-dest becomesInstallPathNotWritable; any other IO error is rewrapped with "installing to {path}" context, preserving theErrorKind. Previously this surfaced as a bareIo(Permission denied)with no path.restartmodule as the application's choice.Note that the probe is conservative by design: only a definite
PermissionDeniedfails the preflight; anything ambiguous (missing parent, unusual filesystems, Windows ACL edge cases) proceeds and lets the real install operation surface the error, now with path context.