dotter icon indicating copy to clipboard operation
dotter copied to clipboard

[FEATURE] Don't ask for an elevation if nothing has changed

Open vessd opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. I have several files in /etc with root ownership. Every time I deploy to update a configuration based on a template, dotter prompts me for elevation, even if the files in /etc have not changed.

Describe the solution you'd like Prompt for elevation only if the files that require them have changed.

vessd avatar May 22 '21 14:05 vessd

Seems like this is the source of the issue: https://github.com/SuperCuber/dotter/blob/106c2ea5310267ff85bc32aef4a8d715be9c4020/src/actions.rs#L339

The Identical variant should not run perform_template_deploy.

@vessd , can you confirm that this only happens when the file is a template, and not when it's a symlink?

SuperCuber avatar May 22 '21 15:05 SuperCuber

can you confirm that this only happens when the file is a template, and not when it's a symlink?

No, it looks like it's still asking for it

[ WARN] Elevating permissions (Setting owner of "/etc/environment" to Name("root")...)

Hmm, in general I think it shouldn't be allowed to specify the owner for links, since it can't be done correctly. I mean, now I don't need root privileges to edit the /etc/environment file, since root only owns the link.

vessd avatar May 22 '21 16:05 vessd

No, it looks like it's still asking for it

OK, I'll check it in both symlink and template cases when I get to doing this.

Hmm, in general I think it shouldn't be allowed to specify the owner for links, since it can't be done correctly.

This is a good point, but I think I'll keep the ability to do this both for backwards compatibility and because there's not much reason to lock someone out of doing it if they "know what they are doing". A quote that comes to mind is "a system that prevents the user from doing stupid things also prevents the user from doing smart things".

I think it could be useful to have a warning for this though - maybe as a warn! in the create_symlink function, or even simpler - somewhere in the wiki.

SuperCuber avatar May 22 '21 17:05 SuperCuber