>
>
> : lstat, stat, and truncate can use either an EXPR or FILEHANDLE. Is there any
> : reason that chmod and chown can't be modified to work with FILEHANDLEs?
>
> just a nit here: lstat _can't_ possibly work on a file handle. if you
> have a file open, there aren't any symlinks to worry about... :-)
'lstat FILEHANDLE' is just like 'stat FILEHANDLE'. In fact lstat just calls
stat. stat then calls the system lstat only if a filename (or reference to
a filename) was passed as the argument.
> Historically, a lot of systems didn't have fchmod or fchown. Perhaps
> that's less of an issue nowadays. On the other hand, chown and chmod
> are list operators in Perl, and there's little precedent for allowing
> filehandles in a list. There would be much potential for bareword
> confusion. On the gripping hand, POSIX doesn't supply the functions,
> so the desired functionality is simply missing from Perl at the moment.
>
> It may be that this is something that should go in POSIXish. Or UNIXish,
> or FileHandle, or something.
>
> i'm not sure sure .. having _some_ of the file operators work on
> file handles and some of them not is a bit confusing... and, while
> we say that perl is good for writing `secure' programs, not having
> fchmod or fchown (or setgroups(), grr) makes it a lot harder to
> write these secure programs ... kinda like the way that we don't
> have a simple way to open a file with O_EXCL|O_CREAT .. not good
> for secure programs.
>
> of course, this doesn't stop them being in FileHandle (my choice).
I agree that fchown and fchmod (any others?) need to be in either the perl
core or an extension. Currently I use syscall to do fchown/fchmod. IMHO,
syscall should be removed and replaced with extensions.
> speaking of setgroups(), it's currently impossible in perl to remove
> groups from a program. if i'm writing a daemon that binds to a priv.
> port and then gives up all other priviledges, the groups are parts of
> what is to be given up, but, there's nothing to do it in perl. i
> have to resort to a C wrapper. perhaps setgroups() belongs in POSIXish
> or maybe UNIXish... the posix standard doesn't define what setgroups()
> is... it's an implimentation defined operation.
Can't you use syscall to call setgroups?
--
Richard J. Ohnemus (Richard_Ohnemus@sterling.com) (214) 868-5411
Sterling Software CSD
5215 North O'Connor Boulevard, Suite 1500
Irving, Texas 75039-3771