{"thread":{"id":"7006","subject":"Error \"fatal: cannot pread pack file: Success\"","startedAt":"2007-02-28T03:45:48Z","lastAt":"2007-03-01T15:23:47Z","messageCount":34,"participants":["Bill Lear","Shawn O. Pearce","Junio C Hamano","Linus Torvalds","Morten Welinder","Nicolas Pitre"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"35765","messageId":"17892.64236.443170.43061@lisa.zopyra.com","threadId":"7006","inReplyTo":null,"subject":"Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T03:45:48Z","receivedAt":"2007-02-28T03:45:48Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"Using 1.5.0.1.  Can't see what is wrong with this clone...\n\n% df -h .\nFilesystem            Size  Used Avail Use% Mounted on\nstore:/storage/disk1\n                      682G  113G  535G  18% /austin\n\n% git clone --bare ~/devel/project\nInitialized empty Git repository in /austin/users/rael/repos/git/project/\nremote: Generating pack...\nremote: Done counting 4589 objects.\nremote: Deltifying 4589 objects.\n 100% (4589/4589) done89) done\nIndexing 4589 objects.\nremote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n 100% (4589/4589) done\nResolving 2209 deltas.\nfatal: cannot pread pack file: Success\nfatal: index-pack died with error code 128\nfetch-pack from '/home/rael/devel/project/.git' failed.\n\n% mkdir project\n% touch project/foo\n% ls -l project/foo\n-rw-r--r--  1 rael software 0 Feb 27 21:44 project/foo\n% rm -rf project\n\n% cd ~/devel\n% df -h .\nFilesystem            Size  Used Avail Use% Mounted on\n/dev/sda5             186G   82G   95G  47% /home\n% mkdir test\n% cd test\n\n% git clone --bare ~/devel/project\nInitialized empty Git repository in /home/rael/test/project/\nremote: Generating pack...\nremote: Done counting 4589 objects.\nremote: Deltifying 4589 objects.\n  7Indexing 4589 objects. done\n 100% (4589/4589) done89) done4589) done\nremote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n 100% (4589/4589) done\nResolving 2209 deltas.\n 100% (2209/2209) done\n\nThis happens repeatedly.  git fsck of my repo shows no problems.\n\nAnything else I can check?\n\n\nBill\n"},{"id":"35768","messageId":"20070228035713.GC5597@spearce.org","threadId":"7006","inReplyTo":"17892.64236.443170.43061@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T03:57:13Z","receivedAt":"2007-02-28T03:57:13Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> Using 1.5.0.1.  Can't see what is wrong with this clone...\n...\n> Indexing 4589 objects.\n> remote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n>  100% (4589/4589) done\n> Resolving 2209 deltas.\n> fatal: cannot pread pack file: Success\n> fatal: index-pack died with error code 128\n> fetch-pack from '/home/rael/devel/project/.git' failed.\n\nWhat platform is this?  index-pack failed to read using pread(),\nbut the error code in errno was 0 (success)?  Huh?\n\nIt turns out this is steaming from a short read; we asked for some\nlength of bytes but did not get that exact value.  That sounds like\nthe packfile is truncated.\n\nOhh - is this repository on NFS, or some other sort of network\nfilesystem?  Maybe the FS couldn't give us the entire pread request\nin one shot...\n\nI think the pread() in get_data_from_pack of index-pack is wrong,\nit really should be looping until we fill the buffer in case the\nOS doesn't fully satisfy our read request the first time.\n\n-- \nShawn.\n"},{"id":"35774","messageId":"20070228044719.GA6068@spearce.org","threadId":"7006","inReplyTo":"20070228035713.GC5597@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T04:47:19Z","receivedAt":"2007-02-28T04:47:19Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> Bill Lear <rael@zopyra.com> wrote:\n> > Using 1.5.0.1.  Can't see what is wrong with this clone...\n> ...\n> > Indexing 4589 objects.\n> > remote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n> >  100% (4589/4589) done\n> > Resolving 2209 deltas.\n> > fatal: cannot pread pack file: Success\n> > fatal: index-pack died with error code 128\n> > fetch-pack from '/home/rael/devel/project/.git' failed.\n> \n> I think the pread() in get_data_from_pack of index-pack is wrong,\n> it really should be looping until we fill the buffer in case the\n> OS doesn't fully satisfy our read request the first time.\n\nDoes this fix your problem?\n\n-->8--\n[PATCH] index-pack: Loop over pread until data loading is complete.\n\nA filesystem might not be able to completely supply our pread\nrequest in one system call, such as if we are reading data from a\nnetwork file system and the requested length is just simply huge.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n index-pack.c |   10 ++++++++--\n 1 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/index-pack.c b/index-pack.c\nindex 859ec01..cf81a99 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -277,13 +277,19 @@ static void *get_data_from_pack(struct object_entry *obj)\n {\n \tunsigned long from = obj[0].offset + obj[0].hdr_size;\n \tunsigned long len = obj[1].offset - from;\n+\tunsigned long rdy = 0;\n \tunsigned char *src, *data;\n \tz_stream stream;\n \tint st;\n \n \tsrc = xmalloc(len);\n-\tif (pread(pack_fd, src, len, from) != len)\n-\t\tdie(\"cannot pread pack file: %s\", strerror(errno));\n+\tdata = src;\n+\tdo {\n+\t\tssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);\n+\t\tif (n <= 0)\n+\t\t\tdie(\"cannot pread pack file: %s\", strerror(errno));\n+\t\trdy += n;\n+\t} while (rdy < len);\n \tdata = xmalloc(obj->size);\n \tmemset(&stream, 0, sizeof(stream));\n \tstream.next_out = data;\n-- \n1.5.0.2.775.g1a500\n\n-- \nShawn.\n"},{"id":"35778","messageId":"7vbqje3jx9.fsf@assigned-by-dhcp.cox.net","threadId":"7006","inReplyTo":"20070228044719.GA6068@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-28T05:55:46Z","receivedAt":"2007-02-28T05:55:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> \"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n>> Bill Lear <rael@zopyra.com> wrote:\n>> > Using 1.5.0.1.  Can't see what is wrong with this clone...\n>> ...\n>> > Indexing 4589 objects.\n>> > remote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n>> >  100% (4589/4589) done\n>> > Resolving 2209 deltas.\n>> > fatal: cannot pread pack file: Success\n>> > fatal: index-pack died with error code 128\n>> > fetch-pack from '/home/rael/devel/project/.git' failed.\n>> \n>> I think the pread() in get_data_from_pack of index-pack is wrong,\n>> it really should be looping until we fill the buffer in case the\n>> OS doesn't fully satisfy our read request the first time.\n\nThe patch looks correct, even if this was not the problem Bill\nis suffering from.\n\n> [PATCH] index-pack: Loop over pread until data loading is complete.\n>\n> A filesystem might not be able to completely supply our pread\n> request in one system call, such as if we are reading data from a\n> network file system and the requested length is just simply huge.\n>\n> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>\n> ---\n>  index-pack.c |   10 ++++++++--\n>  1 files changed, 8 insertions(+), 2 deletions(-)\n>\n> diff --git a/index-pack.c b/index-pack.c\n> index 859ec01..cf81a99 100644\n> --- a/index-pack.c\n> +++ b/index-pack.c\n> @@ -277,13 +277,19 @@ static void *get_data_from_pack(struct object_entry *obj)\n>  {\n>  \tunsigned long from = obj[0].offset + obj[0].hdr_size;\n>  \tunsigned long len = obj[1].offset - from;\n> +\tunsigned long rdy = 0;\n>  \tunsigned char *src, *data;\n>  \tz_stream stream;\n>  \tint st;\n>  \n>  \tsrc = xmalloc(len);\n> -\tif (pread(pack_fd, src, len, from) != len)\n> -\t\tdie(\"cannot pread pack file: %s\", strerror(errno));\n> +\tdata = src;\n> +\tdo {\n> +\t\tssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);\n> +\t\tif (n <= 0)\n> +\t\t\tdie(\"cannot pread pack file: %s\", strerror(errno));\n> +\t\trdy += n;\n> +\t} while (rdy < len);\n>  \tdata = xmalloc(obj->size);\n>  \tmemset(&stream, 0, sizeof(stream));\n>  \tstream.next_out = data;\n> -- \n> 1.5.0.2.775.g1a500\n>\n> -- \n> Shawn.\n"},{"id":"35818","messageId":"17893.40847.313519.283218@lisa.zopyra.com","threadId":"7006","inReplyTo":"20070228044719.GA6068@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T15:28:15Z","receivedAt":"2007-02-28T15:28:15Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, February 27, 2007 at 23:47:19 (-0500) Shawn O. Pearce writes:\n>\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n>> Bill Lear <rael@zopyra.com> wrote:\n>> > Using 1.5.0.1.  Can't see what is wrong with this clone...\n>> ...\n>> > Indexing 4589 objects.\n>> > remote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n>> >  100% (4589/4589) done\n>> > Resolving 2209 deltas.\n>> > fatal: cannot pread pack file: Success\n>> > fatal: index-pack died with error code 128\n>> > fetch-pack from '/home/rael/devel/project/.git' failed.\n>> \n>> I think the pread() in get_data_from_pack of index-pack is wrong,\n>> it really should be looping until we fill the buffer in case the\n>> OS doesn't fully satisfy our read request the first time.\n>\n>Does this fix your problem?\n\nJust got back: I will try applying this patch and testing with it\nand let you know.\n\nYes, this is a mounted filesystem --- I did post the 'df -h' to show\nthis because I suspected something awry with it being a mounted drive.\n\nI'll let you know if this fixes it...\n\n\nBill\n"},{"id":"35828","messageId":"Pine.LNX.4.64.0702280744150.12485@woody.linux-foundation.org","threadId":"7006","inReplyTo":"7vbqje3jx9.fsf@assigned-by-dhcp.cox.net","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-28T15:47:19Z","receivedAt":"2007-02-28T15:47:19Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 27 Feb 2007, Junio C Hamano wrote:\n\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> >> \n> >> I think the pread() in get_data_from_pack of index-pack is wrong,\n> >> it really should be looping until we fill the buffer in case the\n> >> OS doesn't fully satisfy our read request the first time.\n> \n> The patch looks correct, even if this was not the problem Bill\n> is suffering from.\n\nAck. \n\nAlthough I would almost prefer it if we just did it like we do a lot of \nthe other cases: call it \"xpread()\" instead, and have the loop there.\n\nThe reason I didn't do that in the first place is that a file access is \nsupposed to be fully satisfied anyway, but yeah, NFS with an interruptible \nmount will break that posix guarantee, so the loop is definitely the right \nthing to do.\n\n\t\tLinus\n"},{"id":"35830","messageId":"17893.42063.186763.291346@lisa.zopyra.com","threadId":"7006","inReplyTo":"17893.40847.313519.283218@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T15:48:31Z","receivedAt":"2007-02-28T15:48:31Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 09:28:15 (-0600) Bill Lear writes:\n>On Tuesday, February 27, 2007 at 23:47:19 (-0500) Shawn O. Pearce writes:\n>>\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n>>> Bill Lear <rael@zopyra.com> wrote:\n>>> > Using 1.5.0.1.  Can't see what is wrong with this clone...\n>>> ...\n>>> > Indexing 4589 objects.\n>>> > remote: Total 4589 (delta 2209), reused 4589 (delta 2209)\n>>> >  100% (4589/4589) done\n>>> > Resolving 2209 deltas.\n>>> > fatal: cannot pread pack file: Success\n>>> > fatal: index-pack died with error code 128\n>>> > fetch-pack from '/home/rael/devel/project/.git' failed.\n>>> \n>>> I think the pread() in get_data_from_pack of index-pack is wrong,\n>>> it really should be looping until we fill the buffer in case the\n>>> OS doesn't fully satisfy our read request the first time.\n>>\n>>Does this fix your problem?\n>\n>Just got back: I will try applying this patch and testing with it\n>and let you know.\n\nNo, does not fix.  I added a bit more printout on the error:\n\n% git clone --bare ~/devel/project\nInitialized empty Git repository in /austin/users/rael/repos/git/project\nremote: Generating pack...\nremote: Done counting 4594 objects.\nremote: Deltifying 4594 objects.\nremote:  100% (4594/4594) done\nIndexing 4594 objects.\nremote: Total 4594 (delta 2210), reused 4591 (delta 2209)\n 100% (4594/4594) done\nResolving 2210 deltas.\nfatal: cannot pread pack file: Success [n=0; rdy=0; len=207]\nfatal: index-pack died with error code 128\nfetch-pack from '/home/rael/devel/fusion/.git' failed.\n\n\nBill\n"},{"id":"35831","messageId":"20070228155412.GC5479@spearce.org","threadId":"7006","inReplyTo":"17893.42063.186763.291346@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T15:54:12Z","receivedAt":"2007-02-28T15:54:12Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> fatal: cannot pread pack file: Success [n=0; rdy=0; len=207]\n> fatal: index-pack died with error code 128\n> fetch-pack from '/home/rael/devel/fusion/.git' failed.\n\nBwhat?!?  Can you print out the offset and the size of the packfile?\nIt looks like your pack has been truncated?  Or is this just your\nfilesystem saying \"nahh, I'm not going to give you that data right\nnow, try again later and maybe I will\"?\n\nI fail to see how a pread with a length of 207 is getting an EOF\nreturn unless the packfile is short.\n\n-- \nShawn.\n"},{"id":"35834","messageId":"17893.43522.511785.121778@lisa.zopyra.com","threadId":"7006","inReplyTo":"20070228155412.GC5479@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T16:12:50Z","receivedAt":"2007-02-28T16:12:50Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 10:54:12 (-0500) Shawn O. Pearce writes:\n>Bill Lear <rael@zopyra.com> wrote:\n>> fatal: cannot pread pack file: Success [n=0; rdy=0; len=207]\n>> fatal: index-pack died with error code 128\n>> fetch-pack from '/home/rael/devel/project/.git' failed.\n>\n>Bwhat?!?  Can you print out the offset and the size of the packfile?\n>It looks like your pack has been truncated?  Or is this just your\n>filesystem saying \"nahh, I'm not going to give you that data right\n>now, try again later and maybe I will\"?\n\nThe code has this:\n\n        unsigned long from = obj[0].offset + obj[0].hdr_size;\n        unsigned long len = obj[1].offset - from;\n\nby \"offset\", do you want obj[0].offset and obj[1].offset?\n\nHow do I get the size of the packfile?  Is it obj->size?\n\nWell, I went ahead and did that.  Here are the results:\n\n% git clone --bare ~/devel/project\n[...]\nResolving 2210 deltas.\nfatal: cannot pread pack file: Success [obj[0].offset=39393; obj[1].offset=39602; n=305; obj->size=0; rdy=0; len=207]\nfatal: index-pack died with error code 128\n\nLet me know if that is not what you intended.\n\n\nBill\n"},{"id":"35836","messageId":"17893.44181.129918.669187@lisa.zopyra.com","threadId":"7006","inReplyTo":"17893.43522.511785.121778@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T16:23:49Z","receivedAt":"2007-02-28T16:23:49Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 10:12:50 (-0600) Bill Lear writes:\n>On Wednesday, February 28, 2007 at 10:54:12 (-0500) Shawn O. Pearce writes:\n>>Bill Lear <rael@zopyra.com> wrote:\n>>> fatal: cannot pread pack file: Success [n=0; rdy=0; len=207]\n>>> fatal: index-pack died with error code 128\n>>> fetch-pack from '/home/rael/devel/project/.git' failed.\n>>\n>>Bwhat?!?  Can you print out the offset and the size of the packfile?\n>>It looks like your pack has been truncated?  Or is this just your\n>>filesystem saying \"nahh, I'm not going to give you that data right\n>>now, try again later and maybe I will\"?\n>\n>The code has this:\n>\n>        unsigned long from = obj[0].offset + obj[0].hdr_size;\n>        unsigned long len = obj[1].offset - from;\n>\n>by \"offset\", do you want obj[0].offset and obj[1].offset?\n>\n>How do I get the size of the packfile?  Is it obj->size?\n>\n>Well, I went ahead and did that.  Here are the results:\n>\n>% git clone --bare ~/devel/project\n>[...]\n>Resolving 2210 deltas.\n>fatal: cannot pread pack file: Success [obj[0].offset=39393; obj[1].offset=39602; n=305; obj->size=0; rdy=0; len=207]\n>fatal: index-pack died with error code 128\n\nAbove has n and obj->size switched, sorry.\n\n\nBill\n"},{"id":"35837","messageId":"20070228163256.GD5479@spearce.org","threadId":"7006","inReplyTo":"17893.44181.129918.669187@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T16:32:56Z","receivedAt":"2007-02-28T16:32:56Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> >The code has this:\n> >\n> >        unsigned long from = obj[0].offset + obj[0].hdr_size;\n> >        unsigned long len = obj[1].offset - from;\n> >\n> >by \"offset\", do you want obj[0].offset and obj[1].offset?\n> >\n> >How do I get the size of the packfile?  Is it obj->size?\n\nI meant something like this:\n\ndiff --git a/index-pack.c b/index-pack.c\nindex cf81a99..001aa46 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -287,7 +287,7 @@ static void *get_data_from_pack(struct object_entry *obj)\n \tdo {\n \t\tssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);\n \t\tif (n <= 0)\n-\t\t\tdie(\"cannot pread pack file: %s\", strerror(errno));\n+\t\t\tdie(\"cannot pread pack file: %s from=%lu, packfile size=%lu\", strerror(errno), from, lseek(pack_fd, SEEK_END, 0));\n \t\trdy += n;\n \t} while (rdy < len);\n \tdata = xmalloc(obj->size);\n\n-- \nShawn.\n"},{"id":"35838","messageId":"Pine.LNX.4.64.0702280830030.12485@woody.linux-foundation.org","threadId":"7006","inReplyTo":"17893.43522.511785.121778@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-28T16:34:18Z","receivedAt":"2007-02-28T16:34:18Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 28 Feb 2007, Bill Lear wrote:\n> \n> Well, I went ahead and did that.  Here are the results:\n> \n> % git clone --bare ~/devel/project\n> [...]\n> Resolving 2210 deltas.\n> fatal: cannot pread pack file: Success [obj[0].offset=39393; obj[1].offset=39602; n=305; obj->size=0; rdy=0; len=207]\n> fatal: index-pack died with error code 128\n\nWhat's \"n\"? Is that the return value from pread? Or was that \"rdy\"?\n\nWe expect the return value of pread() to be exactly the size we asked for, \nnamely \"len\". Anything else would be an error, and we know you're not \ngetting a negative return value (since strerror() says \"success\") unless \nyour pread() is *really* buggered.\n\nBut getting a return value of 0 would indicate that your pack-file is \nseriously corrupt (in particular, it would likely be truncated). And \ngetting a return value of 305 is also weird beyond belief, since we only \nasked for 207 bytes.\n\nOne thing to do (maybe you did already) is to just verify that what you're \ncloning looks fine:\n\n\tcd ~/devel/project\n\tgit fsck --full\n\njust to be safe.\n\n\t\tLinus\n"},{"id":"35839","messageId":"17893.44936.525606.74693@lisa.zopyra.com","threadId":"7006","inReplyTo":"Pine.LNX.4.64.0702280830030.12485@woody.linux-foundation.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T16:36:24Z","receivedAt":"2007-02-28T16:36:24Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 08:34:18 (-0800) Linus Torvalds writes:\n>On Wed, 28 Feb 2007, Bill Lear wrote:\n>> Well, I went ahead and did that.  Here are the results:\n>> \n>> % git clone --bare ~/devel/project\n>> [...]\n>> Resolving 2210 deltas.\n>> fatal: cannot pread pack file: Success [obj[0].offset=39393; obj[1].offset=39602; n=305; obj->size=0; rdy=0; len=207]\n>> fatal: index-pack died with error code 128\n>\n>What's \"n\"? Is that the return value from pread? Or was that \"rdy\"?\n\nYes, n is the value from pread.\n\nThis is on Linux, BTW:\n\n% uname -a\n\nLinux bl.zopyra.com 2.6.9-34.0.2.ELsmp #1 SMP Fri Jul 7 18:22:55 CDT 2006 x86_64 x86_64 x86_64 GNU/Linux\n\n>One thing to do (maybe you did already) is to just verify that what you're \n>cloning looks fine:\n>\n>\tcd ~/devel/project\n>\tgit fsck --full\n\nDid that, went fine.\n\n\nBill\n"},{"id":"35840","messageId":"17893.45167.334963.409569@lisa.zopyra.com","threadId":"7006","inReplyTo":"20070228163256.GD5479@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T16:40:15Z","receivedAt":"2007-02-28T16:40:15Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 11:32:56 (-0500) Shawn O. Pearce writes:\n>Bill Lear <rael@zopyra.com> wrote:\n>> >The code has this:\n>> >\n>> >        unsigned long from = obj[0].offset + obj[0].hdr_size;\n>> >        unsigned long len = obj[1].offset - from;\n>> >\n>> >by \"offset\", do you want obj[0].offset and obj[1].offset?\n>> >\n>> >How do I get the size of the packfile?  Is it obj->size?\n>\n>I meant something like this:\n>...\n\n% cd ~/devel/project\n% git-fsck --full\n% cd -\n% git clone --bare ~/devel/project\n[...]\nfatal: cannot pread pack file: Success from=39395, packfile size=2\nfatal: index-pack died with error code 128\n\nAnd, again, this works fine on my non-mounted file system:\n\n% cd ~/test\n% git clone --bare ~/devel/project\nInitialized empty Git repository in /home/blear/test/project/\nremote: Generating pack...\nremote: Done counting 4594 objects.\nremote: Deltifying 4594 objects.\nremote:  100% (4594/4594) done\nIndexing 4594 objects.\nremote: Total 4594 (delta 2210), reused 4591 (delta 2209)\n 100% (4594/4594) done\nResolving 2210 deltas.\n 100% (2210/2210) done\n\n\nBill\n"},{"id":"35841","messageId":"118833cc0702280842g3e121fg601d7e102956ba93@mail.gmail.com","threadId":"7006","inReplyTo":"20070228163256.GD5479@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Morten Welinder","fromEmail":"mwelinder@gmail.com","sentAt":"2007-02-28T16:42:39Z","receivedAt":"2007-02-28T16:42:39Z","isPatch":false,"sender":{"key":"mwelinder@gmail.com","avatar":null},"body":"> +                       die(\"cannot pread pack file: %s from=%lu, packfile size=%lu\", strerror(errno), from, lseek(pack_fd, SEEK_END, 0));\n\nThat might give you the errno from the lseek call.\n\nMorten\n"},{"id":"35842","messageId":"Pine.LNX.4.64.0702280843030.12485@woody.linux-foundation.org","threadId":"7006","inReplyTo":"17893.44936.525606.74693@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-28T16:47:44Z","receivedAt":"2007-02-28T16:47:44Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 28 Feb 2007, Bill Lear wrote:\n\n> On Wednesday, February 28, 2007 at 08:34:18 (-0800) Linus Torvalds writes:\n> >> [...]\n> >> Resolving 2210 deltas.\n> >> fatal: cannot pread pack file: Success [obj[0].offset=39393; obj[1].offset=39602; n=305; obj->size=0; rdy=0; len=207]\n> >> fatal: index-pack died with error code 128\n> >\n> >What's \"n\"? Is that the return value from pread? Or was that \"rdy\"?\n> \n> Yes, n is the value from pread.\n\nOk, that's just ODD. \n\nGetting 305 bytes back when you asked for 207 is a bad bad bad thing. It's \nalso really really odd and unexpected. \n\nWhat filesystem? And could you strace this and actually see the pread() \nsystem call?\n\n(use \"strace -f -o tracefile\" to follow all forks and to put the end \nresult in a trace file)\n\n\t\t\tLinus\n"},{"id":"35843","messageId":"20070228164814.GA5924@spearce.org","threadId":"7006","inReplyTo":"17893.45167.334963.409569@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T16:48:14Z","receivedAt":"2007-02-28T16:48:14Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> fatal: cannot pread pack file: Success from=39395, packfile size=2\n> fatal: index-pack died with error code 128\n\nGahhh. I had the arguments to lseek reversed:\n\ndiff --git a/index-pack.c b/index-pack.c\nindex cf81a99..5629c23 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -287,7 +287,7 @@ static void *get_data_from_pack(struct object_entry *obj)\n \tdo {\n \t\tssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);\n \t\tif (n <= 0)\n-\t\t\tdie(\"cannot pread pack file: %s\", strerror(errno));\n+\t\t\tdie(\"cannot pread pack file: %s from=%lu, packfile size=%lu\", strerror(errno), from, lseek(pack_fd, 0, SEEK_END));\n \t\trdy += n;\n \t} while (rdy < len);\n \tdata = xmalloc(obj->size);\n\n\n-- \nShawn.\n"},{"id":"35844","messageId":"20070228164922.GB5924@spearce.org","threadId":"7006","inReplyTo":"118833cc0702280842g3e121fg601d7e102956ba93@mail.gmail.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T16:49:22Z","receivedAt":"2007-02-28T16:49:22Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Morten Welinder <mwelinder@gmail.com> wrote:\n> >+                       die(\"cannot pread pack file: %s from=%lu, packfile \n> >size=%lu\", strerror(errno), from, lseek(pack_fd, SEEK_END, 0));\n> \n> That might give you the errno from the lseek call.\n\nYes, and I don't care here.  We're dead either way, that pread is\nreturning bunk and we don't know why.\n\nBut it is also giving me SEEK_END, not the end of the file.  I got\nthe arguments backwards to lseek.  Whoops.  ;-)\n\n-- \nShawn.\n"},{"id":"35845","messageId":"17893.45903.748382.298137@lisa.zopyra.com","threadId":"7006","inReplyTo":"Pine.LNX.4.64.0702280843030.12485@woody.linux-foundation.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T16:52:31Z","receivedAt":"2007-02-28T16:52:31Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 08:47:44 (-0800) Linus Torvalds writes:\n>\n>\n>On Wed, 28 Feb 2007, Bill Lear wrote:\n>\n>> On Wednesday, February 28, 2007 at 08:34:18 (-0800) Linus Torvalds writes:\n>> >> [...]\n>> >> Resolving 2210 deltas.\n>> >> fatal: cannot pread pack file: Success [obj[0].offset=39393; obj[1].offset=39602; n=305; obj->size=0; rdy=0; len=207]\n>> >> fatal: index-pack died with error code 128\n>> >\n>> >What's \"n\"? Is that the return value from pread? Or was that \"rdy\"?\n>> \n>> Yes, n is the value from pread.\n>\n>Ok, that's just ODD. \n>\n>Getting 305 bytes back when you asked for 207 is a bad bad bad thing. It's \n>also really really odd and unexpected. \n\nYou may have missed my admission that I screwed up the print: n is 0, obj->size\nwas 305.\n\n>What filesystem? And could you strace this and actually see the pread() \n>system call?\n\nHow can I tell which filesystem?  It's Linux all around, as far as I\nknow.  Here is what mount tells me about this filesystem:\n\nstorage:/storage/disk1 on /austin type nfs (rw,addr=192.168.2.192)\n\n>(use \"strace -f -o tracefile\" to follow all forks and to put the end \n>result in a trace file)\n\nWill do ...\n\n\nBill\n"},{"id":"35846","messageId":"17893.46083.869042.467318@lisa.zopyra.com","threadId":"7006","inReplyTo":"20070228164922.GB5924@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T16:55:31Z","receivedAt":"2007-02-28T16:55:31Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 11:49:22 (-0500) Shawn O. Pearce writes:\n>Morten Welinder <mwelinder@gmail.com> wrote:\n>> >+                       die(\"cannot pread pack file: %s from=%lu, packfile \n>> >size=%lu\", strerror(errno), from, lseek(pack_fd, SEEK_END, 0));\n>> \n>> That might give you the errno from the lseek call.\n>\n>Yes, and I don't care here.  We're dead either way, that pread is\n>returning bunk and we don't know why.\n>\n>But it is also giving me SEEK_END, not the end of the file.  I got\n>the arguments backwards to lseek.  Whoops.  ;-)\n\nOk, fixed that:\n\n% strace -f -o tracefile git clone --bare ~/devel/project\n[...]\nfatal: cannot pread pack file: Success from=39395, packfile size=0\n[...]\n% grep pread tracefile\n28635 pread(3,  <unfinished ...>\n28635 <... pread resumed> \"\", 207, 39395) = 0\n28635 write(2, \"cannot pread pack file: Success \"..., 59) = 59\n\n\nBill\n"},{"id":"35848","messageId":"20070228170641.GC5924@spearce.org","threadId":"7006","inReplyTo":"17893.46083.869042.467318@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T17:06:41Z","receivedAt":"2007-02-28T17:06:41Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> % strace -f -o tracefile git clone --bare ~/devel/project\n> [...]\n> fatal: cannot pread pack file: Success from=39395, packfile size=0\n> [...]\n> % grep pread tracefile\n> 28635 pread(3,  <unfinished ...>\n> 28635 <... pread resumed> \"\", 207, 39395) = 0\n> 28635 write(2, \"cannot pread pack file: Success \"..., 59) = 59\n\nWell, that answers that.  The packfile is 0 bytes long.  Why?\nWe downloaded the data and are trying to resolve deltas... but\nwhen we go back into the packfile we thought we had, we find it is\nnothing but an empty file.  NFS strikes again!\n\nHave you been able to clone onto this drive before?  Maybe with a\ndifferent version of Git (1.4.x series, before this pread change\nin index-pack)?  Clearly this operation should be working, but\nits not, and I'm certainly at a loss for why the file would just\nmagically truncate itself.\n\n-- \nShawn.\n"},{"id":"35849","messageId":"17893.47007.136145.112498@lisa.zopyra.com","threadId":"7006","inReplyTo":"20070228170641.GC5924@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T17:10:55Z","receivedAt":"2007-02-28T17:10:55Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 12:06:41 (-0500) Shawn O. Pearce writes:\n>Bill Lear <rael@zopyra.com> wrote:\n>> % strace -f -o tracefile git clone --bare ~/devel/project\n>> [...]\n>> fatal: cannot pread pack file: Success from=39395, packfile size=0\n>> [...]\n>> % grep pread tracefile\n>> 28635 pread(3,  <unfinished ...>\n>> 28635 <... pread resumed> \"\", 207, 39395) = 0\n>> 28635 write(2, \"cannot pread pack file: Success \"..., 59) = 59\n>\n>Well, that answers that.  The packfile is 0 bytes long.  Why?\n>We downloaded the data and are trying to resolve deltas... but\n>when we go back into the packfile we thought we had, we find it is\n>nothing but an empty file.  NFS strikes again!\n>\n>Have you been able to clone onto this drive before?  Maybe with a\n>different version of Git (1.4.x series, before this pread change\n>in index-pack)?  Clearly this operation should be working, but\n>its not, and I'm certainly at a loss for why the file would just\n>magically truncate itself.\n\nYes: 1.4.x worked fine.  This was actually my attempt to re-do the 1.4\nclone I had laying around, as I wanted my backup done with 1.5.  I\nstill have the 1.4 cloned repo, just moved it out of the way...\n\n\nBill\n"},{"id":"35851","messageId":"Pine.LNX.4.64.0702280910330.12485@woody.linux-foundation.org","threadId":"7006","inReplyTo":"17893.45903.748382.298137@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-28T17:13:59Z","receivedAt":"2007-02-28T17:13:59Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 28 Feb 2007, Bill Lear wrote:\n> >\n> >Getting 305 bytes back when you asked for 207 is a bad bad bad thing. It's \n> >also really really odd and unexpected. \n> \n> You may have missed my admission that I screwed up the print: n is 0, obj->size\n> was 305.\n\nAhh, ok. \n\nThat means you got 0 back. That in turn means that the file seems to be \ntruncated for some reason - the only valid reason to get 0 back is if the \nlength of the file is smaller than the offset you're asking for data from.\n\n> >What filesystem? And could you strace this and actually see the pread() \n> >system call?\n> \n> How can I tell which filesystem?  It's Linux all around, as far as I\n> know.  Here is what mount tells me about this filesystem:\n> \n> storage:/storage/disk1 on /austin type nfs (rw,addr=192.168.2.192)\n\nYes, that's how you get the filesystem type ;)\n\n> >(use \"strace -f -o tracefile\" to follow all forks and to put the end \n> >result in a trace file)\n> \n> Will do ...\n\nWell, if the return value was 0, it wasn't as odd any more, and the reason \nseems to be a file truncate error. Shawn seems to be on that one.\n\n(The \"return 305 when asked for 207\" seemed like a kernel bug, which was \nwhy I got really interested ;)\n\n\t\tLinus\n"},{"id":"35862","messageId":"alpine.LRH.0.82.0702281234400.29426@xanadu.home","threadId":"7006","inReplyTo":"Pine.LNX.4.64.0702280830030.12485@woody.linux-foundation.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-28T17:42:18Z","receivedAt":"2007-02-28T17:42:18Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 28 Feb 2007, Linus Torvalds wrote:\n\n> One thing to do (maybe you did already) is to just verify that what you're \n> cloning looks fine:\n> \n> \tcd ~/devel/project\n> \tgit fsck --full\n> \n> just to be safe.\n\nThat won't tell anything.  git-index-pack works on a streamed pack and \nby the time it dies the pack is not complete yet and not moved to the \nfinal spot.\n\n\nNicolas\n"},{"id":"35854","messageId":"20070228174339.GE5924@spearce.org","threadId":"7006","inReplyTo":"17893.47007.136145.112498@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T17:43:39Z","receivedAt":"2007-02-28T17:43:39Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> Yes: 1.4.x worked fine.  This was actually my attempt to re-do the 1.4\n> clone I had laying around, as I wanted my backup done with 1.5.  I\n> still have the 1.4 cloned repo, just moved it out of the way...\n\nOK, is ~/devel/project fully packed?  If it isn't can you repack\nit (or a clone of it) so that it is?\n\nThen take the packfile and try to feed it right into index-pack:\n\n\tmkdir /austin/users/rael/repos/git/project-test\n\tcd /austin/users/rael/repos/git/project-test\n\tgit --bare init\n\tgit --bare index-pack --stdin --fix-thin \\\n\t  <~/devel/project/.git/objects/pack/pack-*.pack\n\nNow while that is running it should be creating pack_XXXXXX as a\ntemporary file (where XXXXXX is replaced with the temp string).\nIts this file that we are seeing magically truncate to 0 in the\nmiddle of running.\n\nBut I fail to see anything in index-pack that would cause this,\nand its the only program that knows about this file at this stage\nof the clone.\n\n-- \nShawn.\n"},{"id":"35856","messageId":"alpine.LRH.0.82.0702281249430.29426@xanadu.home","threadId":"7006","inReplyTo":"20070228174339.GE5924@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-28T17:50:47Z","receivedAt":"2007-02-28T17:50:47Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 28 Feb 2007, Shawn O. Pearce wrote:\n\n> Bill Lear <rael@zopyra.com> wrote:\n> > Yes: 1.4.x worked fine.  This was actually my attempt to re-do the 1.4\n> > clone I had laying around, as I wanted my backup done with 1.5.  I\n> > still have the 1.4 cloned repo, just moved it out of the way...\n> \n> OK, is ~/devel/project fully packed?  If it isn't can you repack\n> it (or a clone of it) so that it is?\n> \n> Then take the packfile and try to feed it right into index-pack:\n> \n> \tmkdir /austin/users/rael/repos/git/project-test\n> \tcd /austin/users/rael/repos/git/project-test\n> \tgit --bare init\n> \tgit --bare index-pack --stdin --fix-thin \\\n> \t  <~/devel/project/.git/objects/pack/pack-*.pack\n> \n> Now while that is running it should be creating pack_XXXXXX as a\n> temporary file (where XXXXXX is replaced with the temp string).\n> Its this file that we are seeing magically truncate to 0 in the\n> middle of running.\n> \n> But I fail to see anything in index-pack that would cause this,\n> and its the only program that knows about this file at this stage\n> of the clone.\n\n... and Bill already said that the same clone operation, when not \nperformed on top of NFS, works fine.\n\n\nNicolas\n"},{"id":"35858","messageId":"20070228175824.GF5924@spearce.org","threadId":"7006","inReplyTo":"alpine.LRH.0.82.0702281249430.29426@xanadu.home","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-28T17:58:24Z","receivedAt":"2007-02-28T17:58:24Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Nicolas Pitre <nico@cam.org> wrote:\n> On Wed, 28 Feb 2007, Shawn O. Pearce wrote:\n> > Bill Lear <rael@zopyra.com> wrote:\n> > > Yes: 1.4.x worked fine.  This was actually my attempt to re-do the 1.4\n> > > clone I had laying around, as I wanted my backup done with 1.5.  I\n> > > still have the 1.4 cloned repo, just moved it out of the way...\n> > \n> > But I fail to see anything in index-pack that would cause this,\n> > and its the only program that knows about this file at this stage\n> > of the clone.\n> \n> ... and Bill already said that the same clone operation, when not \n> performed on top of NFS, works fine.\n\nGah.  You're right.  And Bill also said the same clone works fine\non NFS, just so long as it is the Git 1.4.x series.  Which means\nno pread/delta-resolving based index-pack.\n\nWhich leads me to believe something really horrible is happening in\nthe NFS server, like when we append to the packfile it truncates it.\nExcept during a clone we shouldn't append anything during the\ndelta resolution phase, as all delta bases should appear in that\none packfile.\n\nBill, are you sure someone isn't truncating your files on your NFS\nserver behind your back?  Is it an early April fool's joke from\na coworker?\n\n-- \nShawn.\n"},{"id":"35864","messageId":"alpine.LRH.0.82.0702281315480.29426@xanadu.home","threadId":"7006","inReplyTo":"Pine.LNX.4.64.0702280910330.12485@woody.linux-foundation.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-28T18:18:10Z","receivedAt":"2007-02-28T18:18:10Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 28 Feb 2007, Linus Torvalds wrote:\n\n> Well, if the return value was 0, it wasn't as odd any more, and the reason \n> seems to be a file truncate error. Shawn seems to be on that one.\n> \n> (The \"return 305 when asked for 207\" seemed like a kernel bug, which was \n> why I got really interested ;)\n\nI wouldn't dismiss a kernel bug just yet.\n\nBill already said the same operation, when not performed over NFS, works \njust fine.\n\nHe also mentioned that version 1.4.4, which uses mmap() instead of \npread(), works also fine even over NFS.\n\n\nNicolas\n"},{"id":"35866","messageId":"Pine.LNX.4.64.0702281031490.12485@woody.linux-foundation.org","threadId":"7006","inReplyTo":"alpine.LRH.0.82.0702281315480.29426@xanadu.home","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-28T18:37:51Z","receivedAt":"2007-02-28T18:37:51Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 28 Feb 2007, Nicolas Pitre wrote:\n>\n> On Wed, 28 Feb 2007, Linus Torvalds wrote:\n> \n> > Well, if the return value was 0, it wasn't as odd any more, and the reason \n> > seems to be a file truncate error. Shawn seems to be on that one.\n> > \n> > (The \"return 305 when asked for 207\" seemed like a kernel bug, which was \n> > why I got really interested ;)\n> \n> I wouldn't dismiss a kernel bug just yet.\n> \n> Bill already said the same operation, when not performed over NFS, works \n> just fine.\n> \n> He also mentioned that version 1.4.4, which uses mmap() instead of \n> pread(), works also fine even over NFS.\n\nHmm.. Good point. \n\nI'm addign Trond, Chuck and Neil to the list, just in case there might be \nsome known problem where NFS might use f_pos instead of the passed-in \nposition, causing problems with pread(). Not that I can imagine how that \ncould even happen or not be noticed..\n\nGuys, this is a oldish 2.6.x kernel: \"2.6.9-34.0.2.ELsmp #1 SMP Fri Jul \n7\", and for some reason we have a file that appears truncated to pread() \n(returns 0) but worked with mmap and the same test-case apparently works \non non-NFS filesystems. Any ideas? Some known bug that got fixed since?\n\nBill, can you make the whole strace available somewhere?\n\n\t\t\tLinus\n"},{"id":"35871","messageId":"17893.54640.150106.294218@lisa.zopyra.com","threadId":"7006","inReplyTo":"20070228174339.GE5924@spearce.org","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T19:18:08Z","receivedAt":"2007-02-28T19:18:08Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 12:43:39 (-0500) Shawn O. Pearce writes:\n>Bill Lear <rael@zopyra.com> wrote:\n>> Yes: 1.4.x worked fine.  This was actually my attempt to re-do the 1.4\n>> clone I had laying around, as I wanted my backup done with 1.5.  I\n>> still have the 1.4 cloned repo, just moved it out of the way...\n>\n>OK, is ~/devel/project fully packed?  If it isn't can you repack\n>it (or a clone of it) so that it is?\n\nI did a git gc on this before starting, so I assume it is fully packed.\n\nI tried copying my backup 1.4 repo to my local drive and then cloning\nit with 1.5 onto my nfs-mounted drive.  This failed like this:\n\n% cp -rp project-/ ~/project-1.4\n% git clone --bare ~/project-1.4\n[...]\nResolving 1286 deltas.\nfatal: cannot pread pack file: Success from=37269, packfile size=0\nfatal: index-pack died with error code 128\n\nJust to see what 1.4 will now do, I tried with 1.4, and it is now\nfailing also:\n\n[Reset PATH]\n% git --version\ngit version 1.4.4.1\n% git clone --bare ~/project-1.4\n[...]\nResolving 1286 deltas.\nremote: Total 3165, written 3165 (delta 1286), reused 1840 (delta 488)\nfatal: index-pack died of signal 7\n\n>Then take the packfile and try to feed it right into index-pack:\n>\n>\tmkdir /austin/users/rael/repos/git/project-test\n>\tcd /austin/users/rael/repos/git/project-test\n>\tgit --bare init\n>\tgit --bare index-pack --stdin --fix-thin \\\n>\t  <~/devel/project/.git/objects/pack/pack-*.pack\n>\n>Now while that is running it should be creating pack_XXXXXX as a\n>temporary file (where XXXXXX is replaced with the temp string).\n>Its this file that we are seeing magically truncate to 0 in the\n>middle of running.\n\nDid that.  Still fails:\n\n% git --bare index-pack --stdin --fix-thin < ~/devel/project/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\nfatal: cannot pread pack file: Success from=39215, packfile size=0\n\nI do see this:\n\n% ls -l objects\ntotal 88088\ndrwxr-xr-x  2 rael  software     4096 Feb 28 13:05 info/\ndrwxr-xr-x  2 rael  software     4096 Feb 28 13:05 pack/\n-rw-------  1 rael  software 90099505 Feb 28 13:06 pack_eZwOnG\n\n\nBill\n"},{"id":"35874","messageId":"Pine.LNX.4.64.0702281104230.12485@woody.linux-foundation.org","threadId":"7006","inReplyTo":"17893.53091.452962.414271@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-28T19:22:38Z","receivedAt":"2007-02-28T19:22:38Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"[Bill Lear: I'm resending this to the git list --- I did not want to\npublicize my trace output, so I have trimmed that.  Below are Linus's\nwords.]\n\nOk, thanks. I'm going to be away for the next 24 hours, so won't be able \nto look at it any closer, but hopefully nico or shawn will have found it \nby then, or it will have resolved to a real NFS bug.\n\nI did a very *quick* thing (the pread that fails is in process 28635, so I \nlooked at just that one), and the IO patterns are:\n\n\t28635 open(\"/austin/users/blear/repos/git/fusion/objects/pack_pYGHgc\", O_RDWR|O_CREAT|O_EXCL, 0600 <unfinished ...>\n\t28635 <... open resumed> )              = 3\n\t28635 read(0,  <unfinished ...>\n\t28635 <... read resumed> \"PACK\\0\\0\\0\\2\\0\\0\\21\\362\\236\\17x\\332\\235\\313AjC!\\20\\200\"..., 4096) = 4096\n\t28635 write(3, \"PACK\\0\\0\\0\\2\\0\\0\\21\\362\\236\\17x\\332\\235\\313AjC!\\20\\200\"..., 4096 <unfinished ...>\n\t28635 <... write resumed> )             = 4096\n\t28635 read(0,  <unfinished ...>\n\t28635 <... read resumed> \"\\300\\355i\\31\\204\\330\\343\\205\\365\\365m\\177\\277\\232\\1\\352\"..., 4096) = 4096\n\t28635 write(3, \"\\300\\355i\\31\\204\\330\\343\\205\\365\\365m\\177\\277\\232\\1\\352\"..., 4096 <unfinished ...>\n\t28635 <... write resumed> )             = 4096\n\t28635 read(0,  <unfinished ...>\n\t28635 <... read resumed> \"\\247h\\264\\217\\23\\23\\232,\\242a\\202\\1\\317\\276\\354M\\335\\361\"..., 4096) = 4096\n\t28635 write(3, \"\\247h\\264\\217\\23\\23\\232,\\242a\\202\\1\\317\\276\\354M\\335\\361\"..., 4096) = 4096\n\t...\n\n(so yes, it seems to write the whole pack-file).\n\nThe only odd part is at the end of that sequence:\n\n\t...\n\t28635 read(0,  <unfinished ...>\n\t28635 <... read resumed> \"\\324/\\356{Jc\\277\\251\\20\\f\\375\\210\\347\\271{m\\222D\\203S\\t\"..., 4096) = 3492\n\t28635 write(3, \"\\324/\\356{Jc\\277\\251\\20\\f\\375\\210\\347\\271{m\\222D\\203S\\t\"..., 3492 <unfinished ...>\n\t28635 <... write resumed> )             = 3492\n\t28635 read(0,  <unfinished ...>\n\t28635 <... read resumed> \"\\0349[:\\')\\30\\352O\\325\\244\\244[\\17\\342\\251hL\\233m\", 4096) = 20\n\t28635 write(3, \"\\34\", 1 <unfinished ...>\n\t28635 <... write resumed> )             = 1\n\n(I skipped the writes to fd 2, which are just the \"99% (4549/4594) done\" \nkind of messages). The strange thing here is that I think the last 20 \nbytes we read from fd 0 is the SHA1 of the whole pack-file, but then the \nlast *write* to the output pack-file is just a single-byte (\\34), which is \njust the first byte of the SHA1 we got. Maybe.\n\nRegardless, we did a *lot* of writes to fd 3, yet then we get:\n\n\t...\n\t28635 pread(3,  <unfinished ...>\n\t28635 <... pread resumed> \"\", 207, 39395) = 0\n\t28635 --- SIGALRM (Alarm clock) @ 0 (0) ---\n\t28635 rt_sigreturn(0xe)                 = 0\n\t28635 lseek(3, 0, SEEK_END)             = 0\n\t28635 write(2, \"fatal: \", 7)            = 7\n\t28635 write(2, \"cannot pread pack file: Success \"..., 59) = 59\n\t28635 write(2, \"\\n\", 1)                 = 1\n\nwhich really *does* seem like a NFS bug: the pread() seems to return 0, \nand yes there is a SIGALRM going off that may be the cause of that return. \nHOWEVER, the\n\n\tlseek(3, 0, SEEK_END) = 0\n\nalso seems to indicate that somehow all the writes to fd 3 were dropped or \nignored, which makes me wonder whether the SIGALRM was involved after all \n(because it shouldn't have affected the end result of the lseek anyway).\n\nI'm confused. But I need to go now, so I can't look at it any more.\n\n\t\tLinus\n"},{"id":"35872","messageId":"17893.54980.672279.633902@lisa.zopyra.com","threadId":"7006","inReplyTo":"17893.54640.150106.294218@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-28T19:23:48Z","receivedAt":"2007-02-28T19:23:48Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 13:18:08 (-0600) Bill Lear writes:\n>\n>% ls -l objects\n>total 88088\n>drwxr-xr-x  2 rael  software     4096 Feb 28 13:05 info/\n>drwxr-xr-x  2 rael  software     4096 Feb 28 13:05 pack/\n>-rw-------  1 rael  software 90099505 Feb 28 13:06 pack_eZwOnG\n\nI should have added:\n\n% ls -l ~/devel/fusion/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\n-r--r--r--  1 rael software 90099525 Feb 27 21:36 /home/rael/devel/project/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\n\nThat's 20 bytes of difference.\n\n\nBill\n"},{"id":"35876","messageId":"alpine.LRH.0.82.0702281439410.29426@xanadu.home","threadId":"7006","inReplyTo":"17893.54980.672279.633902@lisa.zopyra.com","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-28T19:40:25Z","receivedAt":"2007-02-28T19:40:25Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 28 Feb 2007, Bill Lear wrote:\n\n> On Wednesday, February 28, 2007 at 13:18:08 (-0600) Bill Lear writes:\n> >\n> >% ls -l objects\n> >total 88088\n> >drwxr-xr-x  2 rael  software     4096 Feb 28 13:05 info/\n> >drwxr-xr-x  2 rael  software     4096 Feb 28 13:05 pack/\n> >-rw-------  1 rael  software 90099505 Feb 28 13:06 pack_eZwOnG\n> \n> I should have added:\n> \n> % ls -l ~/devel/fusion/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\n> -r--r--r--  1 rael software 90099525 Feb 27 21:36 /home/rael/devel/project/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\n> \n> That's 20 bytes of difference.\n\nThat is actually OK.  This is the temporary pack file the fetch received \nbut which final SHA1 has not been written yet.  Normally, after the \ndelta resolution has finished (the part that requires the pread() calls) \nthen the final SHA1 is written and the pack is moved to its final \nlocation under an appropriate name.  But in your case index-pack bailed \nout on the failing pread() and left its incomplete temporary pack there.\n\n\nNicolas\n"},{"id":"35979","messageId":"17894.61443.113876.53670@lisa.zopyra.com","threadId":"7006","inReplyTo":"alpine.LRH.0.82.0702281439410.29426@xanadu.home","subject":"Re: Error \"fatal: cannot pread pack file: Success\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-01T15:23:47Z","receivedAt":"2007-03-01T15:23:47Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 28, 2007 at 14:40:25 (-0500) Nicolas Pitre writes:\n>On Wed, 28 Feb 2007, Bill Lear wrote:\n>\n>> On Wednesday, February 28, 2007 at 13:18:08 (-0600) Bill Lear writes:\n>> >\n>> >% ls -l objects\n>> >total 88088\n>> >drwxr-xr-x  2 rael  software     4096 Feb 28 13:05 info/\n>> >drwxr-xr-x  2 rael  software     4096 Feb 28 13:05 pack/\n>> >-rw-------  1 rael  software 90099505 Feb 28 13:06 pack_eZwOnG\n>> \n>> I should have added:\n>> \n>> % ls -l ~/devel/fusion/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\n>> -r--r--r--  1 rael software 90099525 Feb 27 21:36 /home/rael/devel/project/.git/objects/pack/pack-fe532a54e5d549f1cfc70a4ab2c5f4eaac8897a5.pack\n>> \n>> That's 20 bytes of difference.\n>\n>That is actually OK.  This is the temporary pack file the fetch received \n>but which final SHA1 has not been written yet.  Normally, after the \n>delta resolution has finished (the part that requires the pread() calls) \n>then the final SHA1 is written and the pack is moved to its final \n>location under an appropriate name.  But in your case index-pack bailed \n>out on the failing pread() and left its incomplete temporary pack there.\n\nAs follow-up: I installed git 1.5.0.1 on a box with a newer version of\nLinux, tried the same operations and it worked fine.\n\n% uname -a\nLinux xiho.zopyra.com 2.6.15-1.2054_FC5smp #1 SMP Tue Mar 14 16:05:46 EST 2006 i686 i686 i386 GNU/Linux\n\n% git clone --bare ~/project\nInitialized empty Git repository in /austin/users/rael/repos/git/project/\nremote: Generating pack...\nremote: Done counting 4304 objects.\nremote: Deltifying 4304 objects.\nremote:  100% (4304/4304) done\nIndexing 4304 objects.\nremote: Total 4304 (delta 2031), reused 4293 (delta 2026)\n 100% (4304/4304) done\nResolving 2031 deltas.\n 100% (2031/2031) done\n\nSo, I guess we'll just have to upgrade our Linux boxes to get the\nnewer NFS client code that appears to be the cause of this...\n\n\nBill\n"}]}