mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Simon Josefsson <simon@josefsson.org>
To: Rich Felker <dalias@libc.org>
Cc: bug-gsasl@gnu.org, musl@lists.openwall.com
Subject: Re: [musl] Behaviour of strverscmp(3)
Date: Mon, 07 Nov 2022 09:51:19 +0100	[thread overview]
Message-ID: <87a653qha0.fsf@latte> (raw)
In-Reply-To: <20221106233904.GE29905__8136.83224130131$1667785799$gmane$org@brightrain.aerifal.cx> (Rich Felker's message of "Sun, 6 Nov 2022 18:39:04 -0500")

[-- Attachment #1: Type: text/plain, Size: 1914 bytes --]

Rich Felker <dalias@libc.org> writes:

> On Sun, Nov 06, 2022 at 06:18:22PM -0500, Dmitry Bogatov wrote:
>> Hello.
>> 
>> While trying to building gsasl statically with musl library as part of
>> Nixpkgs distribution, I noticed that test built from tests/version.c
>> fails when built with musl library. After a bit of troubleshooting, I
>> can pinpoint the reason -- different behaviour of "strverscmp" from
>> glibc and musl.
>> 
>> Example code:
>> 
>> #include <string.h>
>> #include <stdio.h>
>> 
>> int main()
>> {
>> 	int value = strverscmp("UNKNOWN", "2.2.0");
>> 	printf("%d\n", value);
>> 	return 0;
>> }
>> 
>> Under glibc value "35" is printed (positive), under musl value "-1" is
>> printed (negative). Not sure what is the correct solution for the
>> issue, so I cross-post into two lists.
>> 
>> For now I plan to patch-out this particular test. Thank you.
>
> It looks like we're neglecting to honor the exception case to "longer
> digit sequence is greater" when one of the sequences is degenerate (no
> digits).

Thanks for the report Dmitry (dropping cc because your email adressed
was reject by exim -- '550 restricted characters in address').

Right, I think this is a musl bug that gnulib doesn't detect and work
around.  I ran into it earlier on Alpine, but must have forgotten to
report it (or I found earlier bug reports about it).  Ignoring the
self-test failure is the right solution.  I believe strverscmp is a
glibc-specified interface, so musl should be compatible with it, right?

I'm inclined to add this test vector to the gnulib self-test for
strverscmp, so at least we know where the problem comes from.  Detecting
the issue and working around it seems like a lot of complexity (which is
a source for other bugs) and requires time and energy to support, for
what appears to be little gain, so I'm not sure it is worth it.

/Simon

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

      parent reply	other threads:[~2022-11-07 12:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 23:18 Dmitry Bogatov
2022-11-06 23:39 ` Rich Felker
2022-11-08  3:08   ` Rich Felker
2022-11-08  3:25     ` Rich Felker
     [not found] ` <20221106233904.GE29905__8136.83224130131$1667785799$gmane$org@brightrain.aerifal.cx>
2022-11-07  8:51   ` Simon Josefsson [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=87a653qha0.fsf@latte \
    --to=simon@josefsson.org \
    --cc=bug-gsasl@gnu.org \
    --cc=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).