From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] conforming strverscmp() implementation
Date: Tue, 3 Mar 2015 10:54:11 -0500 [thread overview]
Message-ID: <20150303155411.GH23507@brightrain.aerifal.cx> (raw)
In-Reply-To: <20150303104507.GA5094@zx-spectrum>
On Tue, Mar 03, 2015 at 12:45:07PM +0200, Sergey Dmitrouk wrote:
> Hi,
>
> Attached is strverscmp() that should conform to what is described in
> manual pages. It's not actually a diff as it would be harder to read
> in this case.
>
> The idea is just as described in manuals (once you get what they mean):
>
> 1. Find point where strings differ as in current code, but keep track
> of locations of last seen numbers.
> 2. If numbers are both integers (that is they don't start with zero or
> it's a single zero) compare as in current implementation.
> 3. If only one of numbers is integer, the other one is smaller.
> 4. Otherwise, number with longer leading sequence of zeroes is smaller.
> 5. If leading zeroes match, compare characters following last zero in
> both strings.
>
> I didn't see much comments in musl, so there is none in this file, but
> can add some if requested.
>
> Implementation is admittedly more sophisticated than current version for
> the reason that all simpler approaches I tried fail for at least one of
> possible comparison cases.
Thanks. This has been an open issue for a while. I haven't looked at
your code in detail yet and at this point it will probably be
something I do after the 1.1.7 release, and I'd like to allow some
time for review. Have you run libc-test against it and checked that it
fixes all the test failures there? I would guess it does since they're
based on the man page examples but it would be good to double-check
anyway if you haven't.
Rich
next prev parent reply other threads:[~2015-03-03 15:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 10:45 Sergey Dmitrouk
2015-03-03 15:54 ` Rich Felker [this message]
2015-03-03 19:27 ` Sergey Dmitrouk
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=20150303155411.GH23507@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/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).