unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why emacs touches read-only file?
@ 2007-04-18 18:20 Daniel
  2007-04-18 18:49 ` Eric Hanchrow
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Daniel @ 2007-04-18 18:20 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

1. Create a file with permission of 444 (read-only) file.
2. Open the file using emacs.

Question.

My emacs open the read-only file as writable buffer. Also, I can
modify it and save it. (AMAZING, emacs IGNORES unix file system. WOW.)

What happened to the emacs, and how it works properly (open files as
read-only if it is read-only, and as writable if it is writable.)

Thank you,

Dan.

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

* Re: Why emacs touches read-only file?
  2007-04-18 18:20 Why emacs touches read-only file? Daniel
@ 2007-04-18 18:49 ` Eric Hanchrow
  2007-04-18 19:22 ` Glenn Morris
  2007-04-20  2:28 ` Tim X
  2 siblings, 0 replies; 18+ messages in thread
From: Eric Hanchrow @ 2007-04-18 18:49 UTC (permalink / raw)
  To: help-gnu-emacs


    Hi all,
    1. Create a file with permission of 444 (read-only) file.
    2. Open the file using emacs.

    Question.

    My emacs open the read-only file as writable buffer. 

Mine doesn't.
                                                         
    Also, I can modify it and save it. (AMAZING, emacs IGNORES unix
    file system. WOW.)

Sounds like a bug.  Please report it by doing M-x report-emacs-bug
RET.  Also be sure to read (info "(emacs)Bugs").

-- 

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

* Re: Why emacs touches read-only file?
  2007-04-18 18:20 Why emacs touches read-only file? Daniel
  2007-04-18 18:49 ` Eric Hanchrow
@ 2007-04-18 19:22 ` Glenn Morris
  2007-04-19  3:00   ` Matthew Flaschen
  2007-04-19  4:43   ` Daniel
  2007-04-20  2:28 ` Tim X
  2 siblings, 2 replies; 18+ messages in thread
From: Glenn Morris @ 2007-04-18 19:22 UTC (permalink / raw)
  To: help-gnu-emacs

Daniel wrote:

> 1. Create a file with permission of 444 (read-only) file.

OK:

touch 1
chmod 444 1

> 2. Open the file using emacs.

OK:

emacs-21.3 -q --no-site-file 1

> My emacs open the read-only file as writable buffer.

Mine doesn't: "Note: file is write protected"

> Also, I can modify it and save it.

I can't: "Buffer is read-only: #<buffer 1>".


I can if I do M-x toggle-read-only, but then when I go to save the
file I am prompted "File 1 is write-protected; try to save anyway?".
This all seems pretty robust.


> (AMAZING, emacs IGNORES unix file system. WOW.)

Not really. It does what you tell it do, and provides you with plenty
of notification as it does so.


> What happened to the emacs, and how it works properly (open files as
> read-only if it is read-only, and as writable if it is writable.)

As described, your Emacs is not behaving in the standard way, so
something on your system must be making it act like this.

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

* Re: Why emacs touches read-only file?
  2007-04-18 19:22 ` Glenn Morris
@ 2007-04-19  3:00   ` Matthew Flaschen
  2007-04-19  4:43   ` Daniel
  1 sibling, 0 replies; 18+ messages in thread
From: Matthew Flaschen @ 2007-04-19  3:00 UTC (permalink / raw)
  To: emacs

Glenn Morris wrote:
> Daniel wrote:
> 
>> 1. Create a file with permission of 444 (read-only) file.
> 
> OK:
> 
> touch 1
> chmod 444 1
> 
>> 2. Open the file using emacs.
> 
> OK:
> 
> emacs-21.3 -q --no-site-file 1
> 
>> My emacs open the read-only file as writable buffer.
> 
> Mine doesn't: "Note: file is write protected"
> 
>> Also, I can modify it and save it.
> 
> I can't: "Buffer is read-only: #<buffer 1>".
> 
> 
> I can if I do M-x toggle-read-only, but then when I go to save the
> file I am prompted "File 1 is write-protected; try to save anyway?".
> This all seems pretty robust.

However, if you then choose yes, it will allow you to save if you have
permissions to give yourself write access.  Moreover, the file will go
back to being read-only afterwards, which is a bit strange.

Matthew Flaschen

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

* Re: Why emacs touches read-only file?
  2007-04-18 19:22 ` Glenn Morris
  2007-04-19  3:00   ` Matthew Flaschen
@ 2007-04-19  4:43   ` Daniel
  2007-04-19  7:51     ` Glenn Morris
  2007-04-19 10:07     ` Why emacs touches read-only file? Arne Schmitz
  1 sibling, 2 replies; 18+ messages in thread
From: Daniel @ 2007-04-19  4:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 18, 12:22 pm, Glenn Morris <rgm+n...@stanford.edu> wrote:
> Daniel wrote:
> > 1. Create a file with permission of 444 (read-only) file.
>
> OK:
>
> touch 1
> chmod 444 1
>
> > 2. Open the file using emacs.
>
> OK:
>
> emacs-21.3 -q --no-site-file 1
>
> > My emacs open the read-only file as writable buffer.
>
> Mine doesn't: "Note: file is write protected"
>
> > Also, I can modify it and save it.
>
> I can't: "Buffer is read-only: #<buffer 1>".
>
> I can if I do M-x toggle-read-only, but then when I go to save the
> file I am prompted "File 1 is write-protected; try to save anyway?".
> This all seems pretty robust.
>
> > (AMAZING, emacs IGNORES unix file system. WOW.)
>
> Not really. It does what you tell it do, and provides you with plenty
> of notification as it does so.
>
> > What happened to the emacs, and how it works properly (open files as
> > read-only if it is read-only, and as writable if it is writable.)
>
> As described, your Emacs is not behaving in the standard way, so
> something on your system must be making it act like this.

It is very weird. In my work place, I was using REDHAT 9 and SUSE 9.3.
In there, emacs (21) write the buffer regardless of the file
permission. I am using Ubuntu in my home, and installed "GNU Emacs
22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
2006-09-19 on rothera, modified by Debian", which works properly.

Hmm...Something wrong in the emacs in SUSE 9.3 or REDHAT 9. How can I
fix the problem? What part should I see?

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

* Re: Why emacs touches read-only file?
  2007-04-19  4:43   ` Daniel
@ 2007-04-19  7:51     ` Glenn Morris
  2007-04-19 18:09       ` Daniel
  2007-04-19 10:07     ` Why emacs touches read-only file? Arne Schmitz
  1 sibling, 1 reply; 18+ messages in thread
From: Glenn Morris @ 2007-04-19  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

Daniel wrote:

> It is very weird. In my work place, I was using REDHAT 9 and SUSE 9.3.
> In there, emacs (21) write the buffer regardless of the file
> permission. 

Even if you start it with the options -q --no-site-file?

If it works OK with -q, there is something in your ~/.emacs file (or
system default.el file) to blame. If it works OK with --no-site-file,
there is some problem in your system's site-start.el file.

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

* Re: Why emacs touches read-only file?
  2007-04-19  4:43   ` Daniel
  2007-04-19  7:51     ` Glenn Morris
@ 2007-04-19 10:07     ` Arne Schmitz
  2007-04-19 18:10       ` Daniel
  1 sibling, 1 reply; 18+ messages in thread
From: Arne Schmitz @ 2007-04-19 10:07 UTC (permalink / raw)
  To: help-gnu-emacs

Daniel wrote:

> It is very weird. In my work place, I was using REDHAT 9 and SUSE 9.3.
> In there, emacs (21) write the buffer regardless of the file
> permission. I am using Ubuntu in my home, and installed "GNU Emacs
> 22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
> 2006-09-19 on rothera, modified by Debian", which works properly.
> 
> Hmm...Something wrong in the emacs in SUSE 9.3 or REDHAT 9. How can I
> fix the problem? What part should I see?

Does the file you have edited by any chance reside on a networked mount? 

Arne

-- 
[--- PGP key FD05BED7 --- http://www.root42.de/ ---]

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

* Re: Why emacs touches read-only file?
  2007-04-19  7:51     ` Glenn Morris
@ 2007-04-19 18:09       ` Daniel
  2007-04-19 19:07         ` Peter Dyballa
       [not found]         ` <mailman.2277.1177009971.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: Daniel @ 2007-04-19 18:09 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 19, 12:51 am, Glenn Morris <rgm+n...@stanford.edu> wrote:
> Daniel wrote:
> > It is very weird. In my work place, I was using REDHAT 9 and SUSE 9.3.
> > In there, emacs (21) write the buffer regardless of the file
> > permission.
>
> Even if you start it with the options -q --no-site-file?
>
> If it works OK with -q, there is something in your ~/.emacs file (or
> system default.el file) to blame. If it works OK with --no-site-file,
> there is some problem in your system's site-start.el file.

No. I tried to run "emacs -q 1" and "emacs --no-site-file 1" and
"emacs -q --no-site-file 1", but all of them are not working properly
with read-only file.

BTW, I am seeing the REDHAT or SUSE linux via VNC Client. Is this
causing the problem?

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

* Re: Why emacs touches read-only file?
  2007-04-19 10:07     ` Why emacs touches read-only file? Arne Schmitz
@ 2007-04-19 18:10       ` Daniel
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel @ 2007-04-19 18:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 19, 3:07 am, Arne Schmitz <arne.schm...@gmx.net> wrote:
> Daniel wrote:
> > It is very weird. In my work place, I was using REDHAT 9 and SUSE 9.3.
> > In there, emacs (21) write the buffer regardless of the file
> > permission. I am using Ubuntu in my home, and installed "GNU Emacs
> > 22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
> > 2006-09-19 on rothera, modified by Debian", which works properly.
>
> > Hmm...Something wrong in the emacs in SUSE 9.3 or REDHAT 9. How can I
> > fix the problem? What part should I see?
>
> Does the file you have edited by any chance reside on a networked mount?
>
> Arne
>
> --
> [--- PGP key FD05BED7 ---http://www.root42.de/---]

Actually, it is not mounted via network. But I am using Linux via VNC
Client. Is this causing the problem? (I don't think so.)

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

* Re: Why emacs touches read-only file?
  2007-04-19 18:09       ` Daniel
@ 2007-04-19 19:07         ` Peter Dyballa
       [not found]         ` <mailman.2277.1177009971.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2007-04-19 19:07 UTC (permalink / raw)
  To: Daniel; +Cc: help-gnu-emacs


Am 19.04.2007 um 20:09 schrieb Daniel:

> No. I tried to run "emacs -q 1" and "emacs --no-site-file 1" and
> "emacs -q --no-site-file 1", but all of them are not working properly
> with read-only file.

Why are you using the number 1 as an argument?

--
Greetings

   Pete

Some day we may discover how to make magnets that can point in any  
direction.

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

* Re: Why emacs touches read-only file?
       [not found]         ` <mailman.2277.1177009971.7795.help-gnu-emacs@gnu.org>
@ 2007-04-19 21:28           ` Daniel
  2007-04-20  1:02           ` EMacs & X-windows "Wilfred Zegwaard (privé)"
  1 sibling, 0 replies; 18+ messages in thread
From: Daniel @ 2007-04-19 21:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 19, 12:07 pm, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 19.04.2007 um 20:09 schrieb Daniel:
>
> > No. I tried to run "emacs -q 1" and "emacs --no-site-file 1" and
> > "emacs -q --no-site-file 1", but all of them are not working properly
> > with read-only file.
>
> Why are you using the number 1 as an argument?
>
> --
> Greetings
>
>    Pete
>
> Some day we may discover how to make magnets that can point in any
> direction.

Pete,

It is not the argument. It is the file name as simplified as I can.

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

* EMacs & X-windows
       [not found]         ` <mailman.2277.1177009971.7795.help-gnu-emacs@gnu.org>
  2007-04-19 21:28           ` Daniel
@ 2007-04-20  1:02           ` "Wilfred Zegwaard (privé)"
  2007-04-20  9:03             ` Peter Dyballa
  1 sibling, 1 reply; 18+ messages in thread
From: "Wilfred Zegwaard (privé)" @ 2007-04-20  1:02 UTC (permalink / raw)
  To: help-gnu-emacs

I'm using EMacs and Windows XP. Is there a way of setting EMacs in a 
X-Windows like environment? I've got a framed environment and I want a 
window-environment. Or do I need KDE for that?

Thanks,

Wilfred

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

* Re: Why emacs touches read-only file?
  2007-04-18 18:20 Why emacs touches read-only file? Daniel
  2007-04-18 18:49 ` Eric Hanchrow
  2007-04-18 19:22 ` Glenn Morris
@ 2007-04-20  2:28 ` Tim X
  2007-04-20  7:00   ` Daniel
  2 siblings, 1 reply; 18+ messages in thread
From: Tim X @ 2007-04-20  2:28 UTC (permalink / raw)
  To: help-gnu-emacs

Daniel <hanmoai@gmail.com> writes:

> Hi all,
>
> 1. Create a file with permission of 444 (read-only) file.
> 2. Open the file using emacs.
>
> Question.
>
> My emacs open the read-only file as writable buffer. Also, I can
> modify it and save it. (AMAZING, emacs IGNORES unix file system. WOW.)
>
> What happened to the emacs, and how it works properly (open files as
> read-only if it is read-only, and as writable if it is writable.)
>
> Thank you,
>
> Dan.
>

doing the same thing with emacs 22 gives me a read only file. any attempt to
modify the file gives me a buffer is read only message. 

Your not running as root are you?

Tim

-- 
tcross (at) rapttech dot com dot au

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

* Re: Why emacs touches read-only file?
  2007-04-20  2:28 ` Tim X
@ 2007-04-20  7:00   ` Daniel
  2007-04-20 14:51     ` Daniel
                       ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Daniel @ 2007-04-20  7:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 19, 7:28 pm, Tim X <t...@nospam.dev.null> wrote:
> Daniel <hanm...@gmail.com> writes:
> > Hi all,
>
> > 1. Create a file with permission of 444 (read-only) file.
> > 2. Open the file using emacs.
>
> > Question.
>
> > My emacs open the read-only file as writable buffer. Also, I can
> > modify it and save it. (AMAZING, emacs IGNORES unix file system. WOW.)
>
> > What happened to the emacs, and how it works properly (open files as
> > read-only if it is read-only, and as writable if it is writable.)
>
> > Thank you,
>
> > Dan.
>
> doing the same thing with emacs 22 gives me a read only file. any attempt to
> modify the file gives me a buffer is read only message.
>
> Your not running as root are you?
>
> Tim
>
> --
> tcross (at) rapttech dot com dot au

I am running it as root, but the permission is read-only to root also.
Is there any problem?

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

* Re: EMacs & X-windows
  2007-04-20  1:02           ` EMacs & X-windows "Wilfred Zegwaard (privé)"
@ 2007-04-20  9:03             ` Peter Dyballa
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Dyballa @ 2007-04-20  9:03 UTC (permalink / raw)
  To: Wilfred Zegwaard (privé); +Cc: help-gnu-emacs


Am 20.04.2007 um 03:02 schrieb Wilfred Zegwaard (privé):

> I've got a framed environment

What do you mean with that? A window without decoration?

And, please, could you start a new thread instead of hi-jacking an  
existing one?

--
Greetings

   Pete                                           0
                                            %-/\_//
                                             (*)(*)

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

* Re: Why emacs touches read-only file?
  2007-04-20  7:00   ` Daniel
@ 2007-04-20 14:51     ` Daniel
  2007-04-21  3:48     ` Tim X
  2007-04-21 12:46     ` Johan Bockgård
  2 siblings, 0 replies; 18+ messages in thread
From: Daniel @ 2007-04-20 14:51 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 20, 12:00 am, Daniel <hanm...@gmail.com> wrote:
> On Apr 19, 7:28 pm, Tim X <t...@nospam.dev.null> wrote:
>
>
>
> >Daniel<hanm...@gmail.com> writes:
> > > Hi all,
>
> > > 1. Create a file with permission of 444 (read-only) file.
> > > 2. Open the file using emacs.
>
> > > Question.
>
> > > My emacs open the read-only file as writable buffer. Also, I can
> > > modify it and save it. (AMAZING, emacs IGNORES unix file system. WOW.)
>
> > > What happened to the emacs, and how it works properly (open files as
> > > read-only if it is read-only, and as writable if it is writable.)
>
> > > Thank you,
>
> > > Dan.
>
> > doing the same thing with emacs 22 gives me a read only file. any attempt to
> > modify the file gives me a buffer is read only message.
>
> > Your not running as root are you?
>
> > Tim
>
> > --
> > tcross (at) rapttech dot com dot au
>
> I am running it as root, but the permission is read-only to root also.
> Is there any problem?

I am running it as root, but the permission is read-only to root also.

Is there any problem?

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

* Re: Why emacs touches read-only file?
  2007-04-20  7:00   ` Daniel
  2007-04-20 14:51     ` Daniel
@ 2007-04-21  3:48     ` Tim X
  2007-04-21 12:46     ` Johan Bockgård
  2 siblings, 0 replies; 18+ messages in thread
From: Tim X @ 2007-04-21  3:48 UTC (permalink / raw)
  To: help-gnu-emacs

Daniel <hanmoai@gmail.com> writes:

> On Apr 19, 7:28 pm, Tim X <t...@nospam.dev.null> wrote:
>> Daniel <hanm...@gmail.com> writes:
>> > Hi all,
>>
>> > 1. Create a file with permission of 444 (read-only) file.
>> > 2. Open the file using emacs.
>>
>> > Question.
>>
>> > My emacs open the read-only file as writable buffer. Also, I can
>> > modify it and save it. (AMAZING, emacs IGNORES unix file system. WOW.)
>>
>> > What happened to the emacs, and how it works properly (open files as
>> > read-only if it is read-only, and as writable if it is writable.)
>>
>> > Thank you,
>>
>> > Dan.
>>
>> doing the same thing with emacs 22 gives me a read only file. any attempt to
>> modify the file gives me a buffer is read only message.
>>
>> Your not running as root are you?
>>
>> Tim
>>
>> --
>> tcross (at) rapttech dot com dot au
>
> I am running it as root, but the permission is read-only to root also.
> Is there any problem?
>

Well, there shouldn't be. Some programs will allow root to edit read only files
and will only give a warning. However, I just tried it with emacs 22 and it
won't let me edit it unless I specifically ask it to. So, its probably not an
issue. Still, running as root is generally considered a bad thing as it is way
too easy to accidently change things. It can also undermine the protection
Unix/GNU Linux users generally have against viruses, trojans etc. Many people
are under the mistaken belief that you cannot get such things under Unix/GNU
Linux. However, this is not true. If your running as root it is possible for
your system to be compromised by most of the same techniques used on Windows,
such as malicious e-mail attachments or web sites that attempt to take
advantage of security weaknesses in browsers/browser plugins etc. . Of course,
because most people don't run as root and as there are considerably more
variables involved, there are few examples of attacks setup like this - most
Unix/Gnu Linux attacks concentrate on more network type weaknesses. Still,
running as root pretty much compromises the security model that the system is
based on.

There has been a number of users who have posted that they cannot reproduce the
behavior you are seeing. This would indicate it is something specific to your
setup. Possibly in your .emacs or emacs site file, possibly related to the fact
your accessing via VNC and the way it is configured. Have you tried doing the
same with other programs, such as vi? Have you tried doing the same in
different directories/partitions? Have you tried doing the same, but when not
running as root? 

Tim

-- 
tcross (at) rapttech dot com dot au

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

* Re: Why emacs touches read-only file?
  2007-04-20  7:00   ` Daniel
  2007-04-20 14:51     ` Daniel
  2007-04-21  3:48     ` Tim X
@ 2007-04-21 12:46     ` Johan Bockgård
  2 siblings, 0 replies; 18+ messages in thread
From: Johan Bockgård @ 2007-04-21 12:46 UTC (permalink / raw)
  To: help-gnu-emacs

Daniel <hanmoai@gmail.com> writes:

> I am running it as root,

That's why.

> but the permission is read-only to root also.

The behavior was changed in Emacs 22. From etc/NEWS:

    *** When you are root, and you visit a file whose modes specify
    read-only, the Emacs buffer is now read-only too. Type C-x C-q if
    you want to make the buffer writable. (As root, you can in fact
    alter the file.)

And the corresponding antinews[1] entry:

   * When you are logged in as root, all files now give you writable
     buffers, reflecting the fact that you can write any files.


[1] "For those users who live backwards in time, here is information
  about downgrading to Emacs version 21.4."
  (info "(emacs)Antinews")

-- 
Johan Bockgård

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

end of thread, other threads:[~2007-04-21 12:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18 18:20 Why emacs touches read-only file? Daniel
2007-04-18 18:49 ` Eric Hanchrow
2007-04-18 19:22 ` Glenn Morris
2007-04-19  3:00   ` Matthew Flaschen
2007-04-19  4:43   ` Daniel
2007-04-19  7:51     ` Glenn Morris
2007-04-19 18:09       ` Daniel
2007-04-19 19:07         ` Peter Dyballa
     [not found]         ` <mailman.2277.1177009971.7795.help-gnu-emacs@gnu.org>
2007-04-19 21:28           ` Daniel
2007-04-20  1:02           ` EMacs & X-windows "Wilfred Zegwaard (privé)"
2007-04-20  9:03             ` Peter Dyballa
2007-04-19 10:07     ` Why emacs touches read-only file? Arne Schmitz
2007-04-19 18:10       ` Daniel
2007-04-20  2:28 ` Tim X
2007-04-20  7:00   ` Daniel
2007-04-20 14:51     ` Daniel
2007-04-21  3:48     ` Tim X
2007-04-21 12:46     ` Johan Bockgård

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