Number in man page titles e.g. sleep(3) (lalitm.com)

by thunderbong 84 comments 127 points
Read article View on HN

84 comments

[−] mjlee 39d ago
If you like man trivia (and why else would you be reading this?) you could check out the top comment at https://unix.stackexchange.com/questions/405783/why-does-man...

(discussed at https://news.ycombinator.com/item?id=27994194)

[−] jedberg 39d ago
Another fun related one: If your username is Tyler and you run shutdown, instead of the usual message it will say "Oh, good morning Mr. Tyler, going down?"

Discovered this in college when I was shoulder surfing a coworker who always used the username Tyler. When he typed shutdown I called it out, and he said, "wait, it doesn't do that for you? I always assumed it said that for everyone and just replaced the username!".

(For those of you too young to know, it's a reference to an Aerosmith song)

[−] hulitu 38d ago
This was removed years ago from sysvinit, for political reasons.
[−] qiine 39d ago
"The developer of the man-db, Colin Watson, decided that there was enough fun and the story won't get forgotten"

Haha! Adequate amount of fun was provided, please resume regular man activities.

[−] porise 39d ago
Reading this makes me wonder if Easter eggs are ever appropriate for something as ubiquitous as man.
[−] embedding-shape 39d ago
Personally I think ubiquitous software is even more important to have Easter eggs, because they're the most widely distributed, and we want as much joy as we could possibly have, before you know.
[−] bombcar 39d ago
Easter eggs are always appropriate but it is imperative (and important) to understand how they could affect anything and everything.

Which means you need to usually make it explicit to call them (man --abba or something) than something that "surprises" the user.

[−] jedberg 39d ago
Almost everything had an easter egg in it back in the day. When computing was more fun and less serious.

They fell out of favor when people realized they were a security issue, because it was a code path that rarely got tested.

[−] embedding-shape 39d ago
No, proper easter eggs don't introduce security issues, they're benign almost by definition. I think what made them disappear was the introduction of all the suit-wearing people who decide what the programmers are supposed to program, with no room for autonomous work within that.
[−] jedberg 39d ago

> proper easter eggs don't introduce security issues

Proper code doesn't either, and yet there they are! The point is they added another attack surface, however small, and another code path that should be tested.

When people started to care about 100% test coverage, they started to disappear.

[−] embedding-shape 39d ago

> The point is they added another attack surface, however small, and another code path that should be tested.

I dunno, "attack surface" to me means "facilitate opening/vulnerability somehow" and none of the easter egg code I've seen has done that. You have any concrete examples where a easter egg made possible a security vulnerability that wouldn't be possible otherwise?

But yes, another code path created by easter eggs that wasn't tested I've seen countless of times, but never been an issue, but maybe our easter eggs always been too small in scope for that.

[−] jedberg 39d ago
The most famous is the Xbox hack that was only possible because of an Easter Egg:

https://security.stackexchange.com/questions/144202/are-ther...

[−] hulitu 38d ago
Microsoft code. The "hacker" went for the lower hanging fruit.
[−] xoxxala 39d ago
Or they were removed for other reasons than security.

In Star Trek: 25th Anniversary, we had a hidden animation of Captain Kirk's toupee jumping off his head and running out of the room. It was caught before release and they made us take it out since no one wanted to piss off William Shatner.

[−] throwanem 39d ago
It should make you wonder instead about the appropriateness of testing over man(1) output, I suppose unless you're actually generating the format for use as man(1) input, in which case congratulations on your functional tests doing their job!
[−] cozzyd 39d ago
A great innovation over simple AB testing
[−] gerikson 39d ago

> (... less common section numbers)

One very important section number is 5 - it's for file formats. So if you forget the crontab format, you need to invoke man 5 crontab to read about it.

[−] linsomniac 39d ago
... because if you do man crontab you get section 1, which does not document the crontab fields.
[−] voidUpdate 39d ago
In fact, the only reference to crontab(5) is in the SEE ALSO section (on my version anyway), but that doesn't say why you might want to see crontab(5), just that it exists. That is spectacularly useless
[−] IshKebab 39d ago
That is incredibly stupid. A documentation system designed by someone who doesn't understand how people use documentation.

If man was designed by someone with any taste at all it would at least give you a menu to select (1) crontab command, (5) crontab file format. Maybe we need a rewrite in Rust to fix that.

[−] driftcoder 39d ago
man -k crontab is the real trick here. shows both sections so you don't have to already know the number exists.
[−] throwanem 39d ago
Remarkable that no one yet here, including the article author, reports the true origin of these section numbers: they identified (depending on section size, one or a group of) physical binders in the series published by AT&T to document System V UNIX, and when you got an update to your system software, it came with a package of new manual pages which you would physically install in the binders to replace the now-superseded older versions. Everything you hate about man pages is in consequence of that origin, and of the corollary that the online version was never designed to be authoritative.

I have one of those physical binders, a volume of Section 3 for an AT&T 3B2, in the software section of my library downstairs. A beautiful artifact in every respect, of the level of quality you would imagine in the manual for a machine that cost $15,000 in the 80s.

[−] beej71 39d ago
My favorite piece of man trivia is from the source of the tunefs BSD man page, which contains:

    .\" Take this out and a Unix Daemon will dog your steps from now until
    .\" the time_t's wrap around.
    .Pp
    You can tune a file system, but you cannot tune a fish.
https://github.com/freebsd/freebsd-src/blob/main/sbin/tunefs...
[−] kykat 39d ago
I looked up what the numbers mean a couple of times, but always forget it immediately
[−] PhilipRoman 39d ago
Interestingly, the section doesn't actually have to start with a number. TCL man pages use the 'n' section and 'man' resolves them just fine despite the ambiguity. Conversely, manpage names can also start with numbers, although this is rare (I found only one such example: man 30-systemd-environment-d-generator)
[−] chasil 39d ago
The POSIX standard manual pages for the utilities can be found here:

https://pubs.opengroup.org/onlinepubs/9799919799/idx/xcu.htm...

These would all be in section 1, if I am correct.

[−] et1337 39d ago
Thousands of keystrokes saved by not having to type “man syscall”… and millions of hours lost by confused folks like OP (and myself)
[−] s20n 39d ago
For me man(3) is the most interesting of them all.

Run apropos . | grep "(3)"; you'll be surprised how many libraries come with man pages for their functions (e.g; curl).

Now I wonder if there are any IDEs that can automatically dial into these man pages and pull up documentation for functions?

[−] LtWorf 39d ago
Step 1: Read man man

Step 2: Feel the urge to write an article about that

[−] mbo 39d ago
Note that this is contrary to the convention used in the Erlang community, where the number is used to disambiguate function definitions with different parameter counts, e.g. in https://www.erlang.org/docs/18/man/supervisor.html we see definitions of start_link/2 and start_link/3.

It is a stylistic convention to always add this number to any reference to a function, even if there is only one definition.

[−] pfdietz 39d ago
I'm feeling old now.
[−] amelius 39d ago
Confession. I think I haven't read manpages since stackoverflow and certainly not since LLMs.

Perhaps the modern version of "man" should be a program you can talk to.