Interesting... I see similar strangeness:

<bel-kwinith:~/Desktop$> ls -li /usr/bin/which /bin/which
659285 -rwxr-xr-x. 1 root root 24336 May  2  2014 /usr/bin/which
659285 -rwxr-xr-x. 1 root root 24336 May  2  2014 /bin/which

Both are the same inode, so the link count *should* be 2.  The same is true of "bash":

<bel-kwinith:/tmp$> ls -li /bin/bash /usr/bin/bash
658498 -rwxr-xr-x. 1 root root 960608 Sep  5  2017 /bin/bash
658498 -rwxr-xr-x. 1 root root 960608 Sep  5  2017 /usr/bin/bash


But if I make links to a file, the link count is right:
<bel-kwinith:/tmp$> ls -li hello
2756645 -rw-rw-r--. 1 mengel mengel 1 Oct  8 10:35 hello
<bel-kwinith:/tmp$> ln hello goodbye
<bel-kwinith:/tmp$> ls -li hello goodbye
2756645 -rw-rw-r--. 2 mengel mengel 1 Oct  8 10:35 goodbye
2756645 -rw-rw-r--. 2 mengel mengel 1 Oct  8 10:35 hello
<bel-kwinith:/tmp$> ln hello aloha
<bel-kwinith:/tmp$> ls -li hello goodbye aloha
2756645 -rw-rw-r--. 3 mengel mengel 1 Oct  8 10:35 aloha
2756645 -rw-rw-r--. 3 mengel mengel 1 Oct  8 10:35 goodbye
2756645 -rw-rw-r--. 3 mengel mengel 1 Oct  8 10:35 hello

I'm almost tempted to remove one of them to see what happens to the other :-).

On 10/08/2018 10:12 AM, aleksander.baranowski wrote:
[log in to unmask]">
Hi,

Sorry for spamming mailing lists once more, but I'm probably missing
something.

So we have this package on called which-2.20-7.el7.x86_64.
The
`rpm -ql which | grep bin` returns:
/usr/bin/which

In the same time, there is `/bin/which` file that according to the
package is not provided with `which`.

then `rpm -qf /usr/bin/which /bin/which` returns
which-2.20-7.el7.x86_64
which-2.20-7.el7.x86_64

Tells us that the package provides this files.
Then
`stat /usr/bin/which /bin/which | grep -o 'Inode: [[:digit:]]*'`
return the same Inode for both files. But
ll /usr/bin/which /bin/which returns number of links that is equal 1. So
it's not hardlinked.

I'm baffled.

Any explanation is welcome.

Bests,
Alex




--
Marc W. Mengel
Software Services Senior Developer

Data Management and Applications
Fermi National Accelerator Laboratory
630 840 8256 office
www.fnal.gov

Connect with us!
Newsletter | Facebook | Twitter