delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/12/31/13:26:44

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Fri, 31 Dec 2004 20:24:42 +0200
From: "Eli Zaretskii" <eliz AT gnu DOT org>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-ID: <01c4ef66$Blat.v2.2.2$24b104a0@zahav.net.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 2.2.2
In-reply-to: <020501c4ef4d$f9b363a0$0600000a@broadpark.no> (message from Gisle
Vanem on Fri, 31 Dec 2004 16:32:45 +0100)
Subject: Re: _djstat_flags
References: <020501c4ef4d$f9b363a0$0600000a AT broadpark DOT no>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019