You are not logged in.

#1 2023-08-01 08:18:39

avidseeker
Member
Registered: 2022-09-06
Posts: 68
Website

Dash as /bin/sh symlinking

When re-symlinking /bin/sh, why does ArchWiki re-symlinking /usr/bin/sh instead of /bin/sh? even in the pacman hook, it's /usr/bin/sh. Shouldn't that happen for both /bin/sh and /usr/bin/sh?

Offline

#2 2023-08-01 08:20:52

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,557
Website

Re: Dash as /bin/sh symlinking

They're the same thing. /bin is a symlink to /usr/bin.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2023-08-01 08:33:39

frostschutz
Member
Registered: 2013-11-15
Posts: 1,647

Re: Dash as /bin/sh symlinking

"it's the same thing" (realpath /bin /sbin /usr/bin /usr/sbin = /usr/bin for all of them).

So it works fine... except when it doesn't.  If you mount from a livecd and don't chroot. /mnt/root/bin/sh then points to /usr/bin/bash (the livecd bash) instead of /mnt/root/usr/bin/bash (the mounted rootfs bash).

But most people simply ignore corner cases like this.

Usually I prefer relative path symlinks (../) since they always work regardless of where it's mounted.

However in this case since it's all in the same directory anyway, just `ln -s bash sh` with no path in the symlink at all. That is usually how most links in there work anyway.

If you check all symlinks in the bin dir, there is a wild mix of direct links

unzstd -> zstd
vgmerge -> lvm
mysql_waitpid -> mariadb-waitpid
...

relative links

init -> ../lib/systemd/systemd
npm -> ../lib/node_modules/npm/bin/npm-cli.js
fmtutil-sys -> ../share/texmf-dist/scripts/texlive/fmtutil-sys.sh

absolute links

wxrc -> /usr/bin/wxrc-3.2
qdbus-qt4 -> /usr/lib/qt4/bin/qdbus
scite -> /usr/bin/SciTE

and so on

Unfortunately each project decides on its own which link style to use, there is no standard that applies to all of them. And nobody cares as long as it works, so it's just gonna stay like that.

So, you can do it which ever way you want, and what the wiki suggests is the personal preference of whoever wrote it there

(Edit: I misread the wiki, it already does the direct one anyhow. This is completely fine)

Last edited by frostschutz (2023-08-01 08:35:50)

Offline

Board footer

Powered by FluxBB