git-svn: use POSIX::sigprocmask to block signals

In order to maintain consistency of the database mapping svn revision
numbers to git commit ids, rev_map_set() defers signal processing until
it's finished with an append transaction.[*]

The conventional way to achieve this is through sigprocmask(), which is
available in perl in the standard POSIX module.

This is implemented by this patch.  One important consequence of it is
that the signal handlers won't be unconditionally set to SIG_DFL anymore
upon the first invocation of rev_map_set() as they used to.  As a
result, the signals ignored by git-svn parent will remain ignored;
otherwise the behavior remains the same.

This patch paves the way to ignoring SIGPIPE throughout git-svn which
will be done in the followup patch.

[*] Deferring signals is not enough to ensure the database consistency:
the program may die on SIGKILL or power loss, run out of disk space,
etc.  However that's a separate issue that this patch doesn't address.

Signed-off-by: Roman Kagan <rkagan@mail.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
1 file changed
tree: 23414d414b67cb893a94569ab59d4355cbe1d6e0
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. mergetools/
  11. perl/
  12. po/
  13. ppc/
  14. t/
  15. templates/
  16. vcs-svn/
  17. xdiff/
  18. .gitattributes
  19. .gitignore
  20. .mailmap
  21. abspath.c
  22. aclocal.m4
  23. advice.c
  24. advice.h
  25. alias.c
  26. alloc.c
  27. archive-tar.c
  28. archive-zip.c
  29. archive.c
  30. archive.h
  31. argv-array.c
  32. argv-array.h
  33. attr.c
  34. attr.h
  35. base85.c
  36. bisect.c
  37. bisect.h
  38. blob.c
  39. blob.h
  40. branch.c
  41. branch.h
  42. builtin.h
  43. bulk-checkin.c
  44. bulk-checkin.h
  45. bundle.c
  46. bundle.h
  47. cache-tree.c
  48. cache-tree.h
  49. cache.h
  50. check-builtins.sh
  51. check-racy.c
  52. check_bindir
  53. color.c
  54. color.h
  55. combine-diff.c
  56. command-list.txt
  57. commit.c
  58. commit.h
  59. config.c
  60. config.mak.in
  61. configure.ac
  62. connect.c
  63. connected.c
  64. connected.h
  65. convert.c
  66. convert.h
  67. copy.c
  68. COPYING
  69. credential-cache--daemon.c
  70. credential-cache.c
  71. credential-store.c
  72. credential.c
  73. credential.h
  74. csum-file.c
  75. csum-file.h
  76. ctype.c
  77. daemon.c
  78. date.c
  79. decorate.c
  80. decorate.h
  81. delta.h
  82. diff-delta.c
  83. diff-lib.c
  84. diff-no-index.c
  85. diff.c
  86. diff.h
  87. diffcore-break.c
  88. diffcore-delta.c
  89. diffcore-order.c
  90. diffcore-pickaxe.c
  91. diffcore-rename.c
  92. diffcore.h
  93. dir.c
  94. dir.h
  95. editor.c
  96. entry.c
  97. environment.c
  98. exec_cmd.c
  99. exec_cmd.h
  100. fast-import.c
  101. fetch-pack.h
  102. fixup-builtins
  103. fmt-merge-msg.h
  104. fsck.c
  105. fsck.h
  106. generate-cmdlist.sh
  107. gettext.c
  108. gettext.h
  109. git-add--interactive.perl
  110. git-am.sh
  111. git-archimport.perl
  112. git-bisect.sh
  113. git-compat-util.h
  114. git-cvsexportcommit.perl
  115. git-cvsimport.perl
  116. git-cvsserver.perl
  117. git-difftool--helper.sh
  118. git-difftool.perl
  119. git-filter-branch.sh
  120. git-instaweb.sh
  121. git-lost-found.sh
  122. git-merge-octopus.sh
  123. git-merge-one-file.sh
  124. git-merge-resolve.sh
  125. git-mergetool--lib.sh
  126. git-mergetool.sh
  127. git-p4.py
  128. git-parse-remote.sh
  129. git-pull.sh
  130. git-quiltimport.sh
  131. git-rebase--am.sh
  132. git-rebase--interactive.sh
  133. git-rebase--merge.sh
  134. git-rebase.sh
  135. git-relink.perl
  136. git-remote-testgit.py
  137. git-repack.sh
  138. git-request-pull.sh
  139. git-send-email.perl
  140. git-sh-i18n.sh
  141. git-sh-setup.sh
  142. git-stash.sh
  143. git-submodule.sh
  144. git-svn.perl
  145. GIT-VERSION-GEN
  146. git-web--browse.sh
  147. git.c
  148. git.spec.in
  149. gpg-interface.c
  150. gpg-interface.h
  151. graph.c
  152. graph.h
  153. grep.c
  154. grep.h
  155. hash.c
  156. hash.h
  157. help.c
  158. help.h
  159. hex.c
  160. http-backend.c
  161. http-fetch.c
  162. http-push.c
  163. http-walker.c
  164. http.c
  165. http.h
  166. ident.c
  167. imap-send.c
  168. INSTALL
  169. kwset.c
  170. kwset.h
  171. levenshtein.c
  172. levenshtein.h
  173. LGPL-2.1
  174. list-objects.c
  175. list-objects.h
  176. ll-merge.c
  177. ll-merge.h
  178. lockfile.c
  179. log-tree.c
  180. log-tree.h
  181. mailmap.c
  182. mailmap.h
  183. Makefile
  184. match-trees.c
  185. merge-file.c
  186. merge-file.h
  187. merge-recursive.c
  188. merge-recursive.h
  189. mergesort.c
  190. mergesort.h
  191. name-hash.c
  192. notes-cache.c
  193. notes-cache.h
  194. notes-merge.c
  195. notes-merge.h
  196. notes.c
  197. notes.h
  198. object.c
  199. object.h
  200. pack-check.c
  201. pack-refs.c
  202. pack-refs.h
  203. pack-revindex.c
  204. pack-revindex.h
  205. pack-write.c
  206. pack.h
  207. pager.c
  208. parse-options-cb.c
  209. parse-options.c
  210. parse-options.h
  211. patch-delta.c
  212. patch-ids.c
  213. patch-ids.h
  214. path.c
  215. pkt-line.c
  216. pkt-line.h
  217. preload-index.c
  218. pretty.c
  219. progress.c
  220. progress.h
  221. prompt.c
  222. prompt.h
  223. quote.c
  224. quote.h
  225. reachable.c
  226. reachable.h
  227. read-cache.c
  228. README
  229. reflog-walk.c
  230. reflog-walk.h
  231. refs.c
  232. refs.h
  233. remote-curl.c
  234. remote.c
  235. remote.h
  236. replace_object.c
  237. rerere.c
  238. rerere.h
  239. resolve-undo.c
  240. resolve-undo.h
  241. revision.c
  242. revision.h
  243. run-command.c
  244. run-command.h
  245. send-pack.h
  246. sequencer.c
  247. sequencer.h
  248. server-info.c
  249. setup.c
  250. sh-i18n--envsubst.c
  251. sha1-array.c
  252. sha1-array.h
  253. sha1-lookup.c
  254. sha1-lookup.h
  255. sha1_file.c
  256. sha1_name.c
  257. shallow.c
  258. shell.c
  259. shortlog.h
  260. show-index.c
  261. sideband.c
  262. sideband.h
  263. sigchain.c
  264. sigchain.h
  265. strbuf.c
  266. strbuf.h
  267. streaming.c
  268. streaming.h
  269. string-list.c
  270. string-list.h
  271. submodule.c
  272. submodule.h
  273. symlinks.c
  274. tag.c
  275. tag.h
  276. tar.h
  277. test-chmtime.c
  278. test-credential.c
  279. test-ctype.c
  280. test-date.c
  281. test-delta.c
  282. test-dump-cache-tree.c
  283. test-genrandom.c
  284. test-index-version.c
  285. test-line-buffer.c
  286. test-match-trees.c
  287. test-mergesort.c
  288. test-mktemp.c
  289. test-parse-options.c
  290. test-path-utils.c
  291. test-run-command.c
  292. test-scrap-cache-tree.c
  293. test-sha1.c
  294. test-sha1.sh
  295. test-sigchain.c
  296. test-subprocess.c
  297. test-svn-fe.c
  298. thread-utils.c
  299. thread-utils.h
  300. trace.c
  301. transport-helper.c
  302. transport.c
  303. transport.h
  304. tree-diff.c
  305. tree-walk.c
  306. tree-walk.h
  307. tree.c
  308. tree.h
  309. unimplemented.sh
  310. unix-socket.c
  311. unix-socket.h
  312. unpack-trees.c
  313. unpack-trees.h
  314. upload-pack.c
  315. url.c
  316. url.h
  317. usage.c
  318. userdiff.c
  319. userdiff.h
  320. utf8.c
  321. utf8.h
  322. walker.c
  323. walker.h
  324. wrap-for-bin.sh
  325. wrapper.c
  326. write_or_die.c
  327. ws.c
  328. wt-status.c
  329. wt-status.h
  330. xdiff-interface.c
  331. xdiff-interface.h
  332. zlib.c