Author larry
Recipients Mark.Shannon, do1, larry, ned.deily, vstinner
Date 2012-07-14.00:15:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342224951.75.0.494917785196.issue15301@psf.upfronthosting.co.za>
In-reply-to
Content
I don't think "k" is the right answer.

POSIX defines the user and group parameters as uid_t and gid_t respectively; in turn, uid_t and gid_t are defined as "integers", pointedly omitting the either of the words "signed" or "unsigned".  So POSIX makes no guarantee that uid_t and gid_t are unsigned.

On the other hand: chown takes special values defined as "(uid_t)-1" and "(gid_t)-1" to indicate "don't change this value".  If we change chown to use "k" for uid and gid, then in order to use this value you'd have to pass in the equivalent unsigned value.  And that'd require you to know the size of an int on the local platform.  Yuck!

If this is a genuine problem, then I think we have to take "O" (or "O!") and convert the long by hand.  If it's -1, use "(uid_t)-1" (etc), otherwise convert as unsigned.  On the other hand, if this is only a theoretical problem then I'd prefer to wontfix and keep the code simple.

p.s. find uid_t / gid_t here: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html
chown here:
http://pubs.opengroup.org/onlinepubs/009695399/functions/chown.html
History
Date User Action Args
2012-07-14 00:15:52larrysetrecipients: + larry, vstinner, ned.deily, Mark.Shannon, do1
2012-07-14 00:15:51larrysetmessageid: <1342224951.75.0.494917785196.issue15301@psf.upfronthosting.co.za>
2012-07-14 00:15:51larrylinkissue15301 messages
2012-07-14 00:15:47larrycreate