Hacker News new | ask | show | jobs
by 205guy 3030 days ago
On the one hand, I admire the search for knowledge, taking things apart and seeing how they work. On the other hand, this seems a bit cargo-cultish. It's as if I took apart a record player, trying to see how it plays music, and I told you it works because the motor turns the the record.

In this case, the author got tangled in the shell script and code, and totally missed the whole subtlety and complexity of the Unix architecture. I expected to see something about the processes, file system, and directory entries. Even after the author added key information that was emailed to him by a reader, he didn't really follow up or try to understand more. I understand that not all coders have or need a degree in computer science, but it really surprises me what this author doesn't know (and doesn't know he doesn't know).

Another example from his next blog about 'ls': "I’ll admit, scrolling through all this C-code can be a little tiresome. Oh, how I miss the days when all I had to do was read JavaScript source! Because C gives you so little out of the box, a lot of the code that you end up reading is not that interesting. It’s largely the kind of stuff that higher level languages implement in their standard library." [https://blog.safia.rocks/post/171381157060/looking-into-ls]

Here's a book about Unix, among many (I got this one as a CS graduation present): https://www.amazon.com/Magic-Garden-Explained-Internals-Rele...

4 comments

Everybody who comes to know about systems calls will have learned the concept for the first time. Some people come to that knowledge by becoming a web developer, gaining some rudimentary understanding of the command line, typing `which cd`, and eventually reading the bash source. The fact that this is even possible is a testament to the author's curiosity and the value of free software.

Others come to that knowledge by reading a 650 page book about System V after graduating from university. Maybe they already learned it before getting the book, in some practical circumstance, like the author. Maybe they have always known it. But for me, an article by someone in the midst of their learning is a great help, an opportunity for others to share what they know, and exemplary of the hacker spirit.

I think gp is not ragging on the blog's author for being a novice at Unix systems internals but lamenting the " I looked into this but then it all seemed so complicated so I stopped" attitude that is present in this as well as the sibling posts on sudo and ls. I would much prefer to read three posts delving deeper into the inner workings of any one of these commands than the existing three muddled surface level treatments.
I had some of the same thoughts. But I learned C and Unix a long time ago, back when you could more easily understand the source code. I think we used a very early version of Minix, just a few thousand lines. It was a simpler time ;-).

Coming to it now, with all the layers that have built up -- the side-track for the script that uses tr, and the idiom with ${1+"$@"}, and all the cruft build up within sh(1) -- it must be pretty hard to separate what is incidental from what is fundamental.

Yes, thanks for putting it more succinctly than I could. I got the impression the author set out to understand 'cd' (which I would love to read about) then didn't, and I don't think we can tell from her article how much she got out of it. I quoted the part about higher-level languages because it's been my experience that a lot of those libraries are ultimately implemented in C somewhere down at the bottom as well.

I will say I did learn about some shell along the way and the bit about processes was interesting and starting to get at the core of 'cd'. It just seems like there are many other pieces of the puzzle, and I encourage the author to keep researching and keep writing about them.

I agree. In the post about ls, I expected to read about how the program builds the list of files and directories, which system calls are involved and so on. The author doesn't seem to like reading C source code and that's fine. Studying the strace of a simple ls invocation and cross-referencing with the Linux man pages would have revealed the inner workings of the program, though.

>It’s largely the kind of stuff that higher level languages implement in their standard library

I think it's extremely interesting. It's in these libraries that the hidden fun stuff happens. For example, memory allocation and related terms like the heap seem like magic but it becomes clearer once one learns about how it works.

I had the same sentiment as yours, but the blog is fine (for the author and appropriate audience).

I am quite surprised/curious how it got to top page here.

HN is not immune to cargo cults. SV and modern "tech culture" applauds people for writing blog posts like this: "Today I decided to find out what makes the sky blue! I just thought I'd write a blog post about it." Then the culture is reinforced, as when you mention how it's stupid to upvote the blog of someone who literally admits they do not know what they are talking about, you get shouted down for not handing out participation trophies. And yes, I realize how rude this comment is, and how stereotypically anti-millennial it is. But it's what has been happening on HN for years.
I will speculate that it's because the author mentions "Julia Evans" [1] who is quite famous in this community for their articles. That or more people than I thought didn't know some details about how basic commands/built-in functions work in Unix. Nevertheless, whatever people find interesting, they upvote. Good or not, this article caught the attention of many, that's all.

[1] https://twitter.com/b0rk

Author is a she by the way.
Man or woman, the feedback seems to apply the same way.