contributing.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. Contributing To Busybox
  2. =======================
  3. This document describes what you need to do to contribute to Busybox, where
  4. you can help, guidelines on testing, and how to submit a well-formed patch
  5. that is more likely to be accepted.
  6. The Busybox home page is at: http://busybox.net/
  7. Pre-Contribution Checklist
  8. --------------------------
  9. So you want to contribute to Busybox, eh? Great, wonderful, glad you want to
  10. help. However, before you dive in, headlong and hotfoot, there are some things
  11. you need to do:
  12. Checkout the Latest Code
  13. ~~~~~~~~~~~~~~~~~~~~~~~~
  14. This is a necessary first step. Please do not try to work with the last
  15. released version, as there is a good chance that somebody has already fixed
  16. the bug you found. Somebody might have even added the feature you had in mind.
  17. Don't make your work obsolete before you start!
  18. For information on how to check out Busybox development tree, please look at the
  19. following links:
  20. http://busybox.net/source.html
  21. Read the Mailing List
  22. ~~~~~~~~~~~~~~~~~~~~~
  23. No one is required to read the entire archives of the mailing list, but you
  24. should at least read up on what people have been talking about lately. If
  25. you've recently discovered a problem, chances are somebody else has too. If
  26. you're the first to discover a problem, post a message and let the rest of us
  27. know.
  28. Archives can be found here:
  29. http://busybox.net/lists/busybox/
  30. If you have a serious interest in Busybox, i.e., you are using it day-to-day or
  31. as part of an embedded project, it would be a good idea to join the mailing
  32. list.
  33. A web-based sign-up form can be found here:
  34. http://busybox.net/mailman/listinfo/busybox
  35. Coordinate with the Applet Maintainer
  36. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. Some (not all) of the applets in Busybox are "owned" by a maintainer who has
  38. put significant effort into it and is probably more familiar with it than
  39. others. To find the maintainer of an applet, look at the top of the .c file
  40. for a name following the word 'Copyright' or 'Written by' or 'Maintainer'.
  41. Before plunging ahead, it's a good idea to send a message to the mailing list
  42. that says: "Hey, I was thinking about adding the 'transmogrify' feature to the
  43. 'foo' applet. Would this be useful? Is anyone else working on it?" You might
  44. want to CC the maintainer (if any) with your question.
  45. Areas Where You Can Help
  46. ------------------------
  47. Busybox can always use improvement! If you're looking for ways to help, there
  48. are a variety of areas where you could help.
  49. What Busybox Doesn't Need
  50. ~~~~~~~~~~~~~~~~~~~~~~~~~
  51. Before listing the areas where you _can_ help, it's worthwhile to mention the
  52. areas where you shouldn't bother. While Busybox strives to be the "Swiss Army
  53. Knife" of embedded Linux, there are some applets that will not be accepted:
  54. - Any filesystem manipulation tools: Busybox is filesystem independent and
  55. we do not want to start adding mkfs/fsck tools for every (or any)
  56. filesystem under the sun. (fsck_minix.c and mkfs_minix.c are living on
  57. borrowed time.) There are far too many of these tools out there. Use
  58. the upstream version. Rationale: bugs in these tools can destroy
  59. vast amounts of data. Keeping up with filesystem format development
  60. is impractical (especially in the area of keeping fsck tool safe
  61. and up-to-date).
  62. - Any disk, device, or media-specific tools: Use the -utils or -tools package
  63. that was designed for your device; don't try to shoehorn them into Busybox.
  64. - Any architecture specific tools: Busybox is (or should be) architecture
  65. independent. Do not send us tools that cannot be used across multiple
  66. platforms / arches.
  67. Bug Reporting
  68. ~~~~~~~~~~~~~
  69. If you find bugs, please submit a detailed bug report to the busybox mailing
  70. list at busybox@busybox.net. A well-written bug report should include a
  71. transcript of a shell session that demonstrates the bad behavior and enables
  72. anyone else to duplicate the bug on their own machine. The following is such
  73. an example:
  74. To: busybox@busybox.net
  75. From: diligent@testing.linux.org
  76. Subject: /bin/date doesn't work
  77. Package: busybox
  78. Version: 1.00
  79. When I execute Busybox 'date' it produces unexpected results.
  80. With GNU date I get the following output:
  81. $ date
  82. Wed Mar 21 14:19:41 MST 2001
  83. But when I use BusyBox date I get this instead:
  84. $ date
  85. Illegal instruction
  86. I am using Debian unstable, kernel version 2.4.19-rmk1 on an Netwinder,
  87. and the latest uClibc from CVS.
  88. -Diligent
  89. Note the careful description and use of examples showing not only what BusyBox
  90. does, but also a counter example showing what an equivalent GNU app does. Bug
  91. reports lacking such detail may never be fixed... Thanks for understanding.
  92. Write Documentation
  93. ~~~~~~~~~~~~~~~~~~~
  94. Chances are, documentation in Busybox is either missing or needs improvement.
  95. Either way, help is welcome.
  96. Work is being done to automatically generate documentation from sources,
  97. especially from the usage.h file. If you want to correct the documentation,
  98. please make changes to the pre-generation parts, rather than the generated
  99. documentation. [More to come on this later...]
  100. It is preferred that modifications to documentation be submitted in patch
  101. format (more on this below), but we're a little more lenient when it comes to
  102. docs. You could, for example, just say "after the listing of the mount
  103. options, the following example would be helpful..."
  104. Consult Existing Sources
  105. ~~~~~~~~~~~~~~~~~~~~~~~~
  106. For a quick listing of "needs work" spots in the sources, cd into the Busybox
  107. directory and run the following:
  108. for i in TODO FIXME XXX; do find -name '*.[ch]'|xargs grep $i; done
  109. This will show all of the trouble spots or 'questionable' code. Pick a spot,
  110. any spot, these are all invitations for you to contribute.
  111. Add a New Applet
  112. ~~~~~~~~~~~~~~~~
  113. If you want to add a new applet to Busybox, we'd love to see it. However,
  114. before you write any code, please ask beforehand on the mailing list something
  115. like "Do you think applet 'foo' would be useful in Busybox?" or "Would you
  116. guys accept applet 'foo' into Busybox if I were to write it?" If the answer is
  117. "no" by the folks on the mailing list, then you've saved yourself some time.
  118. Conversely, you could get some positive responses from folks who might be
  119. interested in helping you implement it, or can recommend the best approach.
  120. Perhaps most importantly, this is your way of calling "dibs" on something and
  121. avoiding duplication of effort.
  122. Also, before you write a line of code, please read the 'new-applet-HOWTO.txt'
  123. file in the docs/ directory.
  124. Janitorial Work
  125. ~~~~~~~~~~~~~~~
  126. These are dirty jobs, but somebody's gotta do 'em.
  127. - Security audits:
  128. http://www.securityfocus.com/popups/forums/secprog/intro.shtml
  129. - Synthetic code removal: http://www.perl.com/pub/2000/06/commify.html - This
  130. is very Perl-specific, but the advice given in here applies equally well to
  131. C.
  132. - C library function use audits: Verifying that functions are being used
  133. properly (called with the right args), replacing unsafe library functions
  134. with safer versions, making sure return codes are being checked, etc.
  135. - Where appropriate, replace preprocessor defined macros and values with
  136. compile-time equivalents.
  137. - Style guide compliance. See: docs/style-guide.txt
  138. - Add testcases to tests/testcases.
  139. - Makefile improvements:
  140. http://www.canb.auug.org.au/~millerp/rmch/recu-make-cons-harm.html
  141. (I think the recursive problems are pretty much taken care of at this point, non?)
  142. - "Ten Commandments" compliance: (this is a "maybe", certainly not as
  143. important as any of the previous items.)
  144. http://www.lysator.liu.se/c/ten-commandments.html
  145. Other useful links:
  146. - the comp.lang.c FAQ: http://home.datacomm.ch/t_wolf/tw/c/index.html#Sources
  147. Submitting Patches To Busybox
  148. -----------------------------
  149. Here are some guidelines on how to submit a patch to Busybox.
  150. Making A Patch
  151. ~~~~~~~~~~~~~~
  152. If you've got anonymous Git access set up, making a patch is simple. Just make
  153. sure you're in the busybox/ directory and type:
  154. git diff -b -w > mychanges.patch
  155. You can send the resulting .patch file to the mailing list with a description
  156. of what it does. (But not before you test it! See the next section for some
  157. guidelines.) It is preferred that patches be sent as attachments, but it is
  158. not required.
  159. Also, feel free to help test other people's patches and reply to them with
  160. comments. You can apply a patch by saving it into your busybox/ directory and
  161. typing:
  162. patch -p1 < mychanges.patch
  163. Then you can recompile, see if it runs, test if it works as advertised, and
  164. post your findings to the mailing list.
  165. NOTE: Please do not include extraneous or irrelevant changes in your patches.
  166. Please do not try to "bundle" two patches together into one. Make single,
  167. discreet changes on a per-patch basis. Sometimes you need to make a patch that
  168. touches code in many places, but these kind of patches are rare and should be
  169. coordinated with a maintainer.
  170. Testing Guidelines
  171. ~~~~~~~~~~~~~~~~~~
  172. It's considered good form to test your new feature before you submit a patch
  173. to the mailing list, and especially before you push a change to Git. Here
  174. are some guidelines on how to test your changes.
  175. - Always test Busybox applets against GNU counterparts and make sure the
  176. behavior / output is identical between the two.
  177. - Try several different permutations and combinations of the features you're
  178. adding (i.e., different combinations of command-line switches) and make sure
  179. they all work; make sure one feature does not interfere with another.
  180. - Make sure you test compiling against the source both with the feature
  181. turned on and turned off in Config.h and make sure Busybox compiles cleanly
  182. both ways.
  183. - Run the multibuild.pl script in the tests directory and make sure
  184. everything checks out OK. (Do this from within the busybox/ directory by
  185. typing: 'tests/multibuild.pl'.)
  186. Making Sure Your Patch Doesn't Get Lost
  187. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  188. If you don't want your patch to be lost or forgotten, send it to the busybox
  189. mailing list with a subject line something like this:
  190. [PATCH] - Adds "transmogrify" feature to "foo"
  191. In the body, you should have a pseudo-header that looks like the following:
  192. Package: busybox
  193. Version: v1.01pre (or whatever the current version is)
  194. Severity: wishlist
  195. The remainder of the body should read along these lines:
  196. This patch adds the "transmogrify" feature to the "foo" applet. I have
  197. tested this on [arch] system(s) and it works. I have tested it against the
  198. GNU counterparts and the outputs are identical. I have run the scripts in
  199. the 'tests' directory and nothing breaks.
  200. Improving Your Chances of Patch Acceptance
  201. ------------------------------------------
  202. Even after you send a brilliant patch to the mailing list, sometimes it can go
  203. unnoticed, un-replied-to, and sometimes (sigh) even lost. This is an
  204. unfortunate fact of life, but there are steps you can take to help your patch
  205. get noticed and convince a maintainer that it should be added:
  206. Be Succinct
  207. ~~~~~~~~~~~
  208. A patch that includes small, isolated, obvious changes is more likely to be
  209. accepted than a patch that touches code in lots of different places or makes
  210. sweeping, dubious changes.
  211. Back It Up
  212. ~~~~~~~~~~
  213. Hard facts on why your patch is better than the existing code will go a long
  214. way toward convincing maintainers that your patch should be included.
  215. Specifically, patches are more likely to be accepted if they are provably more
  216. correct, smaller, faster, simpler, or more maintainable than the existing
  217. code.
  218. Conversely, any patch that is supported with nothing more than "I think this
  219. would be cool" or "this patch is good because I say it is and I've got a Phd
  220. in Computer Science" will likely be ignored.
  221. Follow The Style Guide
  222. ~~~~~~~~~~~~~~~~~~~~~~
  223. It's considered good form to abide by the established coding style used in a
  224. project; Busybox is no exception. We have gone so far as to delineate the
  225. "elements of Busybox style" in the file docs/style-guide.txt. Please follow
  226. them.
  227. Work With Someone Else
  228. ~~~~~~~~~~~~~~~~~~~~~~
  229. Working on a patch in isolation is less effective than working with someone
  230. else for a variety of reasons. If another Busybox user is interested in what
  231. you're doing, then it's two (or more) voices instead of one that can petition
  232. for inclusion of the patch. You'll also have more people that can test your
  233. changes, or even offer suggestions on better approaches you could take.
  234. Getting other folks interested follows as a natural course if you've received
  235. responses from queries to applet maintainer or positive responses from folks
  236. on the mailing list.
  237. We've made strident efforts to put a useful "collaboration" infrastructure in
  238. place in the form of mailing lists, the bug tracking system, and Git. Please
  239. use these resources.
  240. Send Patches to the Bug Tracking System
  241. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  242. This was mentioned above in the "Making Sure Your Patch Doesn't Get Lost"
  243. section, but it is worth mentioning again. A patch sent to the mailing list
  244. might be unnoticed and forgotten. A patch sent to the bug tracking system will
  245. be stored and closely connected to the bug it fixes.
  246. Be Polite
  247. ~~~~~~~~~
  248. The old saying "You'll catch more flies with honey than you will with vinegar"
  249. applies when submitting patches to the mailing list for approval. The way you
  250. present your patch is sometimes just as important as the actual patch itself
  251. (if not more so). Being rude to the maintainers is not an effective way to
  252. convince them that your patch should be included; it will likely have the
  253. opposite effect.
  254. Pushing Changes to Git
  255. ----------------------
  256. If you submit several patches that demonstrate that you are a skilled and wise
  257. coder, you may be invited to become a committer, thus enabling you to push
  258. changes directly to Git. This is nice because you don't have to wait for
  259. someone else to push your change for you, you can just do it yourself.
  260. But note that this is a privilege that comes with some responsibilities. You
  261. should test your changes before you push them. You should also talk to an
  262. applet maintainer before you make any kind of sweeping changes to somebody
  263. else's code. Big changes should still go to the mailing list first. Remember,
  264. being wise, polite, and discreet is more important than being clever.
  265. For more information on Git push access, see:
  266. http://busybox.net/developer.html
  267. When To Push
  268. ~~~~~~~~~~~~
  269. Generally, you should feel free to push a change if:
  270. - Your changes are small and don't touch many files
  271. - You are fixing a bug
  272. - Somebody has told you that it's okay
  273. - It's obviously the Right Thing
  274. The more of the above are true, the better it is to just push a change
  275. directly to Git.
  276. When Not To Push
  277. ~~~~~~~~~~~~~~~~
  278. Even if you have push access, you should probably still post a patch to the
  279. mailing list if:
  280. - Your changes are broad and touch many different files
  281. - You are adding a feature
  282. - Your changes are speculative or experimental (i.e., trying a new algorithm)
  283. - You are not the maintainer and your changes make the maintainer cringe
  284. The more of the above are true, the better it is to post a patch to the
  285. mailing list instead of pushing.
  286. Final Words
  287. -----------
  288. If all of this seems complicated, don't panic, it's really not that tough. If
  289. you're having difficulty following some of the steps outlined in this
  290. document don't worry, the folks on the Busybox mailing list are a fairly
  291. good-natured bunch and will work with you to help get your patches into shape
  292. or help you make contributions.