News for hackers. Stuff that matters.
Re:BCHS: OpenBSD, C, httpd and SQLite web stack by da39a3ee on Tuesday January 18, 2022 @11:51PM (#29990090)
I’d like to love man pages but

- I feel that they are linux only. On my MacOS system I can’t rely on man x being the man page for the right version of x. I know that in principle there are environment variables that make sure i’m getting the gnu core utils version or the base homebrew version rather than the system BSD version, but it’s too many moving parts. Furthermore even if I get it right, I can’t expect people I’m working with or mentoring to get it right, hence I can’t recommend man to them for documentation. God knows about man pages on Windows.

- I feel that a small amount of plain text documentation should be stored in the executable, not separately. Isn’t it a holdover from the vastly more constrained computing environments of the 70s and 80s that we’re keeping man pages separate from the executable? Its just asking to get out of sync / incorrectly paired up.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by RTFM_PLEASE on Wednesday January 19, 2022 @02:43AM (#29990988)
OpenBSD pages (https://man.openbsd.org/) absolutely rock and other, proper BSDs do quite well.

Also, man pages are for more than just system utilities (man(1)). Which binary should hold pledge(2) (https://man.openbsd.org/pledge), exactly?

Your man pages should be updated when the associated tool is updated.

You are describing a MacOS issue, with its terrible package management, and frustrating toolchains.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by da39a3ee on Wednesday January 19, 2022 @11:54AM (#29996217)
You seem to be missing my point which is that, as a maintainer of a command line tool, I need to and want to cater to users of all OSs. And in fact, I will allocate my efforts more towards popular OSs. I genuinely am sure that your BSDs are a nice environment, but surely you understand how fringe they are? The majority of my users are MacOS+Windows, with substantial Linux also.

In fact MacOS has an excellent package manager -- it's called homebrew. I don't really want to argue about it but you're the one who made an unjustified assertion about an OS which I bet you don't use. People like you insist that it's bad but no-one who uses it knows why. I maintained my own Linux laptop for 10 years, and for the last 10 years I've used homebrew on a Mac. It has literally never given me any problems! I've never even searched the issues on Github for a problem as far as I can remember.

Honestly I think that the thought processes of most Linux/Unix enthusiasts like you who criticize homebrew are

1. We hate MacOS because childish anti-capitalist ideologies

2. Therefore we will not admit that a nice command-line development environment can be created on MacOS

3. Therefore homebrew is bad

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by Shared404 on Wednesday January 19, 2022 @12:31AM (#29990336)
> - I feel that they are linux only.

They're actually better on Free/Open BSD in my experience. As stupid as it makes me sound, I often struggle to parse Linux man pages, but the BSD's I've had no trouble with for a variety of topics.

> - I feel that a small amount of plain text documentation should be stored in the executable,

Isn't this how --help usually works? I would also rather have more documentation embedded, at least for some executables.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by the_only_law on Wednesday January 19, 2022 @12:33AM (#29990346)
FreeBSD has pretty good documentation.

Comparatively, I’ve found NetBSD documentation to be lacking, although NetBSD seems to take the cake on code quality and legacy architectures (a feature I find my delve right now.

On the wider discussion of doc, I’ve found Linux kernel documentation to be a pain in the ass, and sometimes ever worse than windows kernel documentation (which I won’t even both to get into)

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by josephcsible on Wednesday January 19, 2022 @12:45AM (#29990406)
> On my MacOS system I can’t rely on man x being the man page for the right version of x.

But isn't that an issue with macOS, not an issue with man pages?

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by da39a3ee on Wednesday January 19, 2022 @08:07AM (#29993101)
Yes, it is. But MacOS (and Windows) are popular OSs for laptop users. I'm the maintainer of a command line tool that is reasonably popular and I believe that the majority of my users are MacOS. So the question is quite concrete for me -- should I provide documentation in the form of a man page? I do not currently, for the reasons I gave above (although I made a mistake in saying Linux when I meant Linux and *BSD for which I deserve what I get!) But I'd appreciate it being pointed out if my thinking is wrong here.
Re:BCHS: OpenBSD, C, httpd and SQLite web stack by enriquto on Wednesday January 19, 2022 @09:59AM (#29994393)
> should I provide documentation in the form of a man page?

Yes, and this may be a much smaller effort than you suspect. Only by writing the output of --help in a certain order, you can use the "help2man" tool to generate a beautiful manpage automatically. Notice that your users do not need to have help2man installed, you run it yourself as part of your build process, to create the manpage from the latest source code.

It is very likely that if your tool already has a --help option, you don't really need to do anything to have a manpage. Just call help2man from your makefile.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by da39a3ee on Wednesday January 19, 2022 @12:02PM (#29996351)
It would be cool if help2man worked perfectly. In fact the output needs a few fixups -- it looks like it has problems with non-ASCII characters?

But if those fixups can be made automatically it's not bad and I agree might be worth adding to the build.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by enriquto on Wednesday January 19, 2022 @12:19PM (#29996598)
Yes, the output of help2man is not perfect. My main gripe is that it imposes a rather strict format for the manpage, and not all manpage markup is available. But it is better than not having a manpage at all.

The problem with non-ascii characters can be solved, though. Just add an option like "-L en_US.UTF-8" to the help2man call.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by da39a3ee on Wednesday January 19, 2022 @01:01PM (#29997398)
Thanks. However, now help2man is outputting the unicode character correctly, but `man $help2manOutput` is displaying things like `a(R)` and `a` instead of the unicode character. I've also tried with the `LOCALE=en_US.UTF-8` env var set.
Re:BCHS: OpenBSD, C, httpd and SQLite web stack by enriquto on Wednesday January 19, 2022 @01:21PM (#29997733)
This sounds like a problem with your pager, that is used to scroll the output of man pages in the terminal. Do accents appear correctly on other manpages in your system? If I recall correctly, on macos catalina I had to set my locale variable LC_CTYPE (and not LOCALE) so that the less pager recognized the accents.
Re:BCHS: OpenBSD, C, httpd and SQLite web stack by da39a3ee on Wednesday January 19, 2022 @01:51PM (#29998235)
I don't think it's a pager problem for the following reasons:

- If I do `man help2manOutput | cat` then it does not page, but I still see `a` and `a(R)` in place of the desired unicode characters

- `less help2manOutput` renders them correctly

- In general I have no problem viewing unicode characters in less: I'm familiar with env vars such as LESS and PAGER.

Re:BCHS: OpenBSD, C, httpd and SQLite web stack by enriquto on Wednesday January 19, 2022 @02:15PM (#29998570)
This is not the most appropriate place for this sort of fine-grained debugging. I'd suggest to try your generated manpage on another computer to see if it displays correctly. The only thing that I can say is that "it works for me" but of course this answer is not useful :)

The main site of development for help2man seems to be this:

https://salsa.debian.org/bod/help2man

I'm sure they'll accept pull requests that fix problems. Happy hacking!