Re: index-pack died on pread

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: GIT <git@...>
Cc: Junio C Hamano <gitster@...>, Alex Riesen <raa.lkml@...>, Robin Rosenberg <robin.rosenberg.lists@...>, Michal Rokos <michal.rokos@...>, GIT <git@...>
Date: Friday, July 27, 2007 - 5:50 am

Maybe this may help:

I compiled Git under Linux with NO_PREAD=1, and also _disabled_
file position save/restore in git_pread().  Now (I clone small repo to
save traffic):

  moonlight:/tmp$ git-clone git://people.freedesktop.org/~keithp/parsecvs
  Initialized empty Git repository in /tmp/parsecvs/.git/
  remote: Generating pack...
  remote: Done counting 476 objects.
  remote: Deltifying 476 objects.
  remote:  100% (476/476) done
  Indexing 476 objects...
  remote: Total 476 (delta 339), reused 0 (delta 0)
   100% (476/476) done
  Resolving 339 deltas...
   100% (339/339) done
  error: packfile /tmp/parsecvs/.git/objects/pack/pack-dda2f32249fab26059a035bd273dce9feaf6bade.pack does not match index
  error: packfile /tmp/parsecvs/.git/objects/pack/pack-dda2f32249fab26059a035bd273dce9feaf6bade.pack cannot be accessed
  error: packfile /tmp/parsecvs/.git/objects/pack/pack-dda2f32249fab26059a035bd273dce9feaf6bade.pack does not match index
  error: packfile /tmp/parsecvs/.git/objects/pack/pack-dda2f32249fab26059a035bd273dce9feaf6bade.pack cannot be accessed
  fatal: failed to unpack tree object HEAD

Errors are different, but seems Git is sensitive to pread() that messes
file position.  The problem may be in index-pack.c:

	static const char *open_pack_file(const char *pack_name)
	{
		if (from_stdin) {
	                ...
			pack_fd = output_fd;
		} else {
	                ...
			pack_fd = input_fd;
		}
	        ...
	}

There's no dup() call, so when we mess pack_fd (that is used in
pread() only), we also mess one more file descriptor that is used
sequentially (output_fd in my case), and so may corrupt the pack.


-- 
   Tomash Brechko
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
index-pack died on pread, Michal Rokos, (Mon Jul 23, 8:52 am)
Re: index-pack died on pread, Linus Torvalds, (Mon Jul 23, 1:04 pm)
Re: index-pack died on pread, Robin Rosenberg, (Wed Jul 25, 7:15 pm)
Re: index-pack died on pread, Linus Torvalds, (Wed Jul 25, 7:44 pm)
Re: index-pack died on pread, Alex Riesen, (Thu Jul 26, 8:42 am)
Re: index-pack died on pread, Linus Torvalds, (Thu Jul 26, 12:13 pm)
Re: index-pack died on pread, Junio C Hamano, (Thu Jul 26, 11:43 pm)
Re: index-pack died on pread, Linus Torvalds, (Fri Jul 27, 1:36 am)
Re: index-pack died on pread, Nicolas Pitre, (Fri Jul 27, 9:38 am)
Re: index-pack died on pread, Tomash Brechko, (Fri Jul 27, 5:50 am)
Re: index-pack died on pread, Tomash Brechko, (Fri Jul 27, 6:33 am)
Re: index-pack died on pread, Alex Riesen, (Thu Jul 26, 12:51 pm)
Re: index-pack died on pread, Linus Torvalds, (Thu Jul 26, 2:02 pm)
Re: index-pack died on pread, Nicolas Pitre, (Mon Jul 23, 2:03 pm)
Re: index-pack died on pread, Alex Riesen, (Mon Jul 23, 11:32 am)
Re: index-pack died on pread, Michal Rokos, (Wed Jul 25, 4:07 pm)
Re: index-pack died on pread, Alex Riesen, (Wed Jul 25, 4:48 pm)