GettingStarted.txt 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. (DRAFT)
  2. Getting started in Tor development
  3. ==================================
  4. Congratulations! You've found this file, and you're reading it! This
  5. means that you might be interested in getting started in developing Tor.
  6. (This guide is just about Tor itself--the small network program at the
  7. heart of the Tor network--and not about all the other programs in the
  8. whole Tor ecosystem.)
  9. If you are looking for a more bare-bones, less user-friendly information
  10. dump of important information, you might like reading doc/HACKING
  11. instead. You should probably read it before you write your first patch.
  12. Required background
  13. -------------------
  14. First, I'm going to assume that you can build Tor from source, and that
  15. you know enough of the C language to read and write it. (See the README
  16. file that comes with the Tor source for more information on building it,
  17. and any high-quality guide to C for information on programming.)
  18. I'm also going to assume that you know a little bit about how to use
  19. Git, or that you're able to fillow one of the several excellent guides
  20. at http://git-scm.org to learn.
  21. Most Tor developers develop using some Unix-based system, such as Linux,
  22. BSD, or OSX. It's okay to develop on Windows if you want, but you're
  23. going to have a more difficult time.
  24. Getting your first patch into Tor
  25. ---------------------------------
  26. Once you've reached this point, here's what you need to know.
  27. 1) Get the source.
  28. We keep our source under version control in Git. To get the latest
  29. version, run
  30. git clone https://git.torproject.org/git/tor
  31. This will give you a checkout of the master branch. If you're
  32. going to fix a bug that appears in a stable version, check out the
  33. appropriate "maint" branch, as in:
  34. git checkout maint-0.2.7
  35. 2) Find your way around the source
  36. Our overall code structure is explained in the "torguts" documents,
  37. currently at
  38. git clone https://git.torproject.org/user/nickm/torguts.git
  39. Find a part of the code that looks interesting to you, and start
  40. looking around it to see how it fits together!
  41. We do some unusual things in our codebase. Our testing-related
  42. practices and kludges are explained in doc/WritingTests.txt.
  43. If you see something that doesn't make sense, we love to get
  44. questions!
  45. 3) Find something cool to hack on.
  46. You may already have a good idea of what you'd like to work on, or
  47. you might be looking for a way to contribute.
  48. Many people have gotten started by looking for an area where they
  49. personally felt Tor was underperforming, and investigating ways to
  50. fix it. If you're looking for ideas, you can head to our bug
  51. tracker at trac.torproject.org and look for tickets that have
  52. received the "easy" tag: these are ones that developers think would
  53. be pretty simple for a new person to work on. For a bigger
  54. challenge, you might want to look for tickets with the "lorax"
  55. keyword: these are tickets that the developers think might be a
  56. good idea to build, but which we have no time to work on any time
  57. soon.
  58. Or you might find another open ticket that piques your
  59. interest. It's all fine!
  60. For your first patch, it is probably NOT a good idea to make
  61. something huge or invasive. In particular, you should probably
  62. avoid:
  63. * Major changes spread across many parts of the codebase.
  64. * Major changes to programming practice or coding style.
  65. * Huge new features or protocol changes.
  66. 4) Meet the developers!
  67. We discuss stuff on the tor-dev mailing list and on the #tor-dev
  68. IRC channel on OFTC. We're generally friendly and approachable,
  69. and we like to talk about how Tor fits together. If we have ideas
  70. about how something should be implemented, we'll be happy to share
  71. them.
  72. We currently have a patch workshop at least once a week, where
  73. people share patches they've made and discuss how to make them
  74. better. The time might change in the future, but generally,
  75. there's no bad time to talk, and ask us about patch ideas.
  76. 5) Do you need to write a design proposal?
  77. If your idea is very large, or it will require a change to Tor's
  78. protocols, there needs to be a written design proposal before it
  79. can be merged. (We use this process to manage changes in the
  80. protocols.) To write one, see the instructions at
  81. https://gitweb.torproject.org/torspec.git/tree/proposals/001-process.txt
  82. . If you'd like help writing a proposal, just ask! We're happy to
  83. help out with good ideas.
  84. You might also like to look around the rest of that directory, to
  85. see more about open and past proposed changes to Tor's behavior.
  86. 6) Writing your patch
  87. As you write your code, you'll probably want it to fit in with the
  88. standards of the rest of the Tor codebase so it will be easy for us
  89. to review and merge. You can learn our coding standards in
  90. doc/HACKING.
  91. If your patch is large and/or is divided into multiple logical
  92. components, remember to divide it into a series of Git commits. A
  93. series of small changes is much easier to review than one big lump.
  94. 7) Testing your patch
  95. We prefer that all new or modified code have unit tests for it to
  96. ensure that it runs correctly. Also, all code should actually be
  97. _run_ by somebody, to make sure it works.
  98. See doc/WritingTests.txt for more information on how we test things
  99. in Tor. If you'd like any help writing tests, just ask! We're
  100. glad to help out.
  101. 8) Submitting your patch
  102. We review patches through tickets on our bugtracker at
  103. trac.torproject.org. You can either upload your patches there, or
  104. put them at a public git repository somewhere we can fetch them
  105. (like github or bitbucket) and then paste a link on the appropriate
  106. trac ticket.
  107. Once your patches are available, write a short explanation of what
  108. you've done on trac, and then change the status of the ticket to
  109. needs_review.
  110. 9) Review, Revision, and Merge
  111. With any luck, somebody will review your patch soon! If not, you
  112. can ask on the IRC channel; sometimes we get really busy and take
  113. longer than we should. But don't let us slow you down: you're the
  114. one who's offering help here, and we should respect your time and
  115. contributions.
  116. When your patch is reviewed, one of these things will happen:
  117. * The reviewer will say "looks good to me" and your
  118. patch will get merged right into Tor. [Assuming we're not
  119. in the middle of a code-freeze window. If the codebase is
  120. frozen, your patch will go into the next release series.]
  121. * OR the reviewer will say "looks good, just needs some small
  122. changes!" And then the reviewer will make those changes,
  123. and merge the modified patch into Tor.
  124. * OR the reviewer will say "Here are some questions and
  125. comments," followed by a bunch of stuff that the reviewer
  126. thinks should change in your code, or questions that the
  127. reviewer has.
  128. At this point, you might want to make the requested changes
  129. yourself, and comment on the trac ticket once you have done
  130. so. Or if you disagree with any of the comments, you should
  131. say so! And if you won't have time to make some of the
  132. changes, you should say that too, so that other developers
  133. will be able to pick up the unfinished portion
  134. Congratulations! You have now written your first patch, and gotten
  135. it integrated into mainline Tor.
  136. Where do I go from here?
  137. ------------------------
  138. doc/HACKING
  139. doc/WritingTests.txt
  140. torguts.git
  141. torspec.git
  142. The design paper
  143. freehaven.net/anonbib
  144. XXXX describe these and add links.