<p>We are using trac and are really satisfied with it. However, out of the box, trac is best suited for single-project environments only. I'd be interested to hear about the various approaches people take to make it work with multiple projects nevertheless and their experiences with them. Are there any plugins to recommend? Any patches, tweaks or whatnots? Are you maybe even using an entirely different bug-tracking system that offers all of trac's functionality plus multi-project support?</p>

<p>We recently started managing a second project ourselves which generally works okay but also has some drawbacks, especially where the two projects overlap because of common library code we wrote that is used in both projects. How do you handle this?</p>

<p>(I'll attach our own current approach as an answer to this post.)</p>

The approach we took is to create another trac environment for each new project and set up
InterTrac
links for simpler cross-referencing between the two. We also use a common base
Trac.ini
file via the [inherit] directive.
Besides the ambiguity issues with shared code mentioned in the question, this has a couple of drawbacks that may or may not affect you, depending on the nature of your projects and your workflow:
creating new projects is not an easy process; it can not be done via the browser interface
ticket numbers are not unified: each new project environment starts fresh from #1 - at least with InterTrac aliases you can easily disambiguate them
you have to take extra care when installing and configuring plugins so they will be installed and configured for all environments