-
Notifications
You must be signed in to change notification settings - Fork 699
fix: renew package rev only when it's empty
#3200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Wouldn't a write still be attempted? This stops the pin from being overwritten; but yazi will still attempt to write to the file even if the contents haven't been changed (Just tested on nightly). My guess is that it would be trivial to derive equality or partial equality on the data structure you're using internally to represent the package file, and only write when it's different than the old. I could submit a PR for this. This is useful mainly for dealing with setups (like those encouraged by nix) that are designed to be immutable. But also should make Yazi more reliable. |
|
Perhaps it's possible to check for manifest differences before writing to
the file, but I'm not sure if it really makes sense, because there's no
guarantee of immutability at the file content or format level on `install`,
which means if new fields that need to change druing `install` are
introduced in the future, it could break this check, which makes it pretty
fragile
…On Wed, Sep 24, 2025 at 11:48 PM Miles Wirht ***@***.***> wrote:
*philocalyst* left a comment (sxyazi/yazi#3200)
<#3200 (comment)>
Wouldn't a write still be attempted? This stops the pin from being
overwritten; but yazi will still attempt to write to the file even if the
contents haven't been changed (Just tested on nightly).
My guess is that it would be trivial to derive equality or partial
equality on the data structure you're using internally to represent the
package file, and only write when it's different than the old. I could
submit a PR for this.
This is useful mainly for dealing with setups (like those encouraged by
nix) that are designed to be immutable. But also should make Yazi more
reliable.
—
Reply to this email directly, view it on GitHub
<#3200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFWFIENVA6D6DMVS2U72733UK4N5AVCNFSM6AAAAACHL3D5DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMRZGU4DINZSG4>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
|
I suppose you're right, but as of right now, those fields don't exist, and yazi will fail on an immutable package.toml even if it has nothing to change. Is this really the desired behavior? Couldn't yazi just throw a WARN? |
|
Yes, that's by design, `ya pkg` expects `package.toml` (as well as the
`plugins` and `flavors` directories) to be readable and writable, and any
write failure should be considered a fatal error as `ya pkg` is not
supposed to work on a read-only filesystem.
If you need this level of isolation with Nix, using Nix's own package
manager to manage Yazi itself along with its plugins is a better way to
achieve immutability - they are already available in nixpkgs:
https://search.nixos.org/packages?channel=unstable&query=yazi
That said, if you really think it's worth the effort, I can accept a PR to
check if writing can be avoided before writing, but this would be
best-effort and implementation-dependent - I can't guarantee it will always
work as future iterations evolve.
…On Thu, Sep 25, 2025 at 5:08 AM Miles Wirht ***@***.***> wrote:
*philocalyst* left a comment (sxyazi/yazi#3200)
<#3200 (comment)>
I suppose you're right, but as of *right now*, those fields don't exist,
and yazi will fail on an immutable package.toml even if it has *nothing
to change*. Is this really the desired behavior? Couldn't yazi just throw
a WARN?
As in:
WARNING: Couldn't write to package.toml, updates may not be saved.
—
Reply to this email directly, view it on GitHub
<#3200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFWFID6A7DT67QCXLH66NL3UMB5DAVCNFSM6AAAAACHL3D5DKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMZQG4ZDCNBSGI>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
|
It's not worth the effort. (I didn't know about those on nixpkgs) Thank you for the kind and informed responses. |
Fixes #3197