git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Use dev_t for device id (st_dev) from stat in setup_git_directory_gently()

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 13, 2010, 20:55 UTC
Message-ID
<7voceb2jaw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1279011720-21424-1-git-send-email-harinath@hurrynot.org>
Raja R Harinath <harinath@hurrynot.org> writes:
Show 16 quoted lines
> 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.
> ---
Makes sense; thanks.
Sign-off?
Show 19 quoted lines
>  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
Previous: Raja R HarinathNext: Raja R Harinath
Message 4 of 6 in “Use dev_t for device id (st_dev) from stat in setup_git_directory_gently()”
  1. Use dev_t for device id (st_dev) from stat in setup_git_directory_gently()Raja R Harinath, Jul 13, 2010
  2. Ævar Arnfjörð BjarmasonJul 13, 2010
  3. Raja R HarinathJul 13, 2010
  4. Junio C HamanoJul 13, 2010
  5. Raja R HarinathJul 14, 2010
  6. Junio C HamanoJul 14, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.