git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raja R Harinath <harinath@hurrynot.org>
To: git@vger.kernel.org
Cc: Raja R Harinath <harinath@hurrynot.org>
Subject: [PATCH] Use dev_t for device id (st_dev) from stat in setup_git_directory_gently()
Date: Tue, 13 Jul 2010 14:32:00 +0530	[thread overview]
Message-ID: <1279011720-21424-1-git-send-email-harinath@hurrynot.org> (raw)

The original declaration was int, which seems to cause trouble on my
machine.  It causes spurious "filesystem boundary" errors when running
the testsuite.  The cause seems to be

  $ stat -c%d .
  2147549952

which is too large for a 32-bit int type.

Using the correct type, dev_t, solves the issue.  (Because I'm
paranoid and forgetful, I checked -- yes, Unix v7 had dev_t.)

Other uses of st_dev seem to be reasonably safe.   fill_stat_cache_info
truncates it to an 'unsigned int', but that value seems to be used only
to validate the cache, and only if USE_STDEV is defined.
---
 setup.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/setup.c b/setup.c
index 7e04602..87c21f0 100644
--- a/setup.c
+++ b/setup.c
@@ -323,7 +323,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
 	const char *gitdirenv;
 	const char *gitfile_dir;
 	int len, offset, ceil_offset, root_len;
-	int current_device = 0, one_filesystem = 1;
+	dev_t current_device = 0;
+	int one_filesystem = 1;
 	struct stat buf;
 
 	/*
-- 
1.7.2.rc2.11.g03e33

             reply	other threads:[~2010-07-13  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13  9:02 Raja R Harinath [this message]
2010-07-13  9:26 ` [PATCH] Use dev_t for device id (st_dev) from stat in setup_git_directory_gently() Ævar Arnfjörð Bjarmason
2010-07-13 12:01   ` Raja R Harinath
2010-07-13 20:55 ` Junio C Hamano
2010-07-14  1:08   ` Raja R Harinath
2010-07-14 14:55     ` Junio C Hamano

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=1279011720-21424-1-git-send-email-harinath@hurrynot.org \
    --to=harinath@hurrynot.org \
    --cc=git@vger.kernel.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).