From: Jeff King <peff@peff.net>
To: Fredrik Gustafsson <iveqy@iveqy.com>
Cc: spearce@spearce.org, git@vger.kernel.org, pclouds@gmail.com
Subject: Re: [RFC] Add posibility to preload stat information.
Date: Wed, 20 Mar 2013 12:48:06 -0400 [thread overview]
Message-ID: <20130320164806.GA10752@sigill.intra.peff.net> (raw)
In-Reply-To: <1363781732-11396-1-git-send-email-iveqy@iveqy.com>
On Wed, Mar 20, 2013 at 01:15:32PM +0100, Fredrik Gustafsson wrote:
> When entering a git working dir, optionally run a forked process that
> stat all files in the whole workdir and therefore loads stat information
> to RAM which will speedup things like git status and so on.
>
> The feature is optional and by default it's off.
Kind of gross, but I guess it is useful to some people.
> +__git_recursive_stat ()
> +{
> + if test ! -e /tmp/gitbash.lock
> + then
> + touch /tmp/gitbash.lock
This is a tmp-race security hole. E.g., do:
ln -s /etc/nologin /tmp/gitbash.lock
as a user; when root runs __git_recursive_stat, it will create
/etc/nologin. It's not quite as bad as some other holes, because we only
"touch" the file, not overwrite its contents, but you can see that it's
possible to do some mischief.
Should this maybe just be ~/.gitbash.lock or something?
> + cd $(git rev-parse --show-toplevel)
> + find . | xargs stat 2&> /dev/null
The "stat" utility is not portable. But why not use git to do the
reading? Then you can get the benefit of core.preloadindex, and you will
not recurse into untracked directories that are ignored (i.e.,
ones that git would not go into anyway).
So maybe just run "git status >/dev/null"?
-Peff
next prev parent reply other threads:[~2013-03-20 16:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-20 12:15 [RFC] Add posibility to preload stat information Fredrik Gustafsson
2013-03-20 16:48 ` Jeff King [this message]
2013-03-20 17:15 ` Junio C Hamano
2013-03-20 17:47 ` Jeff King
2013-03-21 10:41 ` Thomas Rast
2013-03-21 14:44 ` Junio C Hamano
2013-03-30 19:42 ` Phil Hord
2013-03-20 18:40 ` Fredrik Gustafsson
2013-03-20 17:15 ` Ramkumar Ramachandra
2013-03-20 17:41 ` Fredrik Gustafsson
2013-03-20 17:49 ` Ramkumar Ramachandra
2013-03-20 18:36 ` Fredrik Gustafsson
2013-03-20 18:46 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130320164806.GA10752@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=iveqy@iveqy.com \
--cc=pclouds@gmail.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).