# ticket

type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: Mixed declarations and code
description:
  verto uses declarations after statements in multiple places.  This is a C99 feature and doesn't work in MSVC.  Compiling with -Wdeclaration-after-statement will detect these uses.


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: No breaks in libev_ctx_del()
description:
  In the libev modules, libev_ctx_del() appears to be missing necessary break statements in its switch statement.


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: Non-prototype declarations
description:
  libverto's headers contain a number of function declarations which aren't prototypes because they use () instead of (void).  In definitions this is okay, but in prototypes this causes the compiler to treat the declaration as a K&R-style declaration and not a prototype.

  {{{
  verto-glib.h:verto_ctx *verto_new_glib();
  verto-glib.h:verto_ctx *verto_default_glib();
  verto-libevent.h:verto_ctx *verto_new_libevent();
  verto-libevent.h:verto_ctx *verto_default_libevent();
  verto-libev.h:verto_ctx *verto_new_libev();
  verto-libev.h:verto_ctx *verto_default_libev();
  verto-module.h:typedef verto_ctx *(*verto_ctx_constructor)();
  verto-tevent.h:verto_ctx *verto_new_tevent();
  verto-tevent.h:verto_ctx *verto_default_tevent();
  }}}


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: Module loading on non-ELF UNIX-like platforms
description:
  verto.c:load_module() assumes that it can transform the pathname of the libverto library into the pathname of a module library by adding "-modulename" just before the first occurrence of ".so" in the pathname.  This assumption breaks down on non-ELF platforms.  On OSX, for instance, the library suffix is .dylib, and the version number precedes the suffix (libverto.0.dylib).

  An alternative might be using the last occurrence of "verto" in the pathname as the breakpoint.


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: Linking against multiple module libraries
description:
  libverto modules can be used as dynamically loaded objects or as directly linked libraries.  They export module-specific symbols like verto_libev_default(), but also a fixed-named data symbol verto_module_table.  Trying to link against two module libraries (perhaps one by the application and another by a subsidiary library which uses a private event loop) would result in a symbol conflict.

  Verbally, Nathaniel has suggested that the module table symbol name will be changed to include the module name.  This will require deducing the module name from the pathname in verto.c:do_load_dir().


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: pkg-config input files need exec_prefix
description:
  libverto's installed pkg-config data files are broken in most builds because they come out as:
  {{{
  prefix=/usr/local
  libdir=${exec_prefix}/lib
  includedir=${prefix}/include
  }}}
  but never define exec_prefix.  They all need an exec_prefix=@exec_prefix@ line.


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: verto_set_private() should perhaps return void
description:
  verto_set_private() can only return failure on a specific invalid input (a null ev pointer).  So it is almost never necessary to check the return value, but static analyzers like lint will tend to object to code which ignores it.  As a simple non-copying setter function, it would be better for verto_set_private() to return void.

  (This is a matter of opinion and style, of course.)


type: defect
component: component1
priority: minor
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: Compile option to hardcode linked-in module
description:
  In the krb5 tree, when we build a bundled libverto, we want to avoid the dynamic linking logic and just use the bundled k5ev module.  Currently we take care of this in the calling code, which requires conditional behavior in three places:

  1. Link against -lverto-k5ev -lverto instead of -lverto.
  2. Include <verto-k5ev.h> instead of <verto.h>
  3. Call verto_default_k5ev() instead of verto_default(NULL, types).

  As we add more call sites, we can manage this caller complexity with a few macros.  But as a matter of preference and style, I feel like it's more elegant to handle this under the covers.

  My idea is to support a compiler symbol in verto.c with a name like VERTO_USE_MODULE, whose value is probably the module table symbol from the module library (which gets linked as a dependency library by whatever is specially building verto.c).  If defined, the dynamic loading logic would be compiled out (improving portability) and load_module() just checks reqtypes against the module and returns it.  I think this level of internal conditionalization shouldn't be any worse than the equivalent in the caller.


type: defect
component: component1
priority: minor
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: libverto.pc.in Libs.private
description:
  verto has a dependency on -ldl on most platforms, which comes from the @LIBS@.  According to current documentation, the right thing to do is have a line in libverto.pc.in saying:

  Libs.private: @LIBS@

  Dependencies given this way will only be emitted for static linking.  For shared linking, you don't want the consuming library or program to have a direct dependency on libdl.


type: defect
component: component1
priority: minor
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: C89 namespace violations
description:
  Symbols beginning with an underscore are reserved by the C89 standard for various purposes.  verto uses a number of symbols like this and probably should not.


type: defect
component: component1
priority: major
owner: somebody
reporter: simo
status: closed
resolution: wontfix
summary: segfault deleteing event with tevent backend
description:
  My program used to set up one persistent read event, read some data and pass it to be processed by a thread.
  Once the data is back a new non persistent write event was created to deal with writing.
  On write error the write event callback would free the read event and close the connection.


  {{{
     1.
        Program received signal SIGABRT, Aborted.
     2.
        0x0000003910436285 in raise () from /lib64/libc.so.6
     3.
        (gdb) bt
     4.
        #0 0x0000003910436285 in raise () from /lib64/libc.so.6
     5.
        #1 0x0000003910437b9b in abort () from /lib64/libc.so.6
     6.
        #2 0x00000035ee6021e6 in ?? () from /usr/lib64/libtalloc.so.2
     7.
        #3 0x00000035ee6038be in _talloc_free () from /usr/lib64/libtalloc.so.2
     8.
        #4 0x00007ffff7dda46c in verto_del () from /usr/lib64/libverto.so.1
     9.
        #5 0x0000000000401edb in gp_conn_free (conn=0x60abb0) at src/gp_socket.c:78
  }}}


type: defect
component: component1
priority: major
owner: somebody
reporter: ghudson
status: closed
resolution: fixed
summary: verto_convert_module sanity check could dereference null pointer
description:
  verto_convert_module contains a sanity check for module being NULL.  But if that check fires, it goes to the error label, which dereferences module if mctx is set.

  (Found with scan-build.)


type: defect
component: component1
priority: major
owner: somebody
reporter: tkuthan7
status: new
summary: memleak in vfree
description:
  verto_set_allocator(resize, hierarchical) has an unducumented
  requirement on allocator function resize, that resize(ptr, 0) is
  equivalent to free(ptr).

  Some POSIX.1-2008 compliant implementations of the default allocator realloc don't 
  meet this requirement. realloc(ptr, 0) may return a unique pointer that can be
  successfully passed to free. This new pointer never gets freed by libverto and the
  memory overhead leaks.

  This is not an issue for linux realloc implementation, but libverto has been bundled with MIT Kerberos. MIT Kerberos is supported on platforms like Oracle Solaris, where realloc(ptr, 0) is not equivalent to free(ptr).

  See https://github.com/krb5/krb5/pull/294


# ticket_change

author: ghudson
field: comment
oldvalue: 2
newvalue:
  Commit 7e7cc208e93ca218a93a18048c3c990b9901d8bd added @LIBS@ to the Libs line, probably based on something I said in email.  I was wrong in that mail; it should be in Libs.private instead.
  hh


author: ghudson
field: comment
oldvalue: 1
newvalue:
  This may be a little trickier than I thought.  A libverto module depends on libverto itself, so linking libverto against a module would be a circular dependency.

  So, to do what we want, we'd need a way to build verto.c and the private module's sources into a single shared library.  I think this could probably be made clean from the viewpoint of verto.c (push load_module() into module.c, provide a stub which can only return the private module's record) but I'd have to think about it more.


author: ghudson
field: comment
oldvalue: 1
newvalue:
  Note that even under glibc, realloc(NULL, 0) allocates memory and returns non-null--that is, it behaves like malloc(0) rather than free(NULL).  So using realloc(x, 0) as a synonym for free(x) only works if you are careful not to free null pointers, which is of course inconvenient.


# report

title: Active Tickets
description:
  * List all active tickets by priority.
  * Color each row based on priority.

query:
  SELECT p.value AS __color__,
     id AS ticket, summary, component, version, milestone, t.type AS type, 
     owner, status,
     time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE status <> 'closed' 
    ORDER BY p.value, milestone, t.type, time


title: Active Tickets by Version
query:
  SELECT p.value AS __color__,
     version AS __group__,
     id AS ticket, summary, component, version, t.type AS type, 
     owner, status,
     time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE status <> 'closed' 
    ORDER BY (version IS NULL),version, p.value, t.type, time

description:
  This report shows how to color results by priority,
  while grouping results by version.

  Last modification time, description and reporter are included as hidden fields
  for useful RSS export.


title: Active Tickets by Milestone
query:
  SELECT p.value AS __color__,
     milestone||' Release' AS __group__,
     id AS ticket, summary, component, version, t.type AS type, 
     owner, status,
     time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE status <> 'closed' 
    ORDER BY (milestone IS NULL),milestone, p.value, t.type, time

description:
  This report shows how to color results by priority,
  while grouping results by milestone.

  Last modification time, description and reporter are included as hidden fields
  for useful RSS export.


title: Assigned, Active Tickets by Owner
description: List assigned tickets, group by ticket owner, sorted by priority.
query:
  SELECT p.value AS __color__,
     owner AS __group__,
     id AS ticket, summary, component, milestone, t.type AS type, time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE status = 'assigned'
    ORDER BY owner, p.value, t.type, time


title: Assigned, Active Tickets by Owner (Full Description)
query:
  SELECT p.value AS __color__,
     owner AS __group__,
     id AS ticket, summary, component, milestone, t.type AS type, time AS created,
     description AS _description_,
     changetime AS _changetime, reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE status = 'assigned'
    ORDER BY owner, p.value, t.type, time

description:
  List tickets assigned, group by ticket owner.
  This report demonstrates the use of full-row display.


title: All Tickets By Milestone (Including closed)
description: A more complex example to show how to make advanced reports.
query:
  SELECT p.value AS __color__,
     t.milestone AS __group__,
     (CASE status 
        WHEN 'closed' THEN 'color: #777; background: #ddd; border-color: #ccc;'
        ELSE 
          (CASE owner WHEN $USER THEN 'font-weight: bold' END)
      END) AS __style__,
     id AS ticket, summary, component, status, 
     resolution,version, t.type AS type, priority, owner,
     changetime AS modified,
     time AS _time,reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'), 
          (CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END) DESC


title: My Tickets
query:
  SELECT p.value AS __color__,
     (CASE status WHEN 'assigned' THEN 'Assigned' ELSE 'Owned' END) AS __group__,
     id AS ticket, summary, component, version, milestone,
     t.type AS type, priority, time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE t.status <> 'closed' AND owner = $USER
    ORDER BY (status = 'assigned') DESC, p.value, milestone, t.type, time

description:
  This report demonstrates the use of the automatically set 
  USER dynamic variable, replaced with the username of the
  logged in user when executed.


title: Active Tickets, Mine first
query:
  SELECT p.value AS __color__,
     (CASE owner 
       WHEN $USER THEN 'My Tickets' 
       ELSE 'Active Tickets' 
      END) AS __group__,
     id AS ticket, summary, component, version, milestone, t.type AS type, 
     owner, status,
     time AS created,
     changetime AS _changetime, description AS _description,
     reporter AS _reporter
    FROM ticket t
    LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    WHERE status <> 'closed' 
    ORDER BY (owner = $USER) DESC, p.value, milestone, t.type, time

description:
   * List all active tickets by priority.
   * Show all tickets owned by the logged in user in a group first.


