Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Re: [PATCH] Use access instead of stat in hashdir



Hi,


* On Mon, Feb 06, 2012 at 08:20:08AM -0800, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
Thanks for the suggestion, but ...

On Feb 6,  6:43pm, Raghavendra D Prabhu wrote:
}
} I found that using access instead of two stat calls

There's only one stat() call in the lines that you changed ...?
Sorry, I meant the other checks.

} results in
} faster rehash when it is done. I came across this when I noticed
} too many stat calls while 'strace -c'

It also results in treating non-regular files as candidates for being
in the hash table, unless there's something about access() that is
implicitly performing the S_ISREG() test.

Need to verify this but for X_OK the file will need to be regular right ?

So you've broken the correctness of the HASH_EXECUTABLES_ONLY option.
Why not just leave it unset instead?  That's why it's an option.

}              if (unset(HASHEXECUTABLESONLY) ||
} -                   (stat(pathbuf, &statbuf) == 0 &&
} -                    S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)))
} +                   !access(pathbuf,X_OK))
}                  add = 1;
}          }

Yes, I recently merged the tree with mine which I was using before HASHEXECUTABLESONLY was there, need to check on that.



Regards,
--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net

Attachment: pgpnIiBKNBq4O.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author