GettingStarted.txt 7.6 KB

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