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