Hello, On Sun, Apr 09, 2006 at 05:39:16PM +0300, Jari Aalto wrote: > > An example run: > > $ dpkg-query --showformat='${Installed-Size;-10} ${status;-25} ${Package}\n' > -W 'exim*' > unknown ok not-installed exim > unknown ok not-installed exim-tls > purge ok not-installed exim4 > 1520 install ok unpacked exim4-base > 928 install ok unpacked exim4-config [...]
> EXPECTED RESULTS > > The result should be aligned evenly for each field, because the field size > has been given for every variable. Now a empty values, like 'Installed-Size' > for 'exim' are ignored. The output should look like: > > unknown ok not-installed exim > unknown ok not-installed exim-tls > purge ok not-installed exim4 > 1520 install ok unpacked exim4-base > 928 install ok unpacked exim4-config [...] The attached patch is a proposal to fix this. In lib/showpkg.c, when the field is not present (e.g. "if (!value || !*value) return;" in the w_charfield fwritefunction), nothing is writen to wb (!wb.used) and showpkg.c currently tries the next field. I think that in this case, the field was found, but the info is empty, and this empty buffer should still be displayed. show1package is also used in dpkg-deb (probably for the --info option). I don't think (hope) this patch will not break dpkg-deb's expected output. Kind Regards, -- Nekral
Index: lib/showpkg.c =================================================================== --- lib/showpkg.c (révision 220) +++ lib/showpkg.c (copie de travail) @@ -230,8 +230,6 @@ for (fip=fieldinfos; fip->name; fip++) if (strcasecmp(head->data, fip->name)==0) { fip->wcall(&wb,pkg,&pkg->installed,0,fip); - if (!wb.used) - break; varbufaddc(&wb, '\0'); varbufprintf(&fb, fmt, wb.buf);