Skip to content
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

Is the concept corect? #11

Open
hajosc opened this issue Mar 19, 2021 · 3 comments
Open

Is the concept corect? #11

hajosc opened this issue Mar 19, 2021 · 3 comments

Comments

@hajosc
Copy link

hajosc commented Mar 19, 2021

My apologies, I may just not understand the idea behind auto-sudoedit, but I do have difficulties understanding the idea behind it:

  • I open a file that is rw-r--r-- root:root as user foo. Emacs opens it.
  • I try to edit it, but emacs says it's only rw for root, foo can't edit it.
  • I try to save it (without editing), emacs says "no need to save, no changes"

Shouldn't auto-sudoedit instead intercept the "find-file" function and say "hey, you won't be able to edit/save this file, do you want to open it as root via tramp instead"?

@ncaq
Copy link
Owner

ncaq commented Mar 22, 2021

I can open it as user root.

-rw-r--r-- 1 root root    7  3月 22 16:16 foobar.txt

So I could not understand what the problem was there.
It may be because my English skills are not good enough.

@hajosc
Copy link
Author

hajosc commented Mar 22, 2021

No problem, my English is also not very good :) I try again:

  1. I am user foo
  2. I open: -rw-r--r-- root root (...) /etc/hosts
  3. I can see the file contents: 127.0.0.1 localhost localhost.localdomain
  4. I want to edit the file. Emacs says: "Error! File is read only!"
  5. I want to save the file with C-x C-s. Emacs says "Error! No changes need to be saved"

How can I edit the file then? As step 3.1 I need to disable read-only-mode.

For "Auto-sudoedit", my idea was to change the algorithm:

  1. I am user foo
  2. I open: -rw-r--r-- root root (...) /etc/hosts
  3. auto-suedit checks:
    • Can foo write to the file?
    • Yes: Open it
    • No: Use tramp sudo to open it

Sorry; is it more clear now?

@ncaq
Copy link
Owner

ncaq commented Mar 24, 2021

For "Auto-sudoedit", my idea was to change the algorithm:

I think auto-sudoedit is currently working with that algorithm, so I don't know why it doesn't reopen.

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

No branches or pull requests

2 participants