akirak / helm-linux-disks

Emacs Helm interface for mounting removable disks in Linux
11 stars 0 forks source link

`sudo lsblk` fails if password is not cached #1

Open Ambrevar opened 5 years ago

Ambrevar commented 5 years ago

In the following

(defun helm-linux-disks--lsblk-with-levels ()
  "Run lsblk command and annotate each line with its level."
  (mapcar (lambda (raw-output)
            (cons (helm-linux-disks--lsblk-get-level raw-output) raw-output))
          (process-lines "sudo" "lsblk" "-n" "-p" "-o" "name,mountpoint,fstype,type,size")))

the process-lines fails if the password is not cached by sudo. I'm not sure how to fix it, but lsblk works without sudo for me (on Guix System).

Ambrevar commented 5 years ago

I also recommend making the command customizable to accommodate systems like Nix and Guix.

akirak commented 5 years ago

Thank you for trying out my package. Now you can run the command without sudo by setting linux-disk-use-sudo to nil. Since I have switched to Chrome OS for the most part, I can't test this package now. Does it work?

As for the password issue, I have no idea how to resolve it. I didn't need a password to run sudo on my computer as I had tweaked /etc/sudoers to allow that.

akirak commented 5 years ago

I think I need a major rewrite of this package with regards to the privilege problem. I will work on it later, since I have no Linux machine now and I can't test this package properly on Chrome OS. Would you want to omit sudo for running LVM commands?

Ambrevar commented 5 years ago

Thanks, this works!

I don't use LVM so I cannot test this use case.

akirak commented 5 years ago

Thanks. I'm now planning on delegating those process tasks to a separate package. Hopefully, it will allow more flexible customisation of calling external processes. For now, I'm glad it solved the problem.