mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Alon Zakai <alonzakai@gmail.com>
To: musl@lists.openwall.com
Subject: Bug report on iswalpha
Date: Tue, 5 Aug 2014 13:35:27 -0700	[thread overview]
Message-ID: <CAEX4NpRfJBsVCi1DvqHWDDpaD1DU2anj9m=-ry-2qN=6xxK7vQ@mail.gmail.com> (raw)

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

I think we have encountered a bug in iswalpha, as shown by the following
program:

====
#include <locale.h>
#include <stdio.h>
#include <wctype.h>

int
main(const int argc, const char * const * const argv)
{
  const char * const locale = (argc > 1 ? argv[1] : "C");
  const char * const actual = setlocale(LC_ALL, locale);
  if(actual == NULL) {
    printf("%s locale not supported; skipped locale-dependent code\n",
           locale);
    return 0;
  }
  printf("locale set to %s: %s\n", locale, actual);

  const int result = iswalpha(0xf4); // ô
  printf("iswalpha(\"\xc3\xb4\") = %d\n", result);
  return 0;
}
====

It returns 1 in the final printf, saying that that char is an walpha char,
when I believe it is not. For comparison, glibc reports 0.

Tested on musl 1.0.3 (used in emscripten) and musl trunk on git, same
result.

- Alon

[-- Attachment #2: Type: text/html, Size: 1107 bytes --]

             reply	other threads:[~2014-08-05 20:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 20:35 Alon Zakai [this message]
2014-08-05 21:02 ` Rich Felker
2014-08-05 21:10   ` Alon Zakai
2014-08-05 21:23     ` Rich Felker

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='CAEX4NpRfJBsVCi1DvqHWDDpaD1DU2anj9m=-ry-2qN=6xxK7vQ@mail.gmail.com' \
    --to=alonzakai@gmail.com \
    --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).