[racket] Unix file permissions/owner/group

18 views
Skip to first unread message

Neil Van Dyke

unread,
Aug 30, 2010, 4:50:16 AM8/30/10
to Racket Users List
Has anyone already implemented Racket API for dealing with Unix file
permissions/owner/group?

Some things I have needed sometimes:

* Procedure(s) to set a named file's permissions, owner, and/or group.

* Procedure to get the permissions, owner, and group of a named file.

Also handy would be:

* The standard "open-output-file", "call-with-output-file", etc., have
keyword argument to specify the desired permissions when/if creating the
file. (Unfortunately, this can't be implemented as well in a PLaneT
package as it can in the Racket core.)

The permissions bits could be represented in the API as a number, on
which users do bitwise arithmetic.

For API representation of the owner and group, I'm not sure whether
numbers, strings, or ADTs should be preferred. For casual applications
programming, I usually want strings; for systems programming, I usually
want the actual UID and GID. Maybe when setting, we can provide a
number or string, and when getting we receive a number (with separate
procedures available to map the numbers to the strings).

I would be willing to implement this, but I don't want to be redundant
with anything anyone else has done or is planning.

--
http://www.neilvandyke.org/
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users

Noel Welsh

unread,
Aug 30, 2010, 4:17:55 PM8/30/10
to Neil Van Dyke, Racket Users List
The closest thing I know of is synx's stat package, which wraps the
stat system call. It doesn't, however, provide the information you
want.

HTH,
N.

On Mon, Aug 30, 2010 at 9:50 AM, Neil Van Dyke <ne...@neilvandyke.org> wrote:
> Has anyone already implemented Racket API for dealing with Unix file
> permissions/owner/group?

...

synx

unread,
Sep 2, 2010, 7:25:58 PM9/2/10
to Racket
On 08/30/2010 01:50 AM, Neil Van Dyke wrote:
> Has anyone already implemented Racket API for dealing with Unix file
> permissions/owner/group?

> * Procedure(s) to set a named file's permissions, owner, and/or group.


>
> * Procedure to get the permissions, owner, and group of a named file.

Sure, I did that. I'll attach a quick demonstration.

statpermstuff.rkt
signature.asc
Reply all
Reply to author
Forward
0 new messages