docs: Add supported versions and fix-backport policy
[lttng-tools.git] / CONTRIBUTING.md
CommitLineData
93794bcc
PP
1# LTTng-tools contributor's guide
2
3Being an open source project, the LTTng-tools project welcomes
4contributions from anyone. This guide walks you through the process
5of contributing a patch to LTTng-tools.
6
7
8## Getting the source code
9
10The LTTng-tools project uses [Git](https://git-scm.com/) for version
11control. The upstream Git repository URL is:
12
13 git://git.lttng.org/lttng-tools.git
14
15
16## Coding standard
17
d17cc1f3 18See CodingStyle for guidelines style and design guidelines.
93794bcc 19
9f263671
KS
20Although the LTTng-tools code base is primarily written in C++, it does
21contain C, shell, and Python code as well. There is no official coding
93794bcc
PP
22standard for these languages. However, using a style consistent with the
23rest of the code written in that language is strongly encouraged.
24
25
26## Creating and sending a patch
27
8d82bb77
KS
28LTTng-tools's development flow is primarily based on
29[Gerrit Code Review](https://review.lttng.org), although we also accept
30e-mail based patch series on the
31[`lttng-dev` mailing list](https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev)
32and pull requests on our [GitHub mirror](https://github.com/lttng/lttng-tools).
33If you're going to create GitHub pull requests, make sure you still follow the
93794bcc
PP
34guidelines below.
35
8d82bb77
KS
36The mailing list is also used to share and comment on
37<abbr title="Request for Comments">RFC</abbr>s and answer
93794bcc
PP
38user questions.
39
17f013d1
KS
40A template commit messsage is available below, and as a file that you may
41configure your local check out to use:
42
43 git config commit.template .commit_template
44
8d82bb77
KS
45Once your changes have been comitted to your local branch, you may use the
46[git-review](https://opendev.org/opendev/git-review) plugin to submit them
47directly to [Gerrit](https://review.lttng.org) using the following command:
48
49 git review
50
51Please note that you will need to create an account on [Gerrit](https://review.lttng.org)
52and add an SSH public key.
53
54For e-mail based patches you may use Git's
55[`format-patch`](https://git-scm.com/docs/git-format-patch) command
93794bcc
PP
56to generate a patch file. The following command line generates a
57patch from the latest commit:
58
59 git format-patch -N1 -s --subject-prefix="PATCH lttng-tools"
60
61The custom `PATCH lttng-tools` subject prefix is mandatory when
62submitting patches that apply to the LTTng-tools project.
63
64The patch's subject (the commit message's first line) should:
65
20095472
JG
66 * Begin with an uppercase letter.
67 * Be written in the present tense.
68 * _Not_ exceed 72 characters in length.
69 * _Not_ end with a period.
93794bcc 70
a7a35430
JG
71In the case of bug fixes, the patch's subject must be prefixed with
72`Fix:` and a suitable sub-system name. For instance, a patch
73addressing a bug in the session daemon should start with `Fix:
74sessiond:`. Patches targeting shared code can either use the namespace
75of the interface or of the internal library, whichever is more
76precise.
77
78A non-exhaustive list of common sub-system prefixes follows:
79
80 * `relayd` (relay daemon).
81 * `sessiond` (session daemon).
82 * `lttng` (LTTng CLI client).
83 * `ust-consumerd` (user space consumer daemon).
84 * `kernel-consumerd` (kernel space consumer daemon).
85 * `consumerd` (common consumer daemon).
86 * `common` (internal `libcommon`).
87 * `trace-chunk` (internal `lttng_trace_chunk_*` interface).
88 * `lttng-ctl` (`liblttng-ctl` library).
89 * `mi` (LTTng client's machine interface).
90
91When possible, the commit title should describe the issue _as
92observed_ and not the underlying cause. For instance, prefer `Fix:
93sessiond: hang on SIGTERM after session rotation` to `Fix: sessiond:
94unchecked status on exit`.
95
96The commit message's body must be as detailed as possible and explain
97the reasons behind the proposed change. Keep in mind that this message
98will be read in a number of years and must still be clear. Any related
93794bcc
PP
99[bug report(s)](https://bugs.lttng.org/projects/lttng-tools/issues)
100should be mentioned at the end of the message using the `#123` format,
101where `123` is the bug number:
102
103 * Use `Refs: #123` if the patch is related to bug 123, but does not
104 fix it yet.
105 * Use `Fixes: #123` to signify that this patch fixes the bug.
106
a7a35430
JG
107In the case of bug fixes, the following structure must be used:
108
109 * Observed issue
110 * Cause
111 * Solution
112 * **Optional**: Known drawbacks
113
114A short commit message can be used when submitting typo fixes or minor
115cleanups that don't introduce behaviour changes.
116
117When submitting a patch that affects existing code, implement changes
118to the existing code as prelude patches in a patch series. Explain why
119those changes are needed and how they make follow-up changes
120easier/possible.
121
93794bcc
PP
122Make sure to **sign-off** your submitted patches (the `-s` argument to
123Git's `commit` and `format-patch` commands).
124
125Here's a complete example:
126
127~~~ text
a7a35430
JG
128Fix: relayd: missing thingy in the doodad folder on error
129
130Observed issue
131==============
132After a communication error, the relay daemon will not produce
133a thingy in the doodad folder. This results in the knickknack
134baring the foo.
135
136Steps to reproduce (list of commands or narrative description).
137
138Cause
139=====
140The thingy_do_the_doodad() callback is only invoked when
141the thread responsible for receiving messages and dispatching
142them to the correct actors encounters an emoji.
143
144However, an emoji is not guaranteed to be present in the ELF
145section header [1].
146
147Solution
148========
149Flushing the doodad on every reception of a thingo ensures that
150the thingy is present in the doodad folder even if a communication
151error occurs.
152
153Known drawbacks
154===============
155Flushing the doodad too often may spam the widget and result in
156degradation of the gizmo. This doesn't matter right now since
157it happens exactly once per blue moon.
158
159If this becomes a serious issue, we could machine learn the MVP
160through the big O terminal.
161
162References
163==========
164[1] https://www.thedocs.com/elf/proving-my-point-unambiguously.aspx
93794bcc
PP
165
166Fixes: #321
167Refs: #456
168Refs: #1987
169
170Signed-off-by: Jeanne Mance <jmeance@lttng.org>
171~~~
172
173Please note that patches should be **as focused as possible**. Do not,
174for instance, fix a bug and correct the indentation of an unrelated
175block of code as part of the same patch.
176
177The project contains a script, [`extras/checkpatch.pl`](extras/checkpatch.pl),
178that performs a number of checks on a patch to ensure it is ready for
179submission. Run this script on your patch and correct any reported
180errors before posting it to the mailing list:
181
182 extras/checkpatch.pl --no-tree 0001-Fix...patch
183
184Once you are confident your patch meets the required guidelines,
185you may use Git's [`send-email`](https://git-scm.com/docs/git-send-email)
186command to send your patch to the mailing list:
187
188 git send-email --suppress-cc=self --to lttng-dev@lists.lttng.org *.patch
189
190Make sure you are
191[subscribed](http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev)
192to the mailing list to follow and take part in discussions about your
193changes. You may join the file to an email as an attachment if you can't
194send the patch directly using <code>git&nbsp;send&#8209;email</code>.
195
196
197## Reviews
198
199Once your patch has been posted to the mailing list or as a GitHub
200pull request, other contributors may propose modifications.
201This is completely normal. This collaborative code review is an integral
202part of the open source development process in general and LTTng-tools
203makes no exception.
204
205Keep in mind that reviewing patches is a time-consuming process and,
206as such, may not be done right away. The delays may be affected by the
207current release cycle phase and the complexity of the proposed changes.
208If you think your patch might have been forgotten, please mention it on
209the [`#lttng`](irc://irc.oftc.net/lttng) IRC channel rather than
210resubmitting.
211
212
213## Release cycle
214
215The LTTng-tools project follows a release cycle that alternates between
216development and release candidate (RC) phases. The master branch is
217feature-frozen during RC phases: only bug fixes are accepted during
218this period. However, patches adding new functionality may still be
219submitted and reviewed during the RC. The upcoming features and release
220dates are posted in a monthly digest on the mailing list.
This page took 0.051791 seconds and 4 git commands to generate.