Closed hupfdule closed 2 years ago
Sorry but the suggestion to automatically invoke sudo
to overcome permission issues horrifies me as it would any other experienced Linux user. Quite simply, you are doing something fundamentally wrong if you are experiencing permission errors even occasionally.
The thing that bugs me the most in
vidir
is that changes that cannot be applied due to missing permissions are lost.Missing permissions are common when trying to edit root-owned files, but forgetting to use sudo.
This is especially annoying if there were lots of manual changes that then have to be applied again.
I think there are two options to support a use case to handle these problems in a smarter way:
sudo
for applying the actual changes.edir
with the correct permissions (e.g. by callingsudo edir < the_special_file
).The advantages of the first option are (in my opinion):
edir
process must run with root privileges and therefore reducing security risks.The advantages of the second option are (in my opinion):
edir
non-interactively, but having all the benefits ofedir
(like protection against accidental overwriting of files with the same name, renaming the file and its parent directories at once, etc.).Due to the advantages descibed above I think option 2 is the better option.
If option 2 should be implemented the format of the file must be defined. In my opinion it should a very easy human and machine readable format. Here is an example that just springs to mind as a rough idea:
The first being a rename, the second a delete and the third a copy operation. Of course instead of the Unicode arrow an ASCII arrow (
->
) can be used to allow easier creation/modification of such files by the user. But it must be assured that there is no confusion between the separator char (the arrow surrounded by (maybe a specific amount of) spaces) and such a char sequence inside a file name. But that should be easily solvable by checking that the sequence occurs only once per file.When generating the file from
edir
itself (due to an error when trying to apply the operation), a comment header could be added (like an interactive rebase in git) that describes the format:Also, in such a case, it must be prominently displayed to the user