Fix bug that made pkg repo segfault

Introduced in 5dc36026fc60c64763d82a69ef2921b3cd78e913, pkg repo -l
crashed on packages (meta ports) that don't install files on their own.
Use MAX* cosistently

pkg used MAXPATHLEN, MAXLOGNAME and PATH_MAX inconsistently,
sometimes path[MAXPATHLEN] and sometimes path[MAXPATHLEN + 1].

Since those constants already include the trailing '\0' and snprintf's
size parameter also does, it was changed to path[MAXPATHLEN] (or
MAXLOGNAME, PATH_MAX) everywhere.
Where we use a fixed size char array as a buffer or as a member of a
structure, use the sizeof() operator later in the same scope when we
need to know the length of the array.

Fix calls to:

    snprintf(), pkg_snprintf()
    strlcpy()
    dn_expand()
Fix the debug output to show correctly whether it's a repo schema
upgrade or downgrade