Question about debug code on published packages

Carlos Ribeiro carribeiro at
Sun Nov 5 17:10:04 GMT 2006


I would like to hear some sincere opinions about the practice of including
debug code in published packages. More specifically, if I take a package
written by someone else and modify it to include debugging code (for
example, by converting "print" statements that are commented out in the
code), is such contribution an acceptable/desirable practice? What about
adding debug code that can be turned on/off? I ask this question because I
know there are pros and cons to the practice; and also, because I don't want
to waste my time or even to "piss off" the maintainer with something
unwanted by himself or by the community.

Debug options are a valuable tool when one is starting to look at some
package, to track a bug, or just to understand how something works.
It's cleaner than using "prints" that need to be removed or commented out
before publishing the package.
It avoids a potential problem when a little used "print" statement stays in
the code because someone forgets to remove it.
It makes clearer to whoever is reading the code about which messages are
supposed to be debugging ones, and which ones are really regular messages.

It's of limited use most of the time;
Depending upon the implementation, it can be confusing for non experienced
Depending upon the implementation, it may have a performance impact;
It adds more "bloat" to the package (and with CD space at a premium, every
byte counts);
It adds more complexity (command line or configuration file parsing), thus
opening the chance for new bugs or even vulnerabilities;
Last, some people believe that published packages should not include debug
code, as a matter of practice.

Finally, please bear in mind that I am asking this question in the generic
sense, and this it does not imply a problem with any specific package, or
with the coding practices of any particular developer. I also hope this
forum is the appropriate place for this kind of question. Thanks in advance,

Carlos Ribeiro
Consultoria em Projetos
mail: carribeiro at
mail: carribeiro at
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the ubuntu-devel mailing list