[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Root emacs weirdness

From: Bob Proulx
Subject: Re: Root emacs weirdness
Date: Sat, 21 Sep 2013 18:08:58 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

notbob wrote:
> While learning about linux gutz, I used emacs dired by root to edit
> /proc/sys/kernel/dmesg_restrict file from a 1 to a 0.

Your misunderstanding starts with missing that the entire /proc is not
a real filesystem.  It is a fake filesystem.  It is meant as a way to
present kernel data to the user.  It is not intended to hold random
files.  When you try to create backups in that directory the backup of
the file can't exist there.

> Opened emacs / from root, then went to said dir and edited file.
> Upon trying to edit file using e, I get this in the mini-buffer:
> Buffer is read-only: #<buffer dmesg_restrict>
> .....but, I was then able to edit the file, nonetheless.  ???

Root can normally edit any file in the normal file system regardless
of permissions.  So emacs will continue to let you try.

> File permissions are 644.  When it came time to save the
> dmesg_restrict file using C-x C-s, I get:
> Cannot modify backup file  ....something or other.....
> IO error writing /proc/sys/kernel/dmesg_restrict: Invalid argument

Since /proc isn't a real file system many of the normal things editors
try to do to files cannot work.  The attempt is "invalid" since the
context does not allow it.

> Yet, in the end, the file is modified.

I am sure that emacs does eventually write the buffer contents to the
pseudo-file.  That will work.  Same as the normal thing.

  echo "1" > /proc/path/to/control

> Also, jumping up to the parent dir (/proc/sys/kernel), I see no
> back-up file (foo~) is created.

All of /proc is a fake filesystem.  You can't create random files
there.  Invalid.

> What the heck is --or is not-- going on??

Don't try to edit files in /proc.  It isn't a real file system.  All
of /proc is a representation of kernel data structures.  As a limited
interface you can change some of the values.

  echo "1" > /proc/path/to/control

But that is a very limited operational set of actions.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]