Git Product home page Git Product logo

Comments (3)

Wilfred avatar Wilfred commented on June 19, 2024 1

I've bumped into this too. I fixed it with:

(remove-hook 'find-file-hook #'crux-reopen-as-root)

Currently, opening any file that is read-only and not owned by the current user triggers a root login prompt. This occurs for viewing system files (e.g /etc/fstab), built-in elisp libraries (e.g. simple.el.gz) and simply viewing files owned by other users on a shared system.

This is assuming that the user wants to open the file, as root, and edit it. This isn't always true. If I don't have root on that box, it's pointless. If I just want to view an important system file, it's hazardous to open it as root as I might accidentally make changes that break things.

Changing the default behaviour of find-file like this caught me by surprise. @bbatsov what's the original intent of this feature? Could we make this opt-in, the same way crux keybindings are opt-in?

from crux.

bbatsov avatar bbatsov commented on June 19, 2024

I'm guessing something's off with the permissions of those local files.

from crux.

dgtized avatar dgtized commented on June 19, 2024

Hmm. I might be wrong, but have recently noticed that whenever I use M-. to jump to system installed elisp, the first load fails due to an attempt to re-open as root.

After a brief investigation I can confirm it with the following sequence:

(xref-find-definitions 'find-file) ;; asks for sudo root privileges
(kill-buffer "files.el.gz") ;; close buffer so find file will trigger again
(remove-hook 'find-file-hook 'crux-reopen-as-root)
(xref-find-definitions 'find-file) ;; jumps directly to files.el.gz with no password prompt
(kill-buffer "files.el.gz") ;; close buffer again
(add-hook 'find-file-hook 'crux-reopen-as-root) ;; re-add offending hook
(xref-find-definitions 'find-file) ;; prompts for sudo root again

I don't believe the hook should be that aggressive about re-opening as root.

from crux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.