Bug 879375

Summary: # yum install /usr/bin/netstat .. does not work
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: packaging-team, pmatilai, zpavlas
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-30 16:56:40 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 Richard W.M. Jones 2012-11-22 17:39:29 UTC
Description of problem:

$ sudo yum install /usr/bin/netstat
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
No package /usr/bin/netstat available.
Error: Nothing to do

However:

$ sudo yum install net-tools
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.2.20121106git.el7 will be installed
--> Finished Dependency Resolution
[...]

$ which netstat
/usr/bin/netstat

But even after that:

$ sudo yum install /usr/sbin/netstat
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
No package /usr/sbin/netstat available.
Error: Nothing to do

Version-Release number of selected component (if applicable):

yum-3.4.3-46.el7.noarch
RHEL 7.0 20121120.1

How reproducible:

100%

Steps to Reproduce:
1. See above.

Comment 1 Zdeněk Pavlas 2012-11-23 08:45:42 UTC
/usr/sbin/netstat should be included in primary.  Looks like a packaging error.  Can you query metadata?

~$ sqlite3 /var/cache/path-to-repo-with-net-tools/gen/primary_db.sqlite
sqlite> select * from files where name = '/usr/bin/netstat';
...
sqlite> select files.name from files join packages using(pkgkey) where packages.name = 'net-tools';
...

Comment 2 Richard W.M. Jones 2012-11-23 09:41:47 UTC
$ sqlite3 /var/cache/yum/x86_64/6.92Server/rhel-7.0/gen/primary_db.sqlite 
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from files where name = '/usr/bin/netstat';
sqlite> select files.name from files join packages using(pkgkey) where packages.name = 'net-tools';
/sbin/slattach
/sbin/route
/sbin/plipconfig
/sbin/nameif
/sbin/mii-tool
/sbin/mii-diag
/sbin/iptunnel
/sbin/ipmaddr
/sbin/ifconfig
/sbin/ether-wake
/sbin/arp
/bin/netstat
sqlite> select * from files where name = '/bin/netstat';
/bin/netstat|file|1084

Installing /bin/netstat works:

$ sudo yum install /bin/netstat 
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-7.0                                                 | 3.7 kB     00:00     
rhel-7.0-optional                                        | 3.7 kB     00:00     
Package net-tools-2.0-0.2.20121106git.el7.x86_64 already installed and latest version
Nothing to do

Also:

$ ls -ld /bin
lrwxrwxrwx. 1 root root 7 Nov 22 15:40 /bin -> usr/bin

So it's something broken by UsrMove, I guess.

Interestingly, this doesn't work on Fedora 18 either.

Comment 3 Panu Matilainen 2012-11-23 09:55:06 UTC
This is indedd UsrMove braindamage:

[pmatilai@localhost tmp]$ rpm -qpl --nosignature net-tools-2.0-0.2.20121106git.fc18.x86_64.rpm |grep bin/
/bin/netstat
/sbin/arp
/sbin/ether-wake
/sbin/ifconfig
/sbin/ipmaddr
/sbin/iptunnel
/sbin/mii-diag
/sbin/mii-tool
/sbin/nameif
/sbin/plipconfig
/sbin/route
/sbin/slattach

Those are the only paths that yum will recognize for those files, although they do of course end up in /usr/bin in practise. "Fixing" this would require net-tools to install them into /usr instead, but that in turn will break any packages that have dependencies on the current /[s]bin/ paths.

Comment 4 Richard W.M. Jones 2012-11-23 12:00:30 UTC
I thought yum had been fixed somehow so that either path worked?
At least, that was my recollection ...

Comment 5 Panu Matilainen 2012-11-23 12:44:26 UTC
Nope. On rpm level symlinked paths can be interchanged for already installed packages, but for to-be-installed packages its ultimately an unsolvable issue:

On an already installed system, the other direction (specifying /bin/telnet where the actual file owned by telnet package /usr/bin/telnet) could be easily handled with realpath(), but going "backwards" is a good deal more complicated. And neither direction is "translatable" when the directories are not present on the filesystem, such as on initial installation into chroot.

Comment 6 Richard W.M. Jones 2012-11-30 17:04:37 UTC
It *is* a bug, it's just that you won't or can't fix it.