mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: NRK <nrk@disroot.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] hostname is using a case sensitive search in function name_from_hosts
Date: Thu, 16 Jun 2022 12:45:23 -0400	[thread overview]
Message-ID: <20220616164523.GL7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <20220616161924.vdkujlgyrh4aebq7@gen2.localdomain>

On Thu, Jun 16, 2022 at 10:19:24PM +0600, NRK wrote:
> On Thu, Jun 09, 2022 at 04:34:27PM -0400, Rich Felker wrote:
> > strcasestr isn't a good match here, because it's quadratic time and
> > would be potentially quite slow (depending on file contents). It's
> > also not in a usable namespace, and is something of a junk function we
> > included for questionable reasons.
> 
> A bit off-topic, but is there any desire to improve the strcasestr
> performance? If there is, then I can supply the patch as I was playing
> around with it a couple weeks ago.

I'm not sure. It's an interesting research problem whether it can be
made linear-time in constant space -- I mean, for a dumb
single-byte-only version like we do now, I'm pretty sure it can, but
I'm doubtful the same can be done for one that respects full multibyte
case mapping.

But aside from that, I'm not sure if there's much practical value. The
function is not really appropriate for much real-world use, especially
as long as it doesn't respect non-ASCII case mappings, and was
probably a mistake to include to begin with. If there are simple
changes that could be made to make it "less awfully slow", that's
probably ok, but anything that involves open-coding a more complex
implementation without actually making this a high-quality usable
function seems like an unwanted increase in code complexity and
potential bug-surface/maintenance-burden without a good motivation.

Rich

      reply	other threads:[~2022-06-16 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 18:42 Hans Harder
2022-06-09 20:34 ` Rich Felker
2022-06-15  6:30   ` Hans Harder
2022-06-16 16:19   ` NRK
2022-06-16 16:45     ` Rich Felker [this message]

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=20220616164523.GL7074@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=nrk@disroot.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).