From: Sergey Vlasov <vsu@altlinux•ru>
To: Simon 'corecode' Schubert <corecode@fs•ei.tum.de>
Cc: Bart Trojanowski <bart@jukie•net>, git@vger•kernel.org
Subject: Re: [PATCH] Don't call fstat() on stdin in index-pack.
Date: Sat, 20 Jan 2007 18:35:19 +0300 [thread overview]
Message-ID: <20070120183519.3a182064.vsu@altlinux.ru> (raw)
In-Reply-To: <45B034D2.6010007@fs.ei.tum.de>
[-- Attachment #1: Type: text/plain, Size: 1925 bytes --]
On Fri, 19 Jan 2007 04:02:42 +0100 Simon 'corecode' Schubert wrote:
> Bart Trojanowski wrote:
> > /* If input_fd is a file, we should have reached its end now. */
> > - if (fstat(input_fd, &st))
> > - die("cannot fstat packfile: %s", strerror(errno));
> > - if (S_ISREG(st.st_mode) && st.st_size != consumed_bytes)
> > - die("pack has junk at the end");
> > + if (input_fd) {
> > + if (fstat(input_fd, &st))
> > + die("cannot fstat packfile: %s", strerror(errno));
> > + if (S_ISREG(st.st_mode) && st.st_size != consumed_bytes)
> > + die("pack has junk at the end");
> > + }
>
> This is clearly the wrong fix. input_fd being 0 doesn't mean that
> it is *not* a regular file. Only doing a fstat can tell. You are
> simply hiding your real issue there, which is that you can't fstat
> on a pipe or whatever input_fd is.
>
> The problem here is that your 64bit kernel can't fit the data into
> your struct stat provided by your 32bit libc. Not a problem of git.
> However, it would be interesting to know what exactly produces the
> EOVERFLOW.
Most likely it is the st_ino field - the kernel assigns unique inode
numbers for pipes from an "unsigned long" counter, which is 64-bit in
this case, and *stat() calls must fail with EOVERFLOW if the inode
number does not fit into ino_t, which is 32-bit here. This problem is
known for some time, and there is even a kernel patch proposed as a
workaround (which makes the counter 32-bit):
http://permalink.gmane.org/gmane.linux.file-systems/12526
AFAIK, that patch is not upstream yet - so upgrading the kernel did
not really fix the issue, it will appear again once the system will
use more than 4G of pipe inodes.
Compiling git with -D_FILE_OFFSET_BITS=64 will make ino_t 64-bit and
therefore will fix the problem (however, I'm not sure whether the git
code is ready for this).
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-01-20 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-18 21:26 git push problem with v1.5.0-rc1 Bart Trojanowski
2007-01-19 2:44 ` [PATCH] Don't call fstat() on stdin in index-pack Bart Trojanowski
2007-01-19 3:02 ` Simon 'corecode' Schubert
2007-01-20 15:35 ` Sergey Vlasov [this message]
2007-01-20 18:00 ` Simon 'corecode' Schubert
2007-01-19 3:16 ` git push problem with v1.5.0-rc1 Bart Trojanowski
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=20070120183519.3a182064.vsu@altlinux.ru \
--to=vsu@altlinux$(echo .)ru \
--cc=bart@jukie$(echo .)net \
--cc=corecode@fs$(echo .)ei.tum.de \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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