send-pack: fix pipeline.

send-pack builds a pipeline that runs "rev-list | pack-objects"
and sends the output from pack-objects to the other side, while
feeding the input side of that pipe from itself.  However, the
file descriptor that is given to this pipeline (so that it can
be dup2(2)'ed into file descriptor 1 of pack-objects) is closed
by the caller before the complex fork+exec dance!  Worse yet,
the caller already dup2's it to 1, so the child process did not
even have to.

I do not understand how this code could possibly have been
working, but it somehow was working by accident.

Merging the sliding mmap() code reveals this problem, presumably
because it keeps one extra file descriptor open for a packfile
and changes the way file descriptors are allocated.  I am too
tired to diagnose the problem now, but this seems to be a
sensible fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 file changed
tree: e129c5cad763d28285e53abc5fd59bb9e858ee54
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. gitweb/
  6. mozilla-sha1/
  7. perl/
  8. ppc/
  9. t/
  10. templates/
  11. xdiff/
  12. .gitignore
  13. .mailmap
  14. alloc.c
  15. archive-tar.c
  16. archive-zip.c
  17. archive.h
  18. base85.c
  19. blob.c
  20. blob.h
  21. builtin-add.c
  22. builtin-annotate.c
  23. builtin-apply.c
  24. builtin-archive.c
  25. builtin-blame.c
  26. builtin-branch.c
  27. builtin-cat-file.c
  28. builtin-check-ref-format.c
  29. builtin-checkout-index.c
  30. builtin-commit-tree.c
  31. builtin-count-objects.c
  32. builtin-diff-files.c
  33. builtin-diff-index.c
  34. builtin-diff-stages.c
  35. builtin-diff-tree.c
  36. builtin-diff.c
  37. builtin-fmt-merge-msg.c
  38. builtin-for-each-ref.c
  39. builtin-grep.c
  40. builtin-init-db.c
  41. builtin-log.c
  42. builtin-ls-files.c
  43. builtin-ls-tree.c
  44. builtin-mailinfo.c
  45. builtin-mailsplit.c
  46. builtin-merge-file.c
  47. builtin-mv.c
  48. builtin-name-rev.c
  49. builtin-pack-objects.c
  50. builtin-pack-refs.c
  51. builtin-prune-packed.c
  52. builtin-prune.c
  53. builtin-push.c
  54. builtin-read-tree.c
  55. builtin-reflog.c
  56. builtin-repo-config.c
  57. builtin-rerere.c
  58. builtin-rev-list.c
  59. builtin-rev-parse.c
  60. builtin-rm.c
  61. builtin-runstatus.c
  62. builtin-shortlog.c
  63. builtin-show-branch.c
  64. builtin-show-ref.c
  65. builtin-stripspace.c
  66. builtin-symbolic-ref.c
  67. builtin-tar-tree.c
  68. builtin-unpack-objects.c
  69. builtin-update-index.c
  70. builtin-update-ref.c
  71. builtin-upload-archive.c
  72. builtin-verify-pack.c
  73. builtin-write-tree.c
  74. builtin.h
  75. cache-tree.c
  76. cache-tree.h
  77. cache.h
  78. check-builtins.sh
  79. check-racy.c
  80. color.c
  81. color.h
  82. combine-diff.c
  83. commit.c
  84. commit.h
  85. config.c
  86. config.mak.in
  87. configure.ac
  88. connect.c
  89. convert-objects.c
  90. copy.c
  91. COPYING
  92. csum-file.c
  93. csum-file.h
  94. ctype.c
  95. daemon.c
  96. date.c
  97. delta.h
  98. describe.c
  99. diff-delta.c
  100. diff-lib.c
  101. diff.c
  102. diff.h
  103. diffcore-break.c
  104. diffcore-delta.c
  105. diffcore-order.c
  106. diffcore-pickaxe.c
  107. diffcore-rename.c
  108. diffcore.h
  109. dir.c
  110. dir.h
  111. dump-cache-tree.c
  112. entry.c
  113. environment.c
  114. exec_cmd.c
  115. exec_cmd.h
  116. fetch-pack.c
  117. fetch.c
  118. fetch.h
  119. fsck-objects.c
  120. generate-cmdlist.sh
  121. git-add--interactive.perl
  122. git-am.sh
  123. git-applymbox.sh
  124. git-applypatch.sh
  125. git-archimport.perl
  126. git-bisect.sh
  127. git-checkout.sh
  128. git-clean.sh
  129. git-clone.sh
  130. git-commit.sh
  131. git-compat-util.h
  132. git-cvsexportcommit.perl
  133. git-cvsimport.perl
  134. git-cvsserver.perl
  135. git-fetch.sh
  136. git-gc.sh
  137. git-instaweb.sh
  138. git-lost-found.sh
  139. git-ls-remote.sh
  140. git-merge-octopus.sh
  141. git-merge-one-file.sh
  142. git-merge-ours.sh
  143. git-merge-resolve.sh
  144. git-merge-stupid.sh
  145. git-merge.sh
  146. git-p4import.py
  147. git-parse-remote.sh
  148. git-pull.sh
  149. git-quiltimport.sh
  150. git-rebase.sh
  151. git-relink.perl
  152. git-repack.sh
  153. git-request-pull.sh
  154. git-rerere.perl
  155. git-reset.sh
  156. git-resolve.sh
  157. git-revert.sh
  158. git-send-email.perl
  159. git-sh-setup.sh
  160. git-svn.perl
  161. git-svnimport.perl
  162. git-tag.sh
  163. git-verify-tag.sh
  164. GIT-VERSION-GEN
  165. git.c
  166. git.spec.in
  167. gitk
  168. grep.c
  169. grep.h
  170. hash-object.c
  171. help.c
  172. http-fetch.c
  173. http-push.c
  174. http.c
  175. http.h
  176. ident.c
  177. imap-send.c
  178. index-pack.c
  179. INSTALL
  180. interpolate.c
  181. interpolate.h
  182. list-objects.c
  183. list-objects.h
  184. local-fetch.c
  185. lockfile.c
  186. log-tree.c
  187. log-tree.h
  188. Makefile
  189. merge-base.c
  190. merge-file.c
  191. merge-index.c
  192. merge-recursive.c
  193. merge-tree.c
  194. mktag.c
  195. mktree.c
  196. object-refs.c
  197. object.c
  198. object.h
  199. pack-check.c
  200. pack-redundant.c
  201. pack.h
  202. pager.c
  203. patch-delta.c
  204. patch-id.c
  205. path-list.c
  206. path-list.h
  207. path.c
  208. peek-remote.c
  209. pkt-line.c
  210. pkt-line.h
  211. quote.c
  212. quote.h
  213. read-cache.c
  214. README
  215. receive-pack.c
  216. refs.c
  217. refs.h
  218. revision.c
  219. revision.h
  220. rsh.c
  221. rsh.h
  222. run-command.c
  223. run-command.h
  224. send-pack.c
  225. server-info.c
  226. setup.c
  227. sha1_file.c
  228. sha1_name.c
  229. shallow.c
  230. shell.c
  231. show-index.c
  232. sideband.c
  233. sideband.h
  234. ssh-fetch.c
  235. ssh-pull.c
  236. ssh-push.c
  237. ssh-upload.c
  238. strbuf.c
  239. strbuf.h
  240. tag.c
  241. tag.h
  242. tar.h
  243. test-date.c
  244. test-delta.c
  245. test-sha1.c
  246. test-sha1.sh
  247. trace.c
  248. tree-diff.c
  249. tree-walk.c
  250. tree-walk.h
  251. tree.c
  252. tree.h
  253. unpack-file.c
  254. unpack-trees.c
  255. unpack-trees.h
  256. update-server-info.c
  257. upload-pack.c
  258. usage.c
  259. utf8.c
  260. utf8.h
  261. var.c
  262. write_or_die.c
  263. wt-status.c
  264. wt-status.h
  265. xdiff-interface.c
  266. xdiff-interface.h