rpm --qf / nonsense

Jeffrey Johnson n3npq at me.com
Thu Sep 18 18:55:35 CEST 2014


On Sep 18, 2014, at 12:39 PM, Jeffrey Johnson wrote:

> 
> I'll look at a better fix in popt with aliases in a moment. Don't
> expect a patch however.
> 


There is an attempt to read long complicated queryformats
from /usr/lib/rpm/qf/* based on whether the 1st character 
starts with a '/'. Here's one of the aliases
  rpm     alias --yum:primary.xml --qf /usr/lib/rpm-5.4.16/qf/yum_primary_xml \
        --POPTdesc=$"display yum primary.xml markup"

From lib/poptQV.c:233

            /* Read queryformat from file. */
            if (arg[0] == '/') {
                const char * fn = arg;
                int rc;

                rc = poptReadFile(fn, &b, &nb, POPT_READFILE_TRIMNEWLINES);
                if (rc != 0)
                    goto _qfexit;
                if (b == NULL || nb == 0)       /* XXX can't happen */
                    goto _qfexit;
                /* XXX trim double quotes */
                if (*b == '"') {
                    while (nb > 0 && b[nb] != '"')
                        b[nb--] = '\0';
                    b[nb] = '\0';
                    arg = b + 1;
                } else
                    arg = b;
            }

I'll change the character to something else (but the obvious '@' is
already in use for other purposes.

Simplest quick fix is to insert a space before the '/'

$ ./rpm -q --qf '/usr/share/doc/%{N}\n' rpm
rpm-4.8.0-37.el6.x86_64
$ ./rpm -q --qf ' /usr/share/doc/%{N}\n' rpm
 /usr/share/doc/rpm

hth

73 de Jeff



More information about the pld-devel-en mailing list