1 The guidelines in this file are the ideals; it's better to send a
2 not-fully-following-guidelines patch than no patch at all, though. We
3 can always polish it up.
8 The D-Bus mailing list is dbus@lists.freedesktop.org; discussion
9 of patches, etc. should go there.
14 If you find a security vulnerability that is not known to the public,
15 please report it privately to dbus-security@lists.freedesktop.org
16 or by reporting a freedesktop.org bug that is marked as
17 restricted to the "D-BUS security group".
19 Most of D-Bus is security sensitive. Guidelines related to that:
21 - avoid memcpy(), sprintf(), strlen(), snprintf, strlcat(),
22 strstr(), strtok(), or any of this stuff. Use DBusString.
23 If DBusString doesn't have the feature you need, add it
26 There are some exceptions, for example
27 if your strings are just used to index a hash table
28 and you don't do any parsing/modification of them, perhaps
29 DBusString is wasteful and wouldn't help much. But definitely
30 if you're doing any parsing, reallocation, etc. use DBusString.
32 - do not include system headers outside of dbus-memory.c,
33 dbus-sysdeps.c, and other places where they are already
34 included. This gives us one place to audit all external
35 dependencies on features in libc, etc.
37 - do not use libc features that are "complicated"
38 and may contain security holes. For example, you probably shouldn't
39 try to use regcomp() to compile an untrusted regular expression.
40 Regular expressions are just too complicated, and there are many
41 different libc's out there.
43 - we need to design the message bus daemon (and any similar features)
44 to use limited privileges, run in a chroot jail, and so on.
46 http://vsftpd.beasts.org/ has other good security suggestions.
51 - The C library uses GNU coding conventions, with GLib-like
52 extensions (e.g. lining up function arguments). The
53 Qt wrapper uses KDE coding conventions.
55 - Write docs for all non-static functions and structs and so on. try
56 "doxygen Doxyfile" prior to commit and be sure there are no
59 - All external interfaces (network protocols, file formats, etc.)
60 should have documented specifications sufficient to allow an
61 alternative implementation to be written. Our implementation should
62 be strict about specification compliance (should not for example
63 heuristically parse a file and accept not-well-formed
64 data). Avoiding heuristics is also important for security reasons;
65 if it looks funny, ignore it (or exit, or disconnect).
70 D-Bus uses Git as its version control system. The main repository is
71 hosted at git.freedesktop.org/dbus/dbus. To clone D-Bus, execute the
74 git clone git://git.freedesktop.org/dbus/dbus
76 git clone git.freedesktop.org:dbus/dbus
78 The latter form is the one that allows pushing, but it also requires
79 an SSH account on the server. The former form allows anonymous
82 D-Bus development happens in two branches in parallel: the current
83 stable branch, with an even minor number (like 1.0, 1.2 and 1.4), and
84 the next development branch, with the next odd number.
86 The stable branch is named after the version number itself (dbus-1.2,
87 dbus-1.4), whereas the development branch is simply known as "master".
89 When making a change to D-Bus, do the following:
91 - check out the earliest branch of D-Bus that makes sense to have
92 your change in. If it's a bugfix, it's normally the current stable
93 branch; if it's a feature, it's normally the "master" branch. If
94 you have an important security fix, you may want to apply to older
98 if you're developing a new, large feature, it's recommended
99 to create a new branch and do your development there. Publish
100 your branch at a suitable place and ask others to help you
101 develop and test it. Once your feature is considered finalised,
102 you may merge it into the "master" branch.
105 . make your change to the source code
106 . execute tests to guarantee that you're not introducing a
107 regression. For that, execute: make check
108 (if possible, add a new test to check the fix you're
110 . commit your change using "git commit"
111 in the commit message, write a short sentence describing what
112 you did in the first line. Then write a longer description in
113 the next paragraph(s).
114 . repeat the previous steps if necessary to have multiple commits
116 - extract your patches and send to the D-Bus mailing list for
117 review or post them to the D-Bus Bugzilla, attaching them to a bug
118 report. To extract the patches, execute:
119 git format-patch origin/master
121 - once your code has been reviewed, you may push it to the Git
123 git push origin my-branch:remote
125 git push origin dbus-X.Y
127 git push origin master
128 (consult the Git manual to know which command applies)
130 - (Optional) if you've not worked on "master", merge your changes to
131 that branch. If you've worked on an earlier branch than the current
132 stable, merge your changes upwards towards the stable branch, then
133 from there into "master".
135 . execute: git checkout master
136 . ensure that you have the latest "master" from the server, update
138 . execute: git merge dbus-X.Y
139 . if you have any conflicts, resolve them, git add the conflicted
140 files and then git commit
141 . push the "master" branch to the server as well
143 Executing this merge is recommended, but not necessary for all
144 changes. You should do this step if your bugfix is critical for the
145 development in "master", or if you suspect that conflicts will arise
146 (you're usually the best person to resolve conflicts introduced by
147 your own code), or if it has been too long since the last merge.
153 To make a release of D-Bus, do the following:
155 - check out a fresh copy from Git
157 - verify that the libtool versioning/library soname is
158 changed if it needs to be, or not changed if not
160 - update the file NEWS based on the git history
162 - verify that the version number of dbus-specification.xml is
163 changed if it needs to be; if changes have been made, update the
164 release date in that file
166 - update the AUTHORS file with "make update-authors" if necessary
168 - the version number should have major.minor.micro, even
169 if micro is 0, i.e. "1.0.0" and "1.2.0" not "1.0"/"1.2"; the micro
170 version should be even for releases, and odd for intermediate snapshots
172 - "make distcheck" (DO NOT just "make dist" - pass the check!)
174 - if make distcheck fails, fix it.
176 - once distcheck succeeds, "git commit -a". This is the version
177 of the tree that corresponds exactly to the released tarball.
179 - tag the tree with "git tag -s -m 'Released X.Y.Z' dbus-X.Y.Z"
180 where X.Y.Z is the version of the release. If you can't sign
181 then simply created an unsigned annotated tag:
182 "git tag -a -m 'Released X.Y.Z' dbus-X.Y.Z".
184 - bump the version number up in configure.ac (so the micro version is odd),
185 and commit it. Make sure you do this *after* tagging the previous
186 release! The idea is that git has a newer version number
187 than anything released. Similarly, bump the version number of
188 dbus-specification.xml and set the release date to "(not finalized)".
190 - merge the branch you've released to the chronologically-later
191 branch (usually "master"). You'll probably have to fix a merge
192 conflict in configure.ac (the version number).
194 - push your changes and the tag to the central repository with
195 git push origin master dbus-X.Y dbus-X.Y.Z
197 - scp your tarball to freedesktop.org server and copy it to
198 dbus.freedesktop.org:/srv/dbus.freedesktop.org/www/releases/dbus/dbus-X.Y.Z.tar.gz.
199 This should be possible if you're in group "dbus"
201 - Update the online documentation with `make -C doc maintainer-upload-docs`.
203 - update the wiki page http://www.freedesktop.org/Software/dbus by
204 adding the new release under the Download heading. Then, cut the
205 link and changelog for the previous that was there.
207 - update the wiki page
208 http://www.freedesktop.org/Software/DbusReleaseArchive pasting the
209 previous release. Note that bullet points for each of the changelog
210 items must be indented three more spaces to conform to the
211 formatting of the other releases there.
213 - post to dbus@lists.freedesktop.org announcing the release.
216 Making a ".0" stable release
219 We create a branch for each stable release. The branch name should be
220 dbus-X.Y which is a branch that has releases versioned X.Y.Z;
221 changes on a stable branch should be limited to significant bug fixes.
223 Because we won't make minor changes like keeping up with the latest
224 deprecations on a stable branch, stable branches should turn off the
225 gcc warning for deprecated declarations (e.g. see commit 4ebb275ab7).
227 Be extra-careful not to merge master (or any branch based on master) into a
232 and upload the branch tag to the server:
233 git push origin dbus-X.Y
235 To develop in this branch:
236 git checkout dbus-X.Y
238 Environment variables
241 These are the environment variables that are used by the D-Bus client library
244 Turns on printing verbose messages. This only works if D-Bus has been
245 compiled with --enable-verbose-mode
247 DBUS_MALLOC_FAIL_NTH=n
248 Can be set to a number, causing every nth call to dbus_alloc or
249 dbus_realloc to fail. This only works if D-Bus has been compiled with
252 DBUS_MALLOC_FAIL_GREATER_THAN=n
253 Can be set to a number, causing every call to dbus_alloc or
254 dbus_realloc to fail if the number of bytes to be allocated is greater
255 than the specified number. This only works if D-Bus has been compiled with
258 DBUS_TEST_MALLOC_FAILURES=n
259 Many of the D-Bus tests will run over and over, once for each malloc
260 involved in the test. Each run will fail a different malloc, plus some
261 number of mallocs following that malloc (because a fair number of bugs
262 only happen if two or more mallocs fail in a row, e.g. error recovery
263 that itself involves malloc). This env variable sets the number of
265 Here's why you care: If set to 0, then the malloc checking is skipped,
266 which makes the test suite a heck of a lot faster. Just run with this
267 env variable unset before you commit.
272 These are the test programs that are built if dbus is compiled using
276 This is the main unit test program that tests all aspects of the D-Bus
280 This it the unit test program for the message bus.
283 A test that tries to break the message loader by passing it randomly
284 created invalid messages.
287 This is a suite of programs which are run with a temporary session bus.
288 If your test involves multiple processes communicating, your best bet
289 is to add a test in here.
291 "make check" runs all the deterministic test programs (i.e. not break-loader).
293 "make lcov-check" is available if you configure with --enable-compiler-coverage
294 and gives a complete report on test suite coverage.
299 Please file them at http://bugzilla.freedesktop.org under component
300 dbus, and also post to the mailing list for discussion. The commit
303 - for fixes that don't affect API or protocol, they can be committed
304 if any one qualified reviewer other than patch author
307 - for fixes that do affect API or protocol, two people
308 in the reviewer group have to review and approve the commit, and
309 posting to the list is definitely mandatory
311 - if there's a live unresolved controversy about a change,
312 don't commit it while the argument is still raging.
314 - at their discretion, members of the reviewer group may also commit
315 branches/patches under these conditions:
317 - the branch does not add or change API, ABI or wire-protocol
319 - the branch solves a known problem and is covered by the regression tests
321 - there are no objections from the rest of the review group within
322 a week of the patches being attached to Bugzilla
324 - the committer gets a positive review on Bugzilla from someone they
325 consider qualified to review the change (e.g. a colleague with D-Bus
326 experience; not necessarily a member of the reviewer group)
328 - regardless of reviews, to commit a patch:
329 - make check must pass
330 - the test suite must be extended to cover the new code
331 as much as reasonably feasible (see Tests above)
332 - the patch has to follow the portability, security, and
334 - the patch should as much as reasonable do one thing,
335 not many unrelated changes
336 No reviewer should approve a patch without these attributes, and
337 failure on these points is grounds for reverting the patch.
339 The reviewer group that can approve patches:
341 Havoc Pennington <hp@pobox.net>
342 Michael Meeks <michael.meeks@novell.com>
343 Alexander Larsson <alexl@redhat.com>
344 Zack Rusin <zack@kde.org>
345 Joe Shaw <joe@assbarn.com>
346 Mikael Hallendal <micke@imendio.com>
347 Richard Hult <richard@imendio.com>
348 Owen Fraser-Green <owen@discobabe.net>
349 Olivier Andrieu <oliv__a@users.sourceforge.net>
350 Colin Walters <walters@verbum.org>
351 Thiago Macieira <thiago@kde.org>
352 John Palmieri <johnp@redhat.com>
353 Scott James Remnant <scott@netsplit.com>
354 Will Thompson <will.thompson@collabora.co.uk>
355 Simon McVittie <simon.mcvittie@collabora.co.uk>
356 David Zeuthen <davidz@redhat.com>