tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: sternenseemann <sternenseemann@systemli.org>
To: tech@mandoc.bsd.lv
Subject: Re: [PATCH makewhatis] add NIXSTOREDIR configuration variable to support NixOS
Date: Wed, 31 Mar 2021 21:33:43 +0200	[thread overview]
Message-ID: <c9932669-e9d4-1454-8708-7c8e36967e8e@systemli.org> (raw)
In-Reply-To: <20210331173434.GA57338@athene.usta.de>

Hi Ingo,

On 3/31/21 7:34 PM, Ingo Schwarze wrote:
> I had one other idea while considering the naming.
> Why not allow
> 
>   FOO_PATH="/Homebrew/Cellar:/nix/store"
> 
> and parse it like so (untested):
> 
> 	const char	*pb;
> 	size_t		 len;
> 
> 	*pb = FOO_PATH;
> 	while (*pb != '\0') {
> 		len = strcspn(pb, ":");
> 		if (strncmp(buf, pb, len) == 0)
> 			break;
> 		pb += len;
> 		pb += strspn(pb, ":");
> 	}
> 	if (*pb == '\0' && strncmp(buf, basedir, basedir_len) != 0) {
> 		say(...);
> 		continue;
> 	}
I really like that idea! I initially considered something like this, but
shied away from it as it requires you to make some implementation choice
and having proper arrays in preprocessor macros is never nice.

It adds some extra overhead, I guess, but in comparison to all the IO
makewhatis has to do this should be practically nothing.

> Now, how should that variable be called?
> 
>  * The name should end with "_PATH".
>  * The makewhatis(8) program is allowed to read any files below
>    this path, so the name should include "READ" and some word
>    indicating permission.
>  * Mentioning makewhatis in the name does not seem important.
>    It is more or less clear anyway that man(1) itself can read
>    anything given on the command line or found in the database,
>    subject to file system permissions, of course.
> 
> So, maybe:
> 
>   READ_ALLOWED_PATH
> 
> What do you think?

Seems concise and expressive enough. However I feel like it may hinder
discoverability of this option if it doesn't refer to makewhatis at all.

> That's good.  I should also update the NixOS entries on
> 
>   https://mandoc.bsd.lv/ports.html
> 
> but maybe wait for the dust to settle first.

Sounds like a good idea! If everything goes according to (my) plan, it
should be possible to configure mandoc as default viewer and searcher
just as easily as man-db. I can offer to report back at some point when
the dust has settled, so you don't have to dig through unfamiliar
documentation etc.

Cheers,

Lukas

--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


  reply	other threads:[~2021-03-31 19:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 19:49 sternenseemann
2021-03-30 20:30 ` Ingo Schwarze
2021-03-30 21:03   ` sternenseemann
2021-03-31 17:34     ` Ingo Schwarze
2021-03-31 19:33       ` sternenseemann [this message]
2021-04-10 15:57       ` [PATCH v2 makewhatis] refactor HOMEBREWDIR into READ_ALLOWED_PATH sternenseemann
2021-04-10 16:15         ` sternenseemann
2021-08-03 16:42           ` sternenseemann
2021-08-05 12:35             ` Ingo Schwarze
2021-08-07  0:29               ` sternenseemann
2021-08-07 13:17                 ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9932669-e9d4-1454-8708-7c8e36967e8e@systemli.org \
    --to=sternenseemann@systemli.org \
    --cc=tech@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).