Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, used to display lists of tickets meeting a specified set of criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.


When you first go to the query page the default filter will display tickets relevant to you:

  • If logged in then all open tickets it will display open tickets assigned to you.
  • If not logged in but you have specified a name or email address in the preferences then it will display all open tickets where your email (or name if email not defined) is in the CC list.
  • If not logged and no name/email defined in the preferences then all open issues are displayed.

Current filters can be removed by clicking the button to the left with the minus sign on the label. New filters are added from the pulldown lists at the bottom corners of the filters box ('And' conditions on the left, 'Or' conditions on the right). Filters with either a text box or a pulldown menu of options can be added multiple times to perform an or of the criteria.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

Once you've edited your filters click the Update button to refresh your results.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back to Query links after saving your results. When you return to the query any tickets which were edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria the text will also be greyed. Lastly, if a new ticket matching the query criteria has been created, it will be shown in bold.

The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

Trac allows you to save the query as a named query accessible from the reports module. To save a query ensure that you have Updated the view and then click the Save query button displayed beneath the results. You can also save references to queries in Wiki content, as described below.

Note: one way to easily build queries like the ones below, you can build and test the queries in the Custom report module and when ready - click Save query. This will build the query string for you. All you need to do is remove the extra line breaks.

Note: you must have the REPORT_CREATE permission in order to save queries to the list of default reports. The Save query button will only appear if you are logged in as a user that has been granted this permission. If your account does not have permission to create reports, you can still use the methods below to save a query.

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.

[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

Which is displayed as:

Active tickets against 1.0

This uses a very simple query language to specify the criteria (see Query Language).

Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:

[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

Which is displayed as:

Assigned tickets by owner

Using the [[TicketQuery]] Macro

The TicketQuery macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.



This is displayed as:

No results

Just like the query: wiki links, the parameter of this macro expects a query string formatted according to the rules of the simple ticket query language. This also allows displaying the link and description of a single ticket:


This is displayed as:

Unix manual pages not in release bundles

A more compact representation without the ticket summaries is also available:

[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

This is displayed as:

No results

Finally, if you wish to receive only the number of defects that match the query, use the count parameter.

[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

This is displayed as:


Customizing the table format

You can also customize the columns displayed in the table format (format=table) by using col=<field> - you can specify multiple fields and what order they are displayed by placing pipes (|) between the columns like below:


This is displayed as:

Full rows

In table format you can also have full rows by using rows=<field> like below:


This is displayed as:

Results (1 - 3 of 8339)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#11133 invalid Misaligned stack leads to dynamic linker crash trippels
Running programs compiled with ghc leads to a crash
of the glibc dynamic linker. This happens because ghc
doesn't align the stack correctly during lazy symbol resolution.


 markus@x4 glibc-build % gdb --args /var/tmp/glibc-build/elf/ /home/markus/bin/xmonad
Reading symbols from /var/tmp/glibc-build/elf/
(gdb) run
Starting program: /var/tmp/glibc-build/elf/ /home/markus/bin/xmonad
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/".

Program received signal SIGSEGV, Segmentation fault.
_dl_lookup_symbol_x (undef_name=0x7ffff75cb3c5 "__gmpn_invert_limb", undef_map=0x7ffff76494d0, ref=ref@entry=0x7fffffffa170, symbol_scope=0x7ffff7649828, version=0x0, 
    type_class=type_class@entry=1, flags=1, skip_map=0x0) at dl-lookup.c:809
809       struct sym_val current_value = { NULL, NULL };
(gdb) bt
#0  _dl_lookup_symbol_x (undef_name=0x7ffff75cb3c5 "__gmpn_invert_limb", undef_map=0x7ffff76494d0, ref=ref@entry=0x7fffffffa170, symbol_scope=0x7ffff7649828, version=0x0, 
    type_class=type_class@entry=1, flags=1, skip_map=0x0) at dl-lookup.c:809
#1  0x0000555555564413 in _dl_fixup (l=<optimized out>, reloc_arg=<optimized out>) at ../elf/dl-runtime.c:111
#2  0x000055555556ce1f in _dl_runtime_resolve_sse () at ../sysdeps/x86_64/dl-trampoline.h:112
#3  0x00007ffff762093a in __gmpn_divrem_1 () from /usr/lib/
#4  0xee6b280000000000 in ?? ()
#5  0x00007ffff6b0b138 in ?? ()
#6  0x00007ffff6b057d0 in ?? ()
#7  0x00000000ffffffe2 in ?? ()
#8  0x00007ffff6b057b8 in ?? ()
#9  0x00007ffff6b051b0 in ?? ()
#10 0x00007ffff6b0b1b0 in ?? ()
#11 0x00000000006b47d8 in ?? ()
#12 0x00000000006142a9 in ?? ()
#13 0x0000000000000000 in ?? ()
(gdb) disass
Dump of assembler code for function _dl_lookup_symbol_x:
=> 0x000055555555e93a <+154>:   movaps %xmm0,-0x80(%rbp)

The crash happens because the incoming stack alignment is wrong:

rax            0xffffffff       4294967295
rbx            0x7ffff763c360   140737343898464
rcx            0x7ffff75cb3d7   140737343435735
rdx            0x0      0
rsi            0x33f9b936d4fb49a0       3745228210287888800
rdi            0x7ffff75cb3c5   140737343435717
rbp            0x7fffffffa148   0x7fffffffa148
rsp            0x7fffffffa058   0x7fffffffa058
r8             0x0      0
r9             0x1      1
r10            0x7ffff76494d0   140737343952080
r11            0x7ffff7620840   140737343785024
r12            0x0      0
r13            0x0      0
r14            0x7ffff76494d0   140737343952080
r15            0x7fffffffa170   140737488331120
rip            0x55555555e93a   0x55555555e93a <_dl_lookup_symbol_x+154>
eflags         0x10246  [ PF ZF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0

0000000000001470 <_dl_lookup_symbol_x>:
    1470:       55                      push   %rbp
    1471:       48 89 e5                mov    %rsp,%rbp
    1474:       41 57                   push   %r15
    1476:       41 56                   push   %r14
    1478:       41 55                   push   %r13
    147a:       41 54                   push   %r12
    147c:       49 89 d5                mov    %rdx,%r13
    147f:       53                      push   %rbx
    1480:       49 89 f7                mov    %rsi,%r15
    1483:       4d 89 c6                mov    %r8,%r14
    1486:       48 81 ec a8 00 00 00    sub    $0xa8,%rsp
    148d:       0f b6 17                movzbl (%rdi),%edx
    1490:       48 89 bd 68 ff ff ff    mov    %rdi,-0x98(%rbp)
    1497:       48 89 8d 50 ff ff ff    mov    %rcx,-0xb0(%rbp)
    149e:       44 89 8d 5c ff ff ff    mov    %r9d,-0xa4(%rbp)
    14a5:       4c 8b 65 18             mov    0x18(%rbp),%r12
    14a9:       84 d2                   test   %dl,%dl
    14ab:       0f 84 cb 02 00 00       je     177c <_dl_lookup_symbol_x+0x30c>
    14b1:       48 89 f9                mov    %rdi,%rcx
    14b4:       b8 05 15 00 00          mov    $0x1505,%eax
    14b9:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
    14c0:       48 89 c6                mov    %rax,%rsi
    14c3:       48 83 c1 01             add    $0x1,%rcx
    14c7:       48 c1 e6 05             shl    $0x5,%rsi
    14cb:       48 01 f0                add    %rsi,%rax
    14ce:       48 01 d0                add    %rdx,%rax
    14d1:       0f b6 11                movzbl (%rcx),%edx
    14d4:       84 d2                   test   %dl,%dl
    14d6:       75 e8                   jne    14c0 <_dl_lookup_symbol_x+0x50>
    14d8:       89 c0                   mov    %eax,%eax
    14da:       48 89 85 60 ff ff ff    mov    %rax,-0xa0(%rbp)
    14e1:       66 0f ef c0             pxor   %xmm0,%xmm0
    14e5:       b8 ff ff ff ff          mov    $0xffffffff,%eax
    14ea:       4d 85 f6                test   %r14,%r14
    14ed:       48 89 85 78 ff ff ff    mov    %rax,-0x88(%rbp)
=>  14f4:       0f 29 45 80             movaps %xmm0,-0x80(%rbp)

(0x7fffffffa058 + 0xa8) % 16 == 0 (instead of the correct 8)

Please see
for further info.
#11129 duplicate Nested TH not allowed in declarations andrewthad

I tried to do the following with the singletons and derive libraries:

$(singletons [d|
  data CrudRoute = AddR | EditR | DeleteR | ViewR
    deriving (Eq,Ord,Enum,Bounded,Show)
  data MyRoute = UsersR | ProfileR | RenameR | DogR CrudRoute
    deriving (Eq,Ord,Show)
  $( derive makeEnum ''MyRoute ) 

GHC fails with the following error message:

Splices within declaration brackets not (yet) handled by Template Haskell

Here is the github issue where this originated:

#11128 fixed New `-fwarn-noncanonical-monad-instances` warning hvr hvr

When declaring Applicative and Monad instances, there's a degree of freedom in which way to define return,pure,(>>),(*>). For instance, defining

instance Applicative T1 where
  pure  = return
  (<*>) = ap

instance Monad T1 where
  return = ...
  (>>=)  = ...
  (>>)   = {- optimised impl -}

is ok, but this leaves (*>) with a possibly less optimised version than (>>). This can cause performance regressions when generalising code from Monad to Applicative.

Moreover, starting with base-4.8, the return method gained a default implementation return = pure which follows the preferred or "canonical" direction of having implementations flow from superclasses to their subclasses.

A proper "canonical" definition of T1 is consequently:

instance Applicative T1 where
  pure  =  ...
  (<*>) = ap
  (*>)  = {- optimised impl -}

instance Monad T1 where
  return = pure -- can be left off since base-4.8
  (>>=)  = ...
  (>>)   = (*>) -- NB: default impl of (>>) /= (*>)

So this warning is a "lint"-style check to help detect Monad instances where the definitions of return/(>>) are not canonical, i.e. don't match return = pure and (>>) = (*>) respectively.

1 2 3 4 5 6 7 8 9 10 11

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separated by ampersands (&). Each filter then consists of the ticket field name, an operator, and one or more values. More than one value are separated by a pipe (|), meaning that the filter matches any of the values. To include a literal & or | in a value, escape the character with a backslash (\).

The available operators are:

= the field content exactly matches one of the values
~= the field content contains one or more of the values
^= the field content starts with one of the values
$= the field content ends with one of the values

All of these operators can also be negated:

!= the field content matches none of the values
!~= the field content does not contain any of the values
!^= the field content does not start with any of the values
!$= the field content does not end with any of the values

The date fields created and modified can be constrained by using the = operator and specifying a value containing two dates separated by two dots (..). Either end of the date range can be left empty, meaning that the corresponding end of the range is open. The date parser understands a few natural date specifications like "3 weeks ago", "last month" and "now", as well as Bugzilla-style date specifications like "1d", "2w", "3m" or "4y" for 1 day, 2 weeks, 3 months and 4 years, respectively. Spaces in date specifications can be left out to avoid having to quote the query string.

created=2007-01-01..2008-01-01 query tickets created in 2007
created=lastmonth..thismonth query tickets created during the previous month
modified=1weekago.. query tickets that have been modified in the last week
modified=..30daysago query tickets that have been inactive for the last 30 days

See also: TracTickets, TracReports, TracGuide

Last modified 2 years ago Last modified on Jul 6, 2013 6:47:50 PM