chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Make setting of the file modification time


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Make setting of the file modification time saner
Date: Sun, 14 May 2017 12:37:43 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, May 10, 2017 at 10:51:52PM +0200, Peter Bex wrote:
> Hi all,
> 
> While working on the docs for (chicken file posix), I noticed some
> discrepancies:
> 
> - file-access-time and file-change-time have no associated setter,
>    but file-modification-time does.
> - The setter for file-modification-time sets both mtime AND atime,
>    even though (set! (file-modification-time f) x) implies that
>    we're setting ONLY the mtime.
> - The getters all accept strings, ports and file descriptors; the
>    setter only accepts a string.

A similar thing applies to change-file-owner and change-file-mode:

- The "setters" change-file-owner and change-file-mode are in
   (chicken file), whereas the "getters" file-owner and
   file-permissions are in (chicken file posix)
- The getters and setters aren't named similarly: it makes more
   sense for change-file-mode to be named set-file-permissions!
   and for change-file-owner to be named set-file-owner!
- The "file-permissions" getter returns the raw _st_mode value,
   which also includes the file type.  It's better to mask out
   the file type, so that it's symmetric with the values accepted
   by the setter.
- The setter for file ownership sets both the uid AND the gid.
   If we want to make this consistent with the getter, it makes
   more sense to set only the uid.
- While we can set the gid, we can't get it; "file-group" is missing.
- The getters all accept strings, ports and file descriptors; the
   setter only accepts a string.

The attached patches make all of this more consistent.

Cheers,
Peter

Attachment: 0001-Move-common-change-file-mode-and-file-access-code-to.patch
Description: Text Data

Attachment: 0002-Rename-change-file-mode-to-set-file-permissions-for-.patch
Description: Text Data

Attachment: 0003-Split-change-file-owner-into-set-file-owner-group-ad.patch
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

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