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