[Dev-luatex] file permissions
Hans Hagen
pragma at wxs.nl
Sun Feb 6 23:33:37 CET 2011
On 6-2-2011 3:56, Reinhard Kotucha wrote:
> $ whoami
> reinhard
> $ ls -l /etc/passwd
> -rw-r--r-- 1 root root 2269 Dec 19 14:57 /etc/passwd
>
> Your test suggests that the file is writable, but this is only true
> for root, not for the user who is running the script. You actually
> have to determine whether you are the owner of the file, or, if the
> file is group writable, whether you are member of this group, or
> whether the file is writable by everybody.
Isn't it a bug in the lfs library then? When is the point in returning
an attribute that has no defined meaning?
> Regarding Windows, I'm not sure. As far as I can see from the Lua
> sources, permission flags are directly derived from a stat() call.
> This means that they are related to the file owner too, not to the
> current user.
I suppose that we're only interested in the current user, so
lfs.attributes should return the user's attributes. I was always under
the impression that this was the case.
> If there is a file which is owned by the admin and is _not_ writable
> by normal users, does your test really return 'false' if run by a
> non-privileged user on Windows?
I don't know. Whatever we end up with it should be robust or at least
predictable.
(i normally have only one account on computers and run everything as
administrator or root)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the dev-luatex
mailing list