Mail Archives: djgpp/2004/12/31/13:26:44
> Date: Fri, 31 Dec 2004 16:32:45 +0100
> From: Gisle Vanem <giva AT bgnett DOT no>
>
> Since most program use f?stat() as-is
That is a wrong assumption: at least the ported programs in v2gnu
carefully set _djstat_flags as appropriate in every specific
situation. For example, the ported `ls' has several different
settings for _djstat_flags, as required by the different command-line
options.
> I which there was a environment variable that would do the same as
> above.
Bad idea, IMHO: some programs will become dysfunctional if you set
such an environment variable to a value suitable for one program and
then forget to change it for another program. E.g., `ls' might fail
to report the executable bit for shell scripts. Even worse, some
programs could begin to mysteriously fail for no apparent reason. For
example, `find' needs _STAT_DIRSIZE to be cleared, because it relies
on seeing the correct link count for a directory when it recurses into
its subdirectories. If you set that bit, `find' might fail to recurse
into subdirectories -- a terrible and hard-to-figure-out bug.
Now imagine a command that runs a pipe which involves both `ls' and
`find' -- how can you define a value that is good for both of them?
You can't.
The solution is for the programs that are heavy users of `stat' to
make a point of setting _djstat_flags to the value they need.
> BTW, it's a bit clumsy to have the logic backwards. I.e.
> (_djstat_flags & _STAT_INODE) *should* get the inode number.
The reason for that was to have the default value of _djstat_flags be
zero, which should make linking and/or startup a bit faster.
- Raw text -