News for hackers. Stuff that matters.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by pcwalton on Wednesday June 21, 2023 @01:37AM (#36414777)
Looking at the Unix to Plan 9 translation [1] gives me a different opinion. To name one egregious example, omitting find(1) in favor of piping du(1) (what is supposed to be a disk usage analyzer) to grep(1) is not an improvement; it's just user-unfriendliness in service of minimalist aesthetics. (Contrary to popular belief, find(1) is not a particularly "bloated" program; Rust's "fd" implementation is under 7,000 lines of code [2], about a third of the size of Lua.)

[1]: https://9p.io/wiki/plan9/Unix_to_Plan_9_command_translation/...

[2]: https://github.com/sharkdp/fd

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by wbl on Wednesday June 21, 2023 @01:41AM (#36414800)
The problem with find is that it tries to put an entire programing language into its arguments.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by jrockway on Wednesday June 21, 2023 @01:49AM (#36414856)
Is that a problem? A simple tool is good if it can solve complex problems, but a simple tool that can't is just an underdeveloped tool. Sometimes you need a complex tool to solve a complex problem.

I think a good mini language bridges the gap between interactive commands and programming. Sometimes you need to spend an hour writing a program to do something complicated. But because of various "extraneous features" built into UNIX commands, you rarely need to spend an hour manually poking at the filesystem. The mini language gets you almost as productive as a full-fledged programming language, without feeling like you're programming. (How do you know you're programming? If you "git init" and start committing stuff, you're probably programming. If your carefully-crafted thing scrolls into .history obscurity, then you're interacting.)

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by exitb on Wednesday June 21, 2023 @02:25AM (#36415083)
Find is not simple - it's easy, but internally complex. It's fine to solve a complex problem with a complex tool, but it's troublesome when people mostly use it to solve simple problems. And the trouble is that this kind of approach spreads to every single component in the system, which means that we're using insane amount of code and cpu load to solve really simple problems on daily basis.

Plan 9 is not an answer to every problem, but it's just impressive how much it can do with so little code.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by SubjectToChange on Wednesday June 21, 2023 @04:58AM (#36416120)
…we're using insane amount of code and cpu load to solve really simple problems on daily basis.

Piping programs together is almost always going to use significantly more resources than one program doing it all. More code doesn’t necessarily imply more resource usage.

Plan 9 is not an answer to every problem, but it's just impressive how much it can do with so little code.

I don’t want to be all around negative about plan 9, but I don’t see it as really solving any interesting problems. Indeed it is far easier to write slim, elegant systems when forgoing feature parity and/or competitive performance.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by exitb on Wednesday June 21, 2023 @07:04AM (#36416953)
> More code doesn’t necessarily imply more resource usage.

That's true! Yet, somehow we found ourselves in a situation where most people use computers, to chat, read news etc, all of which would be possible with much less resources. All done with the use of platforms that we literally can't rewrite, as they're too complex. It's certainly not find's fault, but the complexity creep starts somewhere.

Plan 9, as a research OS, is not a useful platform to base your next business on, but it does serve as a baseline we can relate our "real" platforms to.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by dale_glass on Wednesday June 21, 2023 @07:52AM (#36417303)
Little conveniences cost a lot.

Just having a framebuffer with page flipping for seamlessly redrawing the screen costs 64MB of memory at 4K resolution. People did real work and gaming on computers with a small fraction of that.

Early on in the history of computing the framebuffer was discussed as a theoretical construct, like "what could we do with this concept if we had the memory to implement it".

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by t0suj4 on Wednesday June 21, 2023 @02:27AM (#36415096)
After staring down find(1) on an AIX system I regret not going down the du | grep path. At least that way I wouldn't be stuck trying to mash GNU's parameters into completely incompatible version of find.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by ykonstant on Wednesday June 21, 2023 @05:10AM (#36416208)
If your system supports `man 1p` (loading the posix manual for each supported utility), it is a good idea to reference that instead of the default manpage; it is more likely for your utility to support posix options than GNU extensions in legacy and non-linux systems.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by foul on Wednesday June 21, 2023 @02:47AM (#36415210)
>I think a good mini language bridges the gap between interactive commands and programming.

find(1) is a bad mini language. Its arguments are in a legacy format and its solution for composability is a hack, and an unstable one.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by rektide on Wednesday June 21, 2023 @10:20AM (#36418794)
And shell users already have a language they know & should be able to use to compose computing: the shell.

Different programs introducing their own specific programmatic layers defeats the holistic small pieces, loosely coupled premise.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by kristopolous on Wednesday June 21, 2023 @02:07AM (#36414973)
And it makes easy things hard.

All the time arguments and size parameters and rules about depth and boolean syntax and the print0 for pipeline integration ... it makes me long for DOS interfaces from the 80s. There has to be a way to do it with less intellectual lifting every time.

Maybe just a simple set of bash reads will help - that's how I do ssh port forwarding - I was tired of getting confused.

Integration with /etc/mime would be nice as well so I can just search for, say, "image" or "video". (This would be at the frontend in this (currently) fictional helper script)

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by skissane on Wednesday June 21, 2023 @03:09AM (#36415358)
> and the print0 for pipeline integration

The existence of things like `-print0` is the downside of Unix's "all files/pipes are byte streams" design decision.

The IBM mainframe implementation of the pipeline idea – CMS Pipelines [0] – makes pipes record-based instead. Since the pipes are not streams of bytes, rather records with out-of-band boundaries, there is no need to reserve a special character (whether LF or NUL) to serve as a record separator.

> Integration with /etc/mime would be nice as well so I can just search for, say, "image" or "video"

It is a pity that Unix never had a "file type" field in the filesystem, unlike classic MacOS, Acorn RISC OS, among others. I suppose both those systems had the limitation that the file type was just a number, subsequent experience has demonstrated it needs to be a much longer string (such as a MIME type or Apple UTI). The problem with file extensions is the same extension ends up being used by completely unrelated applications for completely unrelated file formats – e.g. nowadays .doc is normally assumed to be legacy binary Microsoft Word, but many older archives it is a plain text file instead, or sometimes even some other word processing format.

[0] https://en.wikipedia.org/wiki/CMS_Pipelines

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by pcwalton on Wednesday June 21, 2023 @01:46AM (#36414832)
I agree with you to some extent, but the solution is fd: change the tool's interface to make simple things easy. Deleting the tool entirely does nobody any favors. As bad as find(1) is for simple stuff, piping du(1) to grep(1) is worse.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by comex on Wednesday June 21, 2023 @03:01AM (#36415306)
That's half of the solution. The other half, I'm convinced, will be a tool that makes complex things possible. After all, if I really need some complex filtering, find's primitive logical operators probably wouldn't even be sufficient. To that end, I love how Nushell's leading example on their home page is

    ls | where size > 10mb | sort-by modified
It seems so elegant! Down with strings! …But it's not my life yet, since last time I wanted to try Nushell they didn't have scripting yet, and I have yet to circle back around to it. There's also Elvish and PowerShell and Oil Shell but they all have their own issues.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by arp242 on Wednesday June 21, 2023 @05:04AM (#36416166)
zsh solves this with globbing qualifiers:

  ls -t *(Lm+10)
"L" for the "file size" qualifier (why "L"? For "less than size", I think – probably because "s" is already used for setuid), "m" for megabytes, "+" for "larger than". You can also add "om" or "Om" to sort by mtime, but ls will reorder it so you need the -t flag (or the -U flag to not sort things).

The syntax is not easy, even byzantine, but it's a lot less to type and pretty convenient in interactive shells.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by maleldil on Wednesday June 21, 2023 @07:44AM (#36417239)
> Nushell they didn't have scripting yet

If you mean you couldn't run batch scripts from a file, they can do that now. There's an example repo with some community scripts. My favourite is how they handle CLI parsing: https://github.com/nushell/nu_scripts/blob/main/sourced/nu_1...

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by amstan on Wednesday June 21, 2023 @01:54AM (#36414897)
Hear hear. When I use find I only use it for the recursive dir listing with no arguments. I always pipe it into grep because I know grep better.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by e12e on Wednesday June 21, 2023 @03:21AM (#36415440)
Hard to grep a list of path names for size or last modification date?

When I saw the start of this thread, I thought abusing "du" for "find" sounded insane - but after mulling it over - I guess du is just a recursive stat(1).

And I can see the logic; have a tool that builds a tree of metadata, filter with a tool that... filters.

However - as far as i can tell, du/grep on plan9 can't fill in for find(1) - but the idea (above) would probably fit with PowerShell or other "typed/rich streams" kind of shell...

https://man.cat-v.org/plan_9/1/grep

https://man.cat-v.org/plan_9/1/du

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by didntcheck on Wednesday June 21, 2023 @03:57AM (#36415699)
Sure, which lends weight to the idea that the shell should be a more extensive programming language. Then you can pass an arbitrary Predicate<File> to the finder (which would likely just be a convenience function of about 5-20 lines), and receive a list of file objects for you to do what you want with

That's the direction Powershell took, and to some extent was what other OSes were doing at the time of Unix. But Unix has become so ubiquitous and influential that we've forgotten that programs could pass more than ill-specified strings around, and that resources could implement richer interfaces rather than trying to force the file IO interface on every single one, regardless of how little sense that makes

Worse is Better may have been a useful expedience in the 20th century, but we're long overdue repaying that technical dept, to get back some of the rich OS/environment features that other camps had got working almost half a century ago. The first step would be to stop putting "Unix philosophy" on a throne

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by hutzlibu on Wednesday June 21, 2023 @04:21AM (#36415860)
"That's the direction Powershell took, and to some extent was what other OSes were doing at the time of Unix. But Unix has become so ubiquitous and influential that we've forgotten that programs could pass more than ill-specified strings around ... The first step would be to stop putting "Unix philosophy" on a throne "

Well yes, but I think it will be hard or rather impossible to convince the unix crowd of anything good coming from windows.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by c00lio on Wednesday June 21, 2023 @06:27AM (#36416741)
There are still tons of stringly-typed interfaces in powershell.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by hutzlibu on Wednesday June 21, 2023 @07:03AM (#36416947)
I did not say I am a big fan of the powershell or windows in general. But I would still like the few good ideas integrated into linux ..
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by iopq on Wednesday June 21, 2023 @04:48AM (#36416038)
Unix being stringly-typed is a huge problem.

For example, I found a flatpak of a system monitor and thought it was portable. Turns out, it parses `ps` output directly, but it's not compatible with BusyBox `ps` output

https://github.com/hakandundar34coding/system-monitoring-cen...

the author literally doesn't care since it works with coreutils `ps`

it's a culture problem

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by riddley on Wednesday June 21, 2023 @09:44AM (#36418356)
Doesn't ps just parse /proc entries these days? Seems like an odd hill for that dev to die on.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by iopq on Thursday June 22, 2023 @02:19AM (#36428585)
I suggested for him to parse /proc in that issue tracker, but he kind of stopped reading my suggestions
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by salawat on Wednesday June 21, 2023 @10:09AM (#36418659)
I'd recommend you not look at awk/sed then.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by wbl on Thursday June 22, 2023 @11:09PM (#36442340)
Awk is a real programing language (hint: who are A, W, and K) where short scripts are strings passed in via single arg. That's not find.

Sed has a fairly well designed although limited interface you again pass in.

By contrast find tries to have separate pieces strung together each as an argument.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by floren on Wednesday June 21, 2023 @01:47AM (#36414838)
I got used to `du | grep` after using Plan 9 a lot and still do it on Linux, but yeah really I think Plan 9 fans have had a tendency to ossify the pragmatic minimalism of the Bell Labs guys into a sort of cultishness... there's no reason we couldn't have find on Plan 9, but now it's almost a religious point not to have it.

On the other hand, the lack of find is not a particularly good rebuttal to the original point. If I rolled up in a prototype personal transport which could go 1000 miles on a single AA battery, would you complain that the seats were poorly stitched?

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by pcwalton on Wednesday June 21, 2023 @01:51AM (#36414870)
> If I rolled up in a prototype personal transport which could go 1000 miles on a single AA battery, would you complain that the seats were poorly stitched?

If the poor stitching were taken as a point of pride and the community refused to fix it, then yeah, I'd assume that that community values purity over practicality. Which is exactly how I feel about Plan 9: it had good ideas and was an improvement over Unix in many ways, but it was a regression in others, in large part due to choosing minimalist aesthetics over usability.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by randomdata on Wednesday June 21, 2023 @02:35AM (#36415135)
The big lesson Plan 9 seemed to have learned is that maintenance is a drag and a hinderance. find may be objectively better than du | grep for the user, but once introduced then the developers have to essentially maintain the same thing twice and carry that baggage forever into the future.

In a parallel universe where Unix did not take on so much baggage, perhaps it could have even naturally evolved towards Plan 9 and Plan 9 would have not been a necessary break. But then, like Plan 9, maybe Unix would have never rose up to see any widespread use to make that evolution significant.

Tradeoffs, as always.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by mikepurvis on Wednesday June 21, 2023 @07:08AM (#36416980)
I always feel guilty that find . | grep <pattern> is easier for me than remembering how find's flags work. But I think it's really a case of my brain rejecting exactly the redundant baggage you're speaking of here.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by salawat on Wednesday June 21, 2023 @10:05AM (#36418612)
What's hard about "find . -regex <regex> -exec <stuff> /;"

Hardest thing that comes to mind is there's some slight portability differences to look out for between GNU find and BSD find that may require a quick man dive with relation to the max depth handling, but that's about it.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by eschneider on Wednesday June 21, 2023 @03:20PM (#36423071)
Ah...find's "swiss army chainsaw" mode. So, so useful. :)
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by herewulf on Thursday June 22, 2023 @01:44AM (#36428391)
You just answered your own question because it's "\;" not "/;". And the "{}" placeholder syntax isn't exactly intuitive either (maybe there is some connection to awk or sed? I only know enough of those to be dangerous).

I've used find extensively in the past two decades and even read the man page (gasp) on occasion, but it's one coreutils command that I have always found cumbersome. I recently discovered fd and I have a feeling that I will be switching to that where I can, muscle memory be damned.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by Hendrikto on Wednesday June 21, 2023 @07:41AM (#36417228)
> The big lesson Plan 9 seemed to have learned is that maintenance is a drag and a hinderance.

So they chose to just never finish the OS instead.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by randomdata on Wednesday June 21, 2023 @11:17AM (#36419608)
No, they did choose to finish the OS. The final release came quite a number of years ago.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by floren on Wednesday June 21, 2023 @01:53AM (#36414882)
But the fact is that you could get a decent find into Plan 9 in a day's work. Hell, you could probably just compile some existing Go version of find without any changes. Trying to get Plan 9-style namespaces into Linux is not nearly so trivial.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by colonwqbang on Wednesday June 21, 2023 @02:22AM (#36415061)
It's not about "find" in particular, that was just an example brought up to illustrate the general point. If "find" was the only thing missing to bring Plan9 up to Linux usability standards, that would indeed be easy to fix.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by ludston on Wednesday June 21, 2023 @01:50AM (#36414860)
Realistically yes. But I would still use it.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by thesuitonym on Wednesday June 21, 2023 @02:43AM (#36415196)
Would, but don't?
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by deely3 on Wednesday June 21, 2023 @04:11AM (#36415791)
Would complain, and would use it.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by amoss on Wednesday June 21, 2023 @03:22AM (#36415441)
The thing that I use find for most commonly is to perform a hierarchical grep, i.e

find . -exec grep -Hn regex \{\} \;

How would you do that with the du | grep combo?

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by geosh on Wednesday June 21, 2023 @04:11AM (#36415792)
... | xargs grep -Hn regex

This will also be faster, because you fork less.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by arp242 on Wednesday June 21, 2023 @04:45AM (#36416027)
Using \+ instead of \; will do the same (fork less).

du -a will need to do a stat to get the file size, which is comparatively expensive; I don't think find will (not sure)?

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by jlokier on Wednesday June 21, 2023 @07:07AM (#36416969)
You're right, find won't call stat() unless it needs to. It doesn't need to for recursing through the directory tree because readdir() returns dirent.d_type these days to determine if a name is a directory.

Yes, those stat() calls can be very slow in aggregate on a large tree, especially from HDD (due to seeking) or network filesystem, if the stat information isn't already in cache.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by geosh on Wednesday June 21, 2023 @01:13PM (#36421397)
Oh, I forgot about \+. I still pipe to xargs every single time.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by ykonstant on Wednesday June 21, 2023 @05:07AM (#36416183)
Does this deal with arbitrary filenames (having newlines, control chars etc) correctly? Or does Plan9 forbid such filenames?
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by geosh on Wednesday June 21, 2023 @01:13PM (#36421385)
I've never used plan9. In Linux you do "find -print0 | xargs -0" to deal with that.

Im not sure how one can do \0 separator with du, plan9's du(1) doesn't list such option.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by somat on Wednesday June 21, 2023 @04:26AM (#36415906)
grep -R
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by amoss on Wednesday June 21, 2023 @06:09AM (#36416622)
but old habits die hard :)
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by jxy on Wednesday June 21, 2023 @02:24AM (#36415078)
The new kid just learned to walk(1).

http://git.9front.org/plan9front/plan9front/HEAD/sys/src/cmd...

329 lines of code.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by nmz on Wednesday June 21, 2023 @01:09PM (#36421317)
For nix: https://github.com/google/walk

You can also use dmenu's stest to do the equivalent to find's -type f, { walk $PWD | stest -f }

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by jxy on Wednesday June 21, 2023 @11:31PM (#36427714)
The walk(1) on 9front seems to have grown up and supports many options: http://man.9front.org/1/walk
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by doctor_eval on Wednesday June 21, 2023 @02:50AM (#36415226)
Perhaps depends on your definition of “user friendly” - Find is certainly not going to be at the top of my own list. Half the time I use ls -lR | grep because I can’t be bothered to rediscover the right find option - which won’t even do what I want the first time I try it.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by vbernat on Wednesday June 21, 2023 @03:05AM (#36415336)
Then you can use "find | grep".
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by doctor_eval on Wednesday June 21, 2023 @08:50AM (#36417800)
Find works without parameters? I don’t think that’s always been the case, and it doesn’t work on MacOS.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by vbernat on Thursday June 22, 2023 @02:47PM (#36436885)
In this case, "find . | grep".
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by jabl on Wednesday June 21, 2023 @03:06AM (#36415341)
I would guess the minimalism was a practical choice at the time, given it was a pretty small team making an entire OS. Had Plan 9 ever become some kind of commercial (or even open source) success, I'm sure a find command would eventually have found its way in.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by foul on Wednesday June 21, 2023 @03:10AM (#36415362)
Yeah find is a bad example for bloat, compared to GNU echo or GNU yes. find AFAIK is mentioned more for horror stories, Bernstein insults, as an example for alien parts of UNIX-like OSes which prevent from a streamlined, predictable-in-your-head experience. "It isn't windows server", a statement which devoids of meaning sometimes with powershell and with Azure cloud apis, but eh.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by lproven on Wednesday June 21, 2023 @07:57AM (#36417323)
« To name one egregious example, omitting find(1) in favor of piping du(1) [...] to grep(1) is not an improvement »

I agree, but it seems to me that this is partly because it's stuck in its tiny little niche and never got the rough edges worn down by exposure to millions.

I was a support guy, not a programmer. I started Unixing on SCO Xenix and later dabbled in AIX and Solaris, and they were all painful experiences with so many rough edges that I found them really unpleasant to use.

Linux in the 1990s was, too. Frankly WinNT was a much more pleasant experience.

But while Win2K was pleasant, XP was a bloated mess of themes and mandatory uninstallable junk like Movie Maker. So I switched to Linux and found that, 5-6 years after I first tried Slackware and RHL and other early distros with 0.x or 1.0 kernels, it was much more polished now.

By a few years later, the experience for non-programmers was pretty good. It uses bold and underline and italics and colour and ANSI block characters, right in the terminal, because it assumes you're using a PC, while the BSDs still don't because you might be on a dumb terminal or a VAX or a SPARCstation or something. (!)

Linux just natively supports the cursor keys. It supports up and down and command-line editing, the way Windows does, the way PC folk expect. BSD doesn't do this, or very poorly.

Linux just natively supports plain old DOS/Windows style partitions, whereas BSD did arcane stuff involving "slices" inside its own special primary partitions. (GPT finally banishes this.)

I've taken this up with the FreeBSD and OpenBSD devs, and they just plain do not understand what my problem is.

But this process of going mainstream on mainstream hardware polished the raw Unix experience -- and it was very raw in the 1990s. Linux from the 2nd decade of the 21st century onwards got refined into something much less painful to use on

Plan 9 never got that. It still revels in its 1990s-Unix weirdness.

If Plan 9 went mainstream somehow, as a lightweight Kubernetes replacement say, it would soon get a lot of that weirdness eroded off. The purists would hate it, of course, just as BSD purists still don't much like Linux today.

Secondly, Plan 9 did a tonne of cleaning up the C language, especially (AFAICT) after it dropped Alef. No includes that contain other includes is obvious and sensible and takes orders of magnitude off compilation times. That rarely gets mentioned.

The other vital thing to remember is that despite 9front (and HarveyOS and Jeanne and so on), Plan 9 was not the end of its line.

After Plan 9 came Inferno.

I have played around with both and just by incorporating late-1990s GUI standardisation into its UI, Inferno is much more usable than Plan 9 is.

Plan 9 made microkernels and loosely-couple clustering systems obsolete >25y ago.

A decade or so later, Inferno made native code compilation and runtime VMs and bytecode and all that horrible inefficient 1980s junk obsolete. It obsoleted WASM, 2 decades before WASM was invented.

With Plan 9, all the machines on your network with the same CPU archuitecture were parts of your machine if you wanted.

(A modernised one should embed a VM and a dramatically cut-down Linux kernel so it can run text-only Linux binaries in system containers, and spawn them on other nodes around the network. Inelegant as all get-out, but would make it 100x more useful.)

But with Inferno, the restrictions of CPU architecture went away too. The dream of Tao Group's Taos/Intent/Elate, and AmigaDE, delivered, real, and FOSS.

When considering Plan 9, also consider Inferno. It fixed some of the issues. It smoothed off some of the rough edges.

I feel, maybe wrongly, that there could be some mileage in somehow merging the two of them together into one. Keep Plan 9 C and native code as an option for all-X86-64 or all-Arm64 clusters. Otherwise, by default, compile to Dis. Maybe replace Limbo with Go.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by GabrielTFS on Wednesday June 21, 2023 @04:15PM (#36423759)
> No includes that contain other includes is obvious and sensible and takes orders of magnitude off compilation times. That rarely gets mentioned.

That seems like an insane concept. I honestly can't see how it can be justified in a world where pretty much every compiler since the 90s has support for `#pragma once` and detects include guards automatically without re-reading the header.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by lproven on Thursday June 22, 2023 @10:45AM (#36432935)
Oh really?

Can you illustrate this with examples? Ones that are from outside of the Unix and C family, just to make it clear that we aren't talking about tweaks to old tools?

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by GabrielTFS on Saturday June 24, 2023 @04:13AM (#36456639)
Examples of what ? Also, what exactly do you mean by "outside of the Unix and C family" ?

(note: if you want examples of compilers that have `#pragma once` then I don't know what to say because I'd be hard-pressed to name a compiler that does not support it - similar situation w.r.t. header-guard detection)

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by lproven on Monday June 26, 2023 @11:02AM (#36480494)
You said:

> pretty much every compiler since the 90s has support for `#pragma once`

I asked for examples.

Specifically I am asking for examples that are not C compilers, do not compile languages derived from or related to C, and which do not run on Unix-like OSes, because what we are talking about here is what came after Unix. Plan 9 is effectively Unix 2.0: it is what the people who designed and built Unix did next.

Inferno is Unix 3.0. It's what they did after Plan 9.

Tweaks to the project that they had moved on from (or clones thereof, e.g. Linux) are not particularly interesting or relevant in this context, IMHO.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by GabrielTFS on Monday June 26, 2023 @11:02PM (#36488404)
> Specifically I am asking for examples that are not C compilers, do not compile languages derived from or related to C, and which do not run on Unix-like OSes, because what we are talking about here is what came after Unix. Plan 9 is effectively Unix 2.0: it is what the people who designed and built Unix did next.

You want me to cite compilers that don't compile C that support a C extension ? And you want the language it compiles to be completely unrelated to C ?

Frankly, I'd already be quite hard-pressed to even cite a compiler that compiles a language that is completely unrelated to C in the first place and doesn't run on any Unix-like OSes (I guess maybe something like cmd.exe (...though it's an interpreter, not even a compiler) or some assembler written entirely in assembly (though an assembler isn't typically considered much of a compiler) or something like that ? Does Windows even count as "not Unix-like" ? Does Wine mean it runs on Unix-like OSes ?)

This just makes your criteria seem like it can't match any compiler at all, quite frankly, unless you're asking to trawl through truly ancient stuff from the 60s that I wouldn't even be able to test at all in the first place (since by the criteria you've given it must not be able to run on my laptop)

Also, I'll add that you're likely to be correct in the most literal sense - I don't expect many compilers for languages that don't directly descend from C to include anything like `#pragma once`, because they're using a completely different model from C: almost no languages these days use "copy-paste" style file inclusion to handle libraries, and if they do anything like that, `#pragma once` is implied and never needs to be manually specified.

But in practice, `#pragma once` allows C libraries headers to work just like in many other languages - they can freely include other libraries without forcing the user to do so themselves manually.

Just imagine if you had to follow the Plan 9 C scheme on other languages, imagine if everyone that did `import argparse` in Python had to then add `import os`, `import re`, `import gettext`, `import warnings` and `import sys` because `argparse` can't do it itself without fear of double inclusion (...and then you'd also have to manually add `import abc`, `import stat`, `import enum`, `import functools`, `import unicodedata`, `import copyreg`, `import posix`, `import posixpath`, `import nt`, `import ntpath`, `import subprocess`, `import io`, `import locale`, `import builtins`, `import linecache`, `import tracemalloc`, `import traceback`, `import types`, `import operator`, `import reprlib`, `import collections`, `import weakref`, `import typing`, `import genericpath`, `import pwd`, `import errno`, `import time`, `import signal`, `import threading`, `import contextlib`, `import fcntl`, `import msvcrt`, `import select`, `import selectors`, `import grp`, `import encodings`, `import tokenize`, `import fnmatch`, `import pickle`, `import itertools`, `import textwrap`, `import keyword`, `import atexit`, `import gc`, etc. as the nested dependencies of os/re/gettext/warnings/sys/etc.)... I can't imagine anyone would consider that a good thing.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by lproven on Tuesday June 27, 2023 @06:04AM (#36490931)
Thanks. You inadvertently completely confirm the point that I was seeking to validate.

> You want me to cite compilers that don't compile C that support a C extension ?

No.

There are, hmm, I am not sure, at least 2, probably 3, and I suspect more than 3 assumptions in here.

#0, general context:

The bigger picture here is that there is a whole world of OS and language development which is completely outside the world of Unix, C, and things that derive, directly or indirectly from it.

However, the Unix+C world is so big, so commercially successful, that a lot of people in it can't see that there is anything else. To quote Gaiman and Pratchett, it's the same as the reason that "people in Trafalgar Square can't see England".

I wrote about this recently: https://www.theregister.com/2022/03/29/non_c_operating_syste...

#1. Plan 9 is not a Unix. It's what came after Unix. As such, I would say it's fair to say that Plan 9 C is not plain ol' Unix C. While the Unix flavour of C has continued on its own path, it's a very conservative path: it's terrified of breaking backwards compatibility. The developers of Plan 9 were not scared like this, and quite cheerfully made big sweeping changes.

#2. So, yes, I would consider that carefully implementing and adding what you yourself call an extension to an existing compiler (or set or family of compilers, it doesn't really matter) is not the same thing as redefining the semantics of a language to say "you are not allowed recursive includes".

One is a big sweeping change; the other is a minor tweak.

#4. The core, important point here is that Plan 9 made significant changes which in places have big ramifications — for instance, performance improvements on the order of several orders of magnitude — simply by tightening up the rules around an existing, well known language. IMHO, adding a new compiler directive is not comparable to this.

Adding a new directive is patching a hole, while changing the rules of how the languages compiled is fixing the design. What I was enquiring about was other designs that fix this problem in the core design of traditional compilers, in other words UNIX C and its descendants.

> And you want the language it compiles to be completely unrelated to C ?

Well, yes! Why not? There are lots of them!

> Frankly, I'd already be quite hard-pressed to even cite a compiler that compiles a language that is completely unrelated to C in the first place and doesn't run on any Unix-like OSes

Really? OK then, let me see how many I can name of the top of my head without googling: Pascal, Lisp, APL, Fortran, Cobol, Algol, BCPL, Forth, Ada, Prolog, Bliss... Okay I'm starting to struggle a little bit now, but I think the point is made.

I wasn't asking for languages that don't run on UNIX. I was asking for languages that weren't built out of UNIX tools. There are legions of languages today that were built pretty much entirely from the existing UNIX toolchain, from Python to JavaScript. My point is that there are dozens to hundreds of languages which are outside of that family.

Plan 9 is, I would argue, outside of that family because it's what came after that family.

Operating systems from outside of the UNIX family? Classic MacOS, AmigaOS, CP/M, MS-DOS, Atari ST TOS, Concurrent CP/M, Concurrent DOS, DR FlexOS, Novell Netware, OS/2 and all of its descendants, GEOS, Palm OS, Newton OS, Microware OS9, Interlisp/Medley, OpenVMS, OpenGenera.

And of course basically all mainframe operating systems... Tools that are still worth billions of dollars today, whose daily use affect everyone who uses a bank account or everyone who ever travels on an aeroplane.

So, yeah, a pretty significant technological and economic market segment… and one that UNIX people often totally forget exists at all. As it seems you did.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by GabrielTFS on Wednesday June 28, 2023 @12:45AM (#36502419)
> I wasn't asking for languages that don't run on UNIX.

That sure is quite a useful precision to make - personally I found what you were asking for confounding given I can't really think of much of any language that doesn't run on UNIX, save for particularly obscure, often long-defunct ones (i.e. languages that basically don't run on anything at all or on stuff I couldn't possibly check out myself anyway). The fact you've also implicitly added the stipulation that only languages that derive from C and not all those that are related to it are excluded is also quite useful - I was excluding languages like BCPL or Algol on that basis (and I was quite iffy on Fortran/Pascal and a few others too, though since most ran on UNIX I wasn't even considering most of them anyway).

Also, while I broadly agree with your point about most people not even thinking stuff outside of Windows/UNIX exists and indeed find it quite acutely accurate in many cases, I'd say I'd hope I wouldn't be counted in it - I could have named most of the OSes and languages you did, save for a few like Microware OS9 or Bliss, simply I did not name the languages when prompted to because I'm not really aware of any that can't run on UNIX-like OSes, which I had then thought you were excluding before you clarified things.

Anyway, I'm aware of my ignorance of many of the details that are involved, but more importantly for what we were discussing, I would find it remarkably unlikely that any of these languages has a dependency handling system quite alike to that which is involved in Plan 9.

Are you actually telling me that you know of many examples of languages and/or compilers that handle dependencies like in Plan 9 ? That want you to manually specify all the dependencies of all the libraries you want to use before you can use that library, and which consider this sane in any way ?

If any actually exist, then I'd expect there's either: 1. Tooling around them specifically made to work around this exact issue by automatically specifying the dependencies when needed without having to spell them out manually 2. Preferred alternatives that don't have this problem in the first place

Meanwhile, the `#pragma once`-style model (i.e. make it so that imported libraries can use a separate library without ending up with asinine "double definition lol" errors if the program that uses the first library also separately uses the second one) seems like the evident standard that all the other languages use, such as:

- Ada

- Fortran

- Pascal

- APL

- Cobol

- Algol

- Prolog

within which I've found no examples of needing to do something like `import definitions_every_single_library_or_module_relies_on` and `import definitions_from_the_library_almost_every_single_other_library_or_module_uses` at the top of almost every file.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by lproven on Wednesday June 28, 2023 @10:21AM (#36506915)
I am genuinely glad it was helpful!

In general, what I am getting at is that Unix is a (?) uniquely weird situation that happens to have grown like Kudzu. It's an early generation of a long running project, where that early generation caught on and became massive and thus ignores simple but profound improvements from later versions of the same project.

And since in that ecosystem, almost everything is built on a foundation of C, problems with C affect everything layered on top... even though they do not in any other ecosystem. But something like 99% of inhabitants of the ecosystem are not even aware that other ecosystems even exist, let alone knowing anything about them.

If they know of any, it's macOS or Windows. macOS is also UNIX, and modern Windows is NT, which is Windows built with Unix tools and a Unix type design... so they are not really different at all.

So what I am getting at is that Plan 9 has aspects other than the namespaces and the cosmetic aspects of the design. It makes changes to the language and how it's compiled that are just as important, and hacks to gain some of that on modern versions of the parent OS family are not of comparable significance.

Famous quote:

<<

So... the best way to compare programming languages is by analogy to cars. Lisp is a whole family of languages, and can be broken down approximately as follows:

* Scheme is an exotic sports car. Fast. Manual transmission. No radio.

* Emacs Lisp is a 1984 Subaru GL 4WD: "the car that's always in front of you."

* Common Lisp is Howl's Moving Castle.

>>

Comparison: if somehow you make a pruned-down Howl's Moving Castle, you can probably never ever, whatever you do, no matter how much effort you invest, make it into something as small and light as the Subaru, let alone the sports car.

In more detail:

Let's imagine one team invented first the train, then the bicycle, then the car.

The bicycle takes the idea of a wheeled vehicle from the train but reduces it down to an incredibly minimal version. It needs no fuel, just 2 wheels, but it is very simple, very light, and can go almost anywhere.

Although you do need 1 per passenger, it's true, whereas a single carriage train can carry 100 people, you can make 100 bicycles for those 100 people with fewer materials than that 1 train, even excluding consideration of the rails etc.

If someone still making trains looked at bicycles and inspired by them came up with a train with just 2 wheels, that balanced or hung from the track, they do not get to claim that they have successfully imported the simplicity of the bicycle.

They have retained just one aspect and may have achieved savings in moving parts, or slight reduction of complexity, or a slightly simpler machine... but it's still a train.

If you tweak a conventional C compiler to not waste time rereading text that has already been read once, or a disk cache obviates it, then you have not caught up with the advance I am trying to discuss here.

For clarity, this is not my original thinking. This idea is from a Go talk over a decade ago:

https://go.dev/talks/2012/splash.article#TOC_5.

Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by ori_b on Wednesday June 21, 2023 @08:19AM (#36417526)
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by rakoo on Wednesday June 21, 2023 @09:48AM (#36418412)
Personal experience: find gets hard to use, and I always have to resort to piping into grep anyway. Maybe I should learn how find works; maybe I should just stick with standard tools. And if `du | grep` gets too long to type, especially with arguments, then that's where I write a script for my common use.

> Rust's "fd" implementation is under 7,000 lines of code

Not counting the 23.8k files, not even lines of code, of rust (https://github.com/search?q=repo%3Arust-lang%2Frust++languag...). Comparison should happen on a similar baseline