Date: Tue, 3 Mar 2015 10:54:11 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH] conforming strverscmp() implementation 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.