unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Root emacs weirdness
@ 2013-09-21 11:22 notbob
  2013-09-22  0:08 ` Bob Proulx
       [not found] ` <mailman.2682.1379808553.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: notbob @ 2013-09-21 11:22 UTC (permalink / raw)
  To: help-gnu-emacs

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.  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.  ???  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

.....and then do C-x k, I get the std 'still wanna kill buffer'
question (y).  Yet, in the end, the file is modified.  Also, jumping
up to the parent dir (/proc/sys/kernel), I see no back-up file (foo~)
is created.  I tried this 4-5 times, trying to get the first part of
the above error msg and on the 5 try, it DID indicate the file has
been saved (wrote).  !?!?

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

I'm using emacs 23.3.1 on Slackware 13.37.

nb   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Root emacs weirdness
  2013-09-21 11:22 Root emacs weirdness notbob
@ 2013-09-22  0:08 ` Bob Proulx
       [not found] ` <mailman.2682.1379808553.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Bob Proulx @ 2013-09-22  0:08 UTC (permalink / raw)
  To: notbob; +Cc: help-gnu-emacs

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.

Bob



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Root emacs weirdness
       [not found] ` <mailman.2682.1379808553.10748.help-gnu-emacs@gnu.org>
@ 2013-09-22  3:00   ` notbob
  2013-09-22  3:55   ` Barry Margolin
  1 sibling, 0 replies; 4+ messages in thread
From: notbob @ 2013-09-22  3:00 UTC (permalink / raw)
  To: help-gnu-emacs

On 2013-09-22, Bob Proulx <bob@proulx.com> wrote:

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

The above is the accepted solution to editing that particular file, I
jes thought I'd try and do it manually via emacs, which did work,
after a fashion.  Thank you for the detailed explanation of why the
normal emacs mechanisms did not work.  Makes perfect sense.  ;)

nb





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Root emacs weirdness
       [not found] ` <mailman.2682.1379808553.10748.help-gnu-emacs@gnu.org>
  2013-09-22  3:00   ` notbob
@ 2013-09-22  3:55   ` Barry Margolin
  1 sibling, 0 replies; 4+ messages in thread
From: Barry Margolin @ 2013-09-22  3:55 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.2682.1379808553.10748.help-gnu-emacs@gnu.org>,
 Bob Proulx <bob@proulx.com> wrote:

> 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.

Perhaps backups should be inhibited by default for /proc.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-22  3:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-21 11:22 Root emacs weirdness notbob
2013-09-22  0:08 ` Bob Proulx
     [not found] ` <mailman.2682.1379808553.10748.help-gnu-emacs@gnu.org>
2013-09-22  3:00   ` notbob
2013-09-22  3:55   ` Barry Margolin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).