News for hackers. Stuff that matters.
Re:There are only 12 binaries in Talos Linux by titanomachy on Monday March 04, 2024 @03:44PM (#39595791)
Wonder why they would use hard links instead of symlinks.

Edit: interesting, seems like there's a mild performance benefit.

https://unix.stackexchange.com/a/20716

Re:There are only 12 binaries in Talos Linux by 0xbadcafebee on Monday March 04, 2024 @03:52PM (#39595908)
There's a lot of benefits actually, as symbolic links often need to be handled as a completely different type of file with different semantics which often leads to bugs. Hard links are always better when you know you are dealing with a single static host & filesystem. Symbolic links in such a case are only better for indicating quickly to the user which files are linked to which others.
Re:There are only 12 binaries in Talos Linux by vundercind on Monday March 04, 2024 @03:54PM (#39595928)
Reverse question: why use symlinks when you can get away with hard links?
Re:There are only 12 binaries in Talos Linux by AtlasBarfed on Monday March 04, 2024 @04:49PM (#39596580)
Main thing I've seen with hard links is that deletions delete the source file which about 90% of the time isn't what an end user wants
Re:There are only 12 binaries in Talos Linux by whartung on Monday March 04, 2024 @04:53PM (#39596640)
Only if its the last hard link. If nothing else, its a wee bit of insurance from deletion since no single link removal should remove the file.

Anecdote, eons ago, we had a problem where the vendor needed to log in to the machine with the intent that they were going to upload some utilities, fix a problem, and then delete them.

Before I let them in, I set up a script that constantly scanned the directory tree they were in, and hard linked everything so I could look at what they were using later.

Re:There are only 12 binaries in Talos Linux by cpach on Tuesday March 05, 2024 @01:16PM (#39607189)
Clever solution!
Re:There are only 12 binaries in Talos Linux by wakawaka28 on Monday March 04, 2024 @08:14PM (#39598253)
It's more of a problem that changes to one linked file change the only copy. But this depends on your filesystem. Not all work this way.
Re:There are only 12 binaries in Talos Linux by rcxdude on Monday March 04, 2024 @05:00PM (#39596713)
that isn't generally how hardlinks work: you need to delete all instances of it to delete the file, as opposed to having one 'real' file like with symlinks.
Re:There are only 12 binaries in Talos Linux by wizzwizz4 on Monday March 04, 2024 @05:29PM (#39597012)
That's a problem with directory hardlinks: a recursive deletion will wipe the directory (in the same way that truncate will destroy a file regardless of how many hardlinks it has). But we don't usually allow directory hardlinks these days.
Re:There are only 12 binaries in Talos Linux by jesse9766 on Monday March 04, 2024 @09:02PM (#39598608)
Hard links only work in the same filesystem. If your system only has one volume with one filesystem (e.g. a PC) that's fine, but not a very portable option for servers.
Re:There are only 12 binaries in Talos Linux by hn92726819 on Monday March 04, 2024 @09:18PM (#39598709)
Every one of those files is in /sbin though
Re:There are only 12 binaries in Talos Linux by cpach on Tuesday March 05, 2024 @07:50AM (#39602638)
Not sure it really matters that much in this case. But why not? Hard links are a quite clean and simple concept. One “object”, multiple names.