News for hackers. Stuff that matters.
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 :)