4 ms·
I wonder what happens if you violate the 0 xor 1 rule by hard linking a directory - it is strongly discouraged for very good reasons but was at least historical
by yjftsjthsd-h 3y ago
I wonder what happens if you violate the 0 xor 1 rule by hard linking a directory - it is strongly discouraged for very good reasons but was at least historically possible ( https://askubuntu.com/questions/210741/why-are-hard-links-not-allowed-for-directories https://askubuntu.com/questions/210741/why-are-hard-links-no... comments discuss a bit in between the dire warnings). Or maybe it's not possible on newer systems that have such a cache?
- bombcar 3y agoApple allows hard linking directories (I believe it is used for Time Machine somehow): https://jameshunt.us/writings/linking-dirs-in-macos/ https://jameshunt.us/writings/linking-dirs-in-macos/
- stouset 3y agoIs that true on APFS? I know they added it to HFS+ for Time Machine, but I’d assumed it’s no longer necessary (or possible) with the newer filesystem that allows for real snapshots.
- comex 3y agoIt’s no longer possible.
- trws 3y agoI miss this in the days of APFS actually. As much as it’s potentially dangerous, in a system without bind mounts readily available it really was sometimes the best solution to a problem. Mainly used it to allow various directories that couldn’t be moved to be re-homed, looking at you OneDrive.
- Ericson2314 3y agoYou can do it with FUSE I'm pretty sure
- eru 3y agoYes. I've done that (but only on immutable filesystems, where it's not (much of?) a problem).
- yjftsjthsd-h 3y agoBeing ro helps with deleting directories (by preventing it, but w/e), but cyclical links would be bad regardless. Granted, it's the kind of thing that's probably okay if you know what you're doing well enough to avoid the footguns... but I have no experience, so can't say for sure.
- eru 3y agoOh, I didn't have any cycles. I was exposing a git repository as a DAG of directories via FUSE, and was translating git internal IDs, based on hash, straight to inodes in a one-to-one fashion. Git doesn't allow cycles (unless you break the cryptographic hash function).
- Affric 3y agoThat’s a good write up.
- cduzz 3y agoI remember back in the Solaris days there was the "link" command that would allow you to make hard links of directories. My memory's bit rotted but I believe fsck would complain about the hard linked directories; I don't remember what it did with it. Apparently the link[1] command still exists and the man page says "this does not do any error checking" [1]https://docs.oracle.com/cd/E26505_01/html/816-5166/link-1m.html https://docs.oracle.com/cd/E26505_01/html/816-5166/link-1m.h...