Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Some people think that UNIX is great and perfect

"...great and perfect" is a strawman. Whether "some people" think that is irrelevant.

Some of this article is interesting, but the fact of the matter is 40-year-old systems have signs of being 40 years old. If "fixing" everything were easy, it'd be done. Tabs in Makefiles throw off the uninitiated for 10 minutes, then they learn, shrug and move on. These scars and stories are part of the package.

Reading further, some of this is just incorrect...

>That’s not to mention the fact that critical UNIX files (such as /etc/passwd) that are read upon every (!) call, say, ls -l, are plain text files. The system reads and parses these files again and again, after every single call!

Not on my system.

> It would be much better to use a binary format. Or a database.

On my system, it is ( running "ls -ld ."):

  kamloops$ uname -a
  NetBSD kamloops 7.99.64 NetBSD 7.99.64 (GENERIC) #26: Thu Mar  2 07:15:26 PST 2017  root@kamloops:/usr/src/sys/arch/amd64/compile/obj/GENERIC amd64

  kamloops# dtrace -x nolibs -n ':syscall::open:entry /execname == "ls" / { printf("%s -%s", execname, copyinstr(arg0));}'
  dtrace: description ':syscall::open:entry ' matched 1 probe
  CPU     ID                    FUNCTION:NAME
    0     14                       open:entry ls -/etc/ld.so.conf
    0     14                       open:entry ls -/lib/libutil.so.7
    0     14                       open:entry ls -/lib/libc.so.12
    0     14                       open:entry ls -.
    0     14                       open:entry ls -/etc/nsswitch.conf
    0     14                       open:entry ls -/lib/nss_compat.so.0
    0     14                       open:entry ls -/usr/lib/nss_compat.so.0
    0     14                       open:entry ls -/lib/nss_nis.so.0
    0     14                       open:entry ls -/usr/lib/nss_nis.so.0
    0     14                       open:entry ls -/lib/nss_files.so.0
    0     14                       open:entry ls -/usr/lib/nss_files.so.0
    0     14                       open:entry ls -/lib/nss_dns.so.0
    0     14                       open:entry ls -/usr/lib/nss_dns.so.0
    0     14                       open:entry ls -/etc/pwd.db
    0     14                       open:entry ls -/etc/group
    0     14                       open:entry ls -/etc/localtime
    0     14                       open:entry ls -/usr/share/zoneinfo/posixrules

  kamloops# file /etc/pwd.db
  /etc/pwd.db: Berkeley DB 1.85 (Hash, version 2, native byte-order)
Now, I see that /etc/group -is- a plain file. This could get the same treatment as /etc/passwd if it becomes a burden. In the meantime, if it's a performance bottleneck, make a memoizing function to lookup groups and use a '-n' switch to ls. Article is probably mostly important as the author thinking deeply about Unix, and part of the developmental process of the user.

...All the bluster (some of which is interesting), then at the end walks it back:

> So, I do not want to say that UNIX – is a bad system. I’m just drawing your attention to the fact that it has tons of drawbacks, just like other systems do. I also do not cancel the “UNIX philosophy”, just trying to say that it’s not an absolute.

Shame about the title... But maybe that's what landed it here on HN (?)

Edit: explain the "ls" command actually run.



"This could get the same treatment as /etc/passwd if it becomes a burden. In the meantime, if it's a performance bottleneck, make a memoizing function to lookup groups and use a '-n' switch to ls."

Exactly, and this is the sort of thing that can be done with open source software. It may not even be a lot of code depending on how it is approached.


It's not even clear that for small password files, scanning /etc/passwd is any slower than a database. It's likely already in memory, and a full scan of a few kilobytes of text in highly optimized C is likely to take only microseconds.


Regarding 'ls', I ran "strace ls" on Linux and didn't see any open on /etc/password; it's important that you run 'ls -l', which should trigger the /etc/password access because it has to map UIDs to usernames.


re: "ls -l" understood. I ran "ls -ld ."


Ah, I'm not familiar with dtrace so I guess I missed that in your comment. Thanks for the clarification.


Understandable. The dtrace command you see is tracing a process "ls" (regardless of switches). I didn't show my work (ls -ld .) that generated the output, so your confusion isn't unfounded. :)




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: