1 # LTTng-tools contributor's guide
3 Being an open source project, the LTTng-tools project welcomes
4 contributions from anyone. This guide walks you through the process
5 of contributing a patch to LTTng-tools.
8 ## Getting the source code
10 The LTTng-tools project uses [Git](https://git-scm.com/) for version
11 control. The upstream Git repository URL is:
13 git://git.lttng.org/lttng-tools.git
19 [Linux kernel coding style](http://www.kernel.org/doc/Documentation/CodingStyle)
20 with one addition: single-line `if`/`for`/`while` statements must be
36 Although the LTTng-tools code base is primarily written in C, it does
37 contain shell, Perl, and Python code as well. There is no official coding
38 standard for these languages. However, using a style consistent with the
39 rest of the code written in that language is strongly encouraged.
42 ## Creating and sending a patch
44 LTTng-tools's development flow is primarily email-based, although we
45 also accept pull requests on our
46 [GitHub mirror](https://github.com/lttng/lttng-tools) and
47 [Gerrit Code Review](https://review.lttng.org). If you're going
48 to create GitHub pull requests, make sure you still follow the
51 Like a lot of open source projects, patches are submitted and reviewed
52 on its development mailing list,
53 [`lttng-dev`](http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev)
54 (`lttng-dev@lists.lttng.org`). The mailing list is also used to share
55 and comment on <abbr title="Request for Comments">RFC</abbr>s and answer
58 Once your changes have been committed to your local branch, you may use
59 Git's [`format-patch`](https://git-scm.com/docs/git-format-patch) command
60 to generate a patch file. The following command line generates a
61 patch from the latest commit:
63 git format-patch -N1 -s --subject-prefix="PATCH lttng-tools"
65 The custom `PATCH lttng-tools` subject prefix is mandatory when
66 submitting patches that apply to the LTTng-tools project.
68 The patch's subject (the commit message's first line) should:
70 * Begin with an uppercase letter.
71 * Be written in the present tense.
72 * _Not_ exceed 72 characters in length.
73 * _Not_ end with a period.
75 In the case of bug fixes, the patch's subject must be prefixed with
76 `Fix:` and a suitable sub-system name. For instance, a patch
77 addressing a bug in the session daemon should start with `Fix:
78 sessiond:`. Patches targeting shared code can either use the namespace
79 of the interface or of the internal library, whichever is more
82 A non-exhaustive list of common sub-system prefixes follows:
84 * `relayd` (relay daemon).
85 * `sessiond` (session daemon).
86 * `lttng` (LTTng CLI client).
87 * `ust-consumerd` (user space consumer daemon).
88 * `kernel-consumerd` (kernel space consumer daemon).
89 * `consumerd` (common consumer daemon).
90 * `common` (internal `libcommon`).
91 * `trace-chunk` (internal `lttng_trace_chunk_*` interface).
92 * `lttng-ctl` (`liblttng-ctl` library).
93 * `mi` (LTTng client's machine interface).
95 When possible, the commit title should describe the issue _as
96 observed_ and not the underlying cause. For instance, prefer `Fix:
97 sessiond: hang on SIGTERM after session rotation` to `Fix: sessiond:
98 unchecked status on exit`.
100 The commit message's body must be as detailed as possible and explain
101 the reasons behind the proposed change. Keep in mind that this message
102 will be read in a number of years and must still be clear. Any related
103 [bug report(s)](https://bugs.lttng.org/projects/lttng-tools/issues)
104 should be mentioned at the end of the message using the `#123` format,
105 where `123` is the bug number:
107 * Use `Refs: #123` if the patch is related to bug 123, but does not
109 * Use `Fixes: #123` to signify that this patch fixes the bug.
111 In the case of bug fixes, the following structure must be used:
116 * **Optional**: Known drawbacks
118 A short commit message can be used when submitting typo fixes or minor
119 cleanups that don't introduce behaviour changes.
121 When submitting a patch that affects existing code, implement changes
122 to the existing code as prelude patches in a patch series. Explain why
123 those changes are needed and how they make follow-up changes
126 Make sure to **sign-off** your submitted patches (the `-s` argument to
127 Git's `commit` and `format-patch` commands).
129 Here's a complete example:
132 Fix: relayd: missing thingy in the doodad folder on error
136 After a communication error, the relay daemon will not produce
137 a thingy in the doodad folder. This results in the knickknack
140 Steps to reproduce (list of commands or narrative description).
144 The thingy_do_the_doodad() callback is only invoked when
145 the thread responsible for receiving messages and dispatching
146 them to the correct actors encounters an emoji.
148 However, an emoji is not guaranteed to be present in the ELF
153 Flushing the doodad on every reception of a thingo ensures that
154 the thingy is present in the doodad folder even if a communication
159 Flushing the doodad too often may spam the widget and result in
160 degradation of the gizmo. This doesn't matter right now since
161 it happens exactly once per blue moon.
163 If this becomes a serious issue, we could machine learn the MVP
164 through the big O terminal.
168 [1] https://www.thedocs.com/elf/proving-my-point-unambiguously.aspx
174 Signed-off-by: Jeanne Mance <jmeance@lttng.org>
177 Please note that patches should be **as focused as possible**. Do not,
178 for instance, fix a bug and correct the indentation of an unrelated
179 block of code as part of the same patch.
181 The project contains a script, [`extras/checkpatch.pl`](extras/checkpatch.pl),
182 that performs a number of checks on a patch to ensure it is ready for
183 submission. Run this script on your patch and correct any reported
184 errors before posting it to the mailing list:
186 extras/checkpatch.pl --no-tree 0001-Fix...patch
188 Once you are confident your patch meets the required guidelines,
189 you may use Git's [`send-email`](https://git-scm.com/docs/git-send-email)
190 command to send your patch to the mailing list:
192 git send-email --suppress-cc=self --to lttng-dev@lists.lttng.org *.patch
195 [subscribed](http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev)
196 to the mailing list to follow and take part in discussions about your
197 changes. You may join the file to an email as an attachment if you can't
198 send the patch directly using <code>git send‑email</code>.
203 Once your patch has been posted to the mailing list or as a GitHub
204 pull request, other contributors may propose modifications.
205 This is completely normal. This collaborative code review is an integral
206 part of the open source development process in general and LTTng-tools
209 Keep in mind that reviewing patches is a time-consuming process and,
210 as such, may not be done right away. The delays may be affected by the
211 current release cycle phase and the complexity of the proposed changes.
212 If you think your patch might have been forgotten, please mention it on
213 the [`#lttng`](irc://irc.oftc.net/lttng) IRC channel rather than
219 The LTTng-tools project follows a release cycle that alternates between
220 development and release candidate (RC) phases. The master branch is
221 feature-frozen during RC phases: only bug fixes are accepted during
222 this period. However, patches adding new functionality may still be
223 submitted and reviewed during the RC. The upcoming features and release
224 dates are posted in a monthly digest on the mailing list.