bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk - 'inplace' feature ignores file's access flags (rea


From: Johannes Meixner
Subject: Re: [bug-gawk] gawk - 'inplace' feature ignores file's access flags (read-only)
Date: Wed, 10 Jun 2015 16:28:16 +0200 (CEST)
User-agent: Alpine 2.00 (LNX 1167 2008-08-23)


Hello,

On Jun 10 08:35 Andrew J. Schorr wrote (excerpt):
On Wed, Jun 10, 2015 at 01:08:43PM +0200, Janis Papanagnou wrote:
The 'inplace' feature ignores access flags of files; if the
file is write protected it will nonetheless be overwritten.

Are you sure this is a bug?  It appears that sed behaves the same way:

Off the top of my head without looking at the source code
I think 'inplace' features actually create the file anew
i.e. the tools do not work on the existing file but remove
(perhaps first move and finally remove) the existing file
and write the output to a new file with same name.

Regardless how it is actually implemented, I think
it is a valid question what one could normaly expect
from an 'inplace' feature when on the one hand the user
has run a tool to replace the file's content but on the
other hand the file permissions are contradicting.

Let's see what plain bash does as normal user

$ echo hello >hello
$ chmod a-w hello
$ ls -l hello
-r--r--r-- 1 jsmeix suse 6 Jun 10 16:07 hello
$ echo hello2 >hello
bash: hello: Permission denied

and what plain bash does as root

# echo hello >hello
# chmod a-w hello
# ls -l hello
-r--r--r-- 1 root root 6 Jun 10 16:08 hello
# echo hello2 >hello
# cat hello
hello2

and what plain bash can do as normal user who is owner

$ echo hello >hello
$ chmod a-rwx hello
$ ls -l hello
---------- 1 jsmeix suse 6 Jun 10 16:09 hello
$ rm -f hello
$ echo hello2 >hello
$ cat hello
hello2

This seems to indicate tools should check file permissions
but only when running as normal user who is not owner?
;-)

A valid question but complicated to be answered...


Kind Regards
Johannes Meixner
--
SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard,
Dilip Upmanyu, Graham Norton - HRB 21284 (AG Nuernberg)




reply via email to

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