On Monday, April 29, 2002, at 10:13 , sharan wrote:
[..]
first off note that chmod 400 did not take you where you expected.
> sharan@SHARAN ~
> $ ll foo
> -r--r--r-- 1 sharan None 4 Apr 30 10:39 foo
ls -l foo
-rw-r--r-- 1 drieux wheel 4 Apr 30 09:54 foo
[jeeves:/tmp/drieux] drieux% chmod 400 !$
chmod 400 foo
[jeeves:/tmp/drieux] drieux% !l
ls -l foo
-r-------- 1 drieux wheel 4 Apr 30 09:54 foo
[jeeves:/tmp/drieux] drieux%
>
> sharan@SHARAN ~
> $ perl -pi -e 's/o/e/' foo
> Can't do inplace edit on foo: Permission denied.
so while your version of a filesystem is near to a
traditional model.... it seems to be 'off a peg'.
>
> sharan@SHARAN ~
> $ cat foo
> cat: foo: No such file or directory
the short skid is that the 'pie' trick is writing to a
tmp file 'unspecified' here - and then moving that file back.
the alternative is to specify a tmp file extension...
gax: 61:] perl -pi'.bob' -e 's/o/e/' foo
gax: 62:] ls -ltr
total 12
-rw-r--r-- 1 drieux house 28 Apr 28 08:08 file
-r-------- 1 drieux house 4 Apr 30 08:57 foo.bob
-r-------- 1 drieux house 4 Apr 30 08:58 foo
gax: 63:] diff foo foo.bob
1c1
< fee
---
> feo
gax: 64:]
perldoc perlrun - and you will notice that there is the
interesting bit about
For a discussion of issues surrounding file permis-
sions and -i, see the Why does Perl let me delete
read-only files? Why does -i clobber protected files?
Isn't this a bug in Perl? entry in the perlfaq5 man-
page.
which would be found with
perldoc perlfaq5
or with
perldoc -q "-i"
or skip straight ahead to
This is elaborately and painstakingly described in the
"Far More Than You Ever Wanted To Know" in
http://www.perl.com/CPAN/doc/FMTEYEWTK/file-dir-perms .
which will take you off on a wild adventure.
or:
The executive summary: learn how your filesystem works.
The permissions on a file say what can happen to the data
in that file. The permissions on a directory say what can
happen to the list of files in that directory. If you
delete a file, you're removing its name from the directory
(so the operation depends on the permissions of the direc-
tory, not of the file). If you try to write to the file,
the permissions of the file govern whether you're allowed
to.
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]