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)) - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html