Xref: utzoo gnu.emacs.help:1789 comp.emacs:10568 Newsgroups: gnu.emacs.help,comp.emacs Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Subject: Re: Saving a file in emacs without the right permission bits Message-ID: <1991Apr19.052504.2074@Think.COM> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA References: <1991Apr18.220342.25107@sj.ate.slb.com> Distribution: usa Date: Fri, 19 Apr 91 05:25:04 GMT In article <1991Apr18.220342.25107@sj.ate.slb.com> konath@sj.ate.slb.com (Kannan Konath) writes: > I alter the file and when I try saving it, emacs responds by >asking me whether I really want to save the file, to which I reply >yes. It saves the file and changes the ownership of the file to >the new user. >Isn't it illegal for another user to be able to overwrite a file over >which he does not have "w" status? Yes -- that's why it asks permission first :-) Actually, it's not overwriting the file, and it's not changing its ownership. GNU Emacs renames the old file to filename~ or filename.~~, and then creates a *new* file with the old file's name. Since you created the new file, you are its owner. The only access you need to do this is write access to the directory; the access on the file itself doesn't matter, because you aren't actually modifying the file, just the directory entry that refers to it. To verify this, use "ls -i" before and after saving the file, and notice that it has a different inode number. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar