Hacker News new | ask | show | jobs
by scoodah 632 days ago
Some of the things you point out here are things you cannot rely on in Linux consistently, either. You can’t rely on Systemd existing in Linux. You can’t rely on bash being the shell in Linux. Depending on the users system and distribution these tools may or may not exist.

Also the difference in some of the tools CLI flags wind up boiling down to being the BSD versions of them as opposed to the GNU versions of them. Which, again, isn’t a problem isolated to MacOS.

If you’re considering all Unixes everything you said basically still applies even if you remove MacOS from the equation. Unix isn’t just Linux.

2 comments

The only practically relevant Linux environments you can't expect these things to exist are stripped down distros used for docker images, like Alpine (where you don't expect much from the system anyways) and Android (not sure about the latter, haven't used it in production in quite a while, but afair it's as non-standard as it gets).
Not true at all.

> Zsh is different from bash

Ubuntu has had a non-Bash system shell (dash is /bin/sh) since 6.10.

> no systemd

Without getting into objected-on-principle distributions like Devuan, tons of stripped-down and embedded linux distros besides Android and Alpine don't have systemd, e.g. DD-WRT, OpenWRT, TinyCore. Heck, launchd is more similar to systemd than SysV init was.

> /dev or /proc or /etc

Other than the parts specified by POSIX, the /dev filesystem is the wild west across tons of Linux and Unix systems, and expecting further standardization in behavior from it is a fool's errand (e.g. device name selection, device ID assignment order at boot, presence of metadata-symlinked directories like by-id, overlay/loopback devices ... all of these are highly variable even across modern, systemd-using Linux distros). I do miss /proc, though I don't miss the file descriptors it costs. /etc and XDG standards for configs are nice conventions to be sure, but a significant minority of Linux software breaks with those conventions (all-/opt install locations, anyone?).

> different filesystem,

Sure, APFS isn't ext3/4. Neither are XFS, ZFS, BTRFS, and so on. ext3/4 is a tenuous standard at best, and many businesses make a point of preferring other filesystems on Linux.

...like, I think you might have just been getting lucky and using a fairly similar set of Linux distros such that MacOS was a big switch. There are plenty of valid beefs with MacOS's divergences (don't get me started on an OS that claims certified POSIX compliance while providing a plethora of low-level system APIs documented to break in the presence of fork(2), or the not-quite-superset clusterfuck that is FSEvents vs. MacOS's not-quite-BSD-complete kqueue implementation, or the Sophie's choice of bizarre xattrs behavior vs. the historical accident that is aliases), but what you listed isn't even remotely standard Linux behavior, much less Unix behavior.

EDIT: I'm stupid and a bad reader.
I appreciate your candor, I wish it was more common.
What are you talking about? I'm responding directly to a comment that called those two things out.

My point was that systemd and bash are _not_ part of a linux system, and you can't count on them being there.

You're right, and I was not reading carefully (the grayed out GGP didn't help)
Tip: when a greyed out comment is difficult to read, click on its timestamp. That will open a view on just that comment and its replies and it will not be greyed out in that view.
That is a great tip, I had no idea. Thanks!
No worries. Also definitely not something to call yourself stupid over in your edit :)