[Rpm-maint] [rpm-software-management/rpm] 'rpm -qlv' does not correctly handle long owner and group name (#544)
Tomas Hoger
notifications at github.com
Fri Sep 21 12:57:46 UTC 2018
If you do a `rpm -qlv` of a package where file owner or group name has 8 or more characters, the following problems happen:
* Owner and group names are truncated to 8 characters even if they are longer.
* If owner name has 8 characters (after the truncation mentioned in the previous point), there's no space printed in between owner and group name.
Using `amanda` package from Fedora to demonstrate the problem:
~~~
$ rpm -qlvp amanda-3.5.1-13.el8.x86_64.rpm | tail -n 4
drwxr-xr-x 2 amandabadisk 0 Aug 12 10:45 /var/lib/amanda
-rw------- 1 amandabadisk 1181 Aug 12 10:45 /var/lib/amanda/.amandahosts
drwxrws--- 2 amandabadisk 0 Aug 12 10:45 /var/log/amanda
drwxrws--- 2 amandabadisk 0 Aug 12 10:45 /var/log/amanda/amandad
~~~
The owner of those files is `amandabackup`. That is truncated to `amandaba` and later on printed with group name `disk` without any white space in between as `amandabadisk`.
The first problem seems to occur here:
https://github.com/rpm-software-management/rpm/blob/rpm-4.14.2-release/lib/query.c#L44-L45
I guess you may be more reluctant to fix this, as it can have impact on the output format.
The second is likely here:
https://github.com/rpm-software-management/rpm/blob/rpm-4.14.2-release/lib/query.c#L86-L88
that contains `%-8s%-8s` to print `ownerfield` and `groupfield`. Adding a space in between would also change format, but I this problem worse than the truncation problem.
*Workaround:*
Use `--queryformat`. This aims to produce similar output:
~~~
$ rpm -q --qf "[%{FILEMODES:perms} %4{FILENLINKS} %-8{FILEUSERNAME} %-8{FILEGROUPNAME} %10{FILESIZES} %{FILENAMES}\n]" -p amanda-3.5.1-13.el8.x86_64.rpm | tail -n 4
drwxr-xr-x 1 amandabackup disk 0 /var/lib/amanda
-rw------- 1 amandabackup disk 1181 /var/lib/amanda/.amandahosts
drwxrws--- 1 amandabackup disk 0 /var/log/amanda
drwxrws--- 1 amandabackup disk 0 /var/log/amanda/amandad
~~~
However, fancy date/time formatting, or symlink target printing (with ` -> `) may not be doable that way. Also note that nlinks info does not match.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/544
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180921/ac859f41/attachment.html>
More information about the Rpm-maint
mailing list