git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: Solaris cloning woes partly diagnosed
Date: Sun, 2 Apr 2006 12:18:29 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0604021159110.3050@g5.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0604021118210.3050@g5.osdl.org>



On Sun, 2 Apr 2006, Linus Torvalds wrote:
> 
> Suddenly, some system calls will either return -1/EINTR, or they'll return 
> partial reads or writes. 

Hmm. If I read the IRC logs right, the bad pack is still a _valid_ pack, 
and passes git-verify-pack with flying colors.

That certainly implies that we had no problems with write-out: not only 
must the SHA1 of the resulting file match itself, but it must match the 
index too, and the number of objects there must match the index.

So the only way I see the pack being bad (if it does indeed pass 
git-verify-pack) is if the object list we generated was bad.

However, "-q" only affects git-pack-file itself, not the generation of the 
list. Which would imply that we have trouble _reading_ the list as it 
comes in through a pipe. Which is just insane, because we use just a 
bog-standard "fgets(... stdin)" for that. And no _way_ can stdio have 
problems with a few SIGALRM's, that would break a lot of other problems.

But Oeje1 seems to be saying (in http://pastebin.com/635566):

	git rev-list --objects --all | git pack-objects pack
	Generating pack...
	Done counting 15 objects.
	Deltifying 15 objects.
	 100% (15/15) done
	Writing 15 objects.
	 100% (15/15) done
	806439fdfa5e9990b03f9301bd68e243795fff50

where the result _should_ be 16385 objects, not 15.

And the thing is, the _only_ thing we do there is that

	while (fgets(line, sizeof(line), stdin) != NULL) {
		...
		add_object_entry(sha1, name_hash(NULL, line+41), 0);

so it really really looks like fgets() would have problems with a SIGALRM 
coming in and doesn't just re-try on EINTR. Can Solaris stdio _really_ be 
that broken? (Yeah, yeah, it may be "conforming". It's also so incredibly 
programmer-unfriendly that it's not even funny)

That would be truly insane. Can somebody with Solaris check what the 
following patch results in...

		Linus

----
diff --git a/pack-objects.c b/pack-objects.c
index ccfaa5f..daba5de 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1099,8 +1099,18 @@ int main(int argc, char **argv)
 		fprintf(stderr, "Generating pack...\n");
 	}
 
-	while (fgets(line, sizeof(line), stdin) != NULL) {
+	for (;;) {
 		unsigned char sha1[20];
+
+		if (!fgets(line, sizeof(line), stdin)) {
+			if (feof(stdin))
+				break;
+			if (!ferror(stdin))
+				die("fgets returned NULL, not EOF, not error!");
+			if (errno == EINTR)
+				continue;
+			die("fgets: %s", strerror(errno));
+		}
 
 		if (line[0] == '-') {
 			if (get_sha1_hex(line+1, sha1))

  parent reply	other threads:[~2006-04-02 19:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02 10:41 Solaris cloning woes partly diagnosed Junio C Hamano
2006-04-02 18:33 ` Linus Torvalds
2006-04-02 19:10   ` Jason Riedy
2006-04-02 19:22     ` Linus Torvalds
2006-04-02 19:18   ` Linus Torvalds [this message]
2006-04-02 19:52     ` Jason Riedy
2006-04-02 20:28       ` Linus Torvalds
2006-04-02 20:31         ` [PATCH 2/2] pack-objects: be incredibly anal about stdio semantics Linus Torvalds
2006-04-02 21:09           ` Junio C Hamano
2006-04-02 21:21             ` Linus Torvalds
2006-04-02 22:12               ` Jason Riedy
2006-04-02 22:58                 ` Linus Torvalds
2006-04-02 22:29         ` [PATCH] Use sigaction and SA_RESTART in read-tree.c; add option in Makefile Jason Riedy
2006-04-03  1:02           ` Linus Torvalds
2006-04-03  4:20           ` Junio C Hamano
2006-04-03  4:40             ` Linus Torvalds
2006-04-03  3:06     ` Solaris cloning woes partly diagnosed Linus Torvalds
2006-04-04 18:21   ` H. Peter Anvin
2006-04-04  8:47 ` [RFH] Solaris cloning woes Junio C Hamano
2006-04-04 18:53   ` Jason Riedy

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=Pine.LNX.4.64.0604021159110.3050@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).