Bug 1072258

Summary: yum doesn't handle/resolve symlinks to files for provides
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: yumAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dmach, james.antill, vmukhame
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-03 12:27:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Srot 2014-03-04 08:50:01 UTC
While testing (bug 1062959) the 'fs' subcommands 'du' and 'status' I found out that it doesn't handle symlinks properly.

E.g. on RHEL-7 /bin is a symlink to /usr/bin so a lot of files are reported as Not packaged? although they actually belong to a package and vice versa.

Example:

# yum fs status /bin
Loaded plugins: auto-update-debuginfo, kabi, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Not packaged?: /bin/catchsegv
Not packaged?: /bin/gzexe
Not packaged?: /bin/gencat
Not packaged?: /bin/mesg
Not packaged?: /bin/gzip
..
..

# rpm -qf /bin/gzip
gzip-1.5-6.el7.x86_64
# rpm -ql gzip | grep gzip\$
/usr/bin/gzip


Similarly, 

# yum fs du /usr/bin
Loaded plugins: auto-update-debuginfo, kabi, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Files            : 2,036
Total size       : 139 M
       Pkgs size : 137 M ( 98%)
       Data size : 2.2 M (  2%)

Top 4 packages:
1.                     1:virtuoso-opensource-6.1.6-5.el7.x86_64 10 M 
2.                           binutils-2.23.52.0.1-14.el7.x86_64 9.4 M
3.                                 1:doxygen-1.8.5-2.el7.x86_64 8.4 M
4.                         postgresql-server-9.2.6-3.el7.x86_64 5.6 M

Top 4 non-package files:
1.                                         /usr/bin/dbus-daemon 431 k
2.                                                /usr/bin/tcsh 395 k
3.                                               /usr/bin/mailx 384 k
4.                                             /usr/bin/netstat 151 k

but 

# rpm -qf /usr/bin/tcsh
tcsh-6.18.01-7.el7.x86_64
# rpm -ql tcsh | grep bin
/bin/csh
/bin/tcsh

Comment 2 James Antill 2014-03-05 21:43:41 UTC
 This is a generic yum vs. rpm thing ... rpm knows about fs remapping to resolve files to paths, yum doesn't (and can't easily).

 Eg. yum provides /bin/zsh

Comment 3 Karel Srot 2014-03-06 08:41:24 UTC
So why yum can't ask rpm? Why to have the 'df' command then if it produce useless results?

Comment 4 Karel Srot 2014-03-17 07:15:22 UTC
(In reply to James Antill from comment #2)
>  This is a generic yum vs. rpm thing ... rpm knows about fs remapping to
> resolve files to paths, yum doesn't (and can't easily).
> 
>  Eg. yum provides /bin/zsh

Btw, yum provides works for me.


# which zsh
/usr/bin/zsh
# rpm -ql zsh | grep 'bin/zsh'
/bin/zsh
# 
# yum provides --disablerepo=\* /usr/bin/zsh
Loaded plugins: auto-update-debuginfo, kabi, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
zsh-5.0.2-7.el7.x86_64 : Powerful interactive shell
Repo        : @rhel-7
Matched from:
Filename    : /usr/bin/zsh


# yum provides --disablerepo=\* /bin/zsh
Loaded plugins: auto-update-debuginfo, kabi, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
zsh-5.0.2-7.el7.x86_64 : Powerful interactive shell
Repo        : @rhel-7
Matched from:
Filename    : /bin/zsh

Comment 5 Karel Srot 2014-03-19 06:48:32 UTC
I am reopening this bug because current implementation makes the 'du' and 'status' subcommands pretty useless due to large amount of false positives.

Proposing the bug for 7.1.

Comment 6 James Antill 2014-04-07 21:02:46 UTC
 Again, I'm not sure what we can do here.

(In reply to Karel Srot from comment #3)
> So why yum can't ask rpm?

 It does ... in certain cases. Think of it like the difference between "rpm -ql tcsh | fgrep bin/tcsh" and "rpm -qf /usr/bin/tcsh". In the later rpm can do the magic mapping for you, in the former rpm will give you the data it has and that won't match reality.
 As far as I know there isn't an rpm API for "tell me the rpm filename for this filename" ... we could maybe hack it using basename guesses.

> Why to have the 'df' command then if it produce
> useless results?

 I would object to useless results, like a bunch of other yum APIs it can't follow symlinks/bind-mounts where something is installed to X but shows up as Y ... yes, this is probably more noticable due to "UsrMove" and all the continuing fallout from it.

(In reply to Karel Srot from comment #4)
> (In reply to James Antill from comment #2)
> >  This is a generic yum vs. rpm thing ... rpm knows about fs remapping to
> > resolve files to paths, yum doesn't (and can't easily).
> > 
> >  Eg. yum provides /bin/zsh
> 
> Btw, yum provides works for me.

 Not sure what I tested, but for instance:

yum provides '/usr/bin/tcsh' (try this before and after installing)

...and this never works, even when installed:

yum provides '/usr/bin/tcs*'

...whereas this one works all the time (assuming current tcsh package as above):

yum provides '/bin/tcs*'