You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1998/07/07 06:47:46 UTC
PR 2553 and 2282
Two bugs:
- ap_cfg_getline is completely wrong to be compressing spaces into single
spaces... this is broken (consider quoted strings), and not backwards
compatible.
- since characters are signed on solaris, isspace is broken on 8-bit
characters (as are all the ctype macros). I verified that 2553 and 2282
are not a problem if I compile with gcc -funsigned-char. I really hate
goddamn libc legacy.
Dean
Re: PR 2553 and 2282
Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Dean Gaudet wrote:
>
> Here's my suggestion for fixing this absurdity:
>
> - for all the platforms that use gcc, add -funsigned-char.
>
> - in include/conf.h (or ap.h, whatever):
Conceptual +1.
#ken P-)}
Ken Coar <http://Web.Golux.Com/coar/>
Apache Group member <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>
Re: PR 2553 and 2282
Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 6 Jul 1998, Dean Gaudet wrote:
> On Mon, 6 Jul 1998, Dean Gaudet wrote:
>
> > - since characters are signed on solaris, isspace is broken on 8-bit
> > characters (as are all the ctype macros). I verified that 2553 and 2282
> > are not a problem if I compile with gcc -funsigned-char. I really hate
> > goddamn libc legacy.
>
> Here's my suggestion for fixing this absurdity:
Here's suggestion #2.
POSIX, Single Unix/etc. actually say that if unsigned chars are used
things are safe. They also allow EOF to be used... but I don't think we
use EOF anywhere... and I'd be happy saying we don't support isfoo(EOF).
We can probably best serve everyone by doing this:
#define ap_isalnum(c) (isalnum(((unsigned)(c)))
#define ap_isalpha(c) (isalpha(((unsigned)(c)))
#define ap_iscntrl(c) (iscntrl(((unsigned)(c)))
#define ap_isdigit(c) (isdigit(((unsigned)(c)))
#define ap_isgraph(c) (isgraph(((unsigned)(c)))
#define ap_islower(c) (islower(((unsigned)(c)))
#define ap_isprint(c) (isprint(((unsigned)(c)))
#define ap_ispunct(c) (ispunct(((unsigned)(c)))
#define ap_isspace(c) (isspace(((unsigned)(c)))
#define ap_isupper(c) (isupper(((unsigned)(c)))
That way there's no mucking with compiler options. It automatically
works on systems that support 8-bit characters. And it doesn't break
things any worse than they were before on the old systems that don't
support 8-bit chars.
Dean
Re: PR 2553 and 2282
Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 6 Jul 1998, Dean Gaudet wrote:
> - since characters are signed on solaris, isspace is broken on 8-bit
> characters (as are all the ctype macros). I verified that 2553 and 2282
> are not a problem if I compile with gcc -funsigned-char. I really hate
> goddamn libc legacy.
Here's my suggestion for fixing this absurdity:
- for all the platforms that use gcc, add -funsigned-char.
- in include/conf.h (or ap.h, whatever):
/* define HAVE_8BIT_CTYPE if your characters are unsigned, and
* your ctype macros understand 8-bit characters.
*/
#if defined(HAVE_8BIT_CTYPE)
#if defined(__GNUC__) && !defined(__CHAR_UNSIGNED__)
#error "you lie, you forgot -funsigned-char"
#endif
#define ap_isascii(c) (1)
#define ap_tolower(c) (tolower(c))
#define ap_toupper(c) (toupper(c))
#else
#define ap_isascii(c) (isascii(c))
#define ap_tolower(c) (isascii(c) ? tolower(c) : (c))
#define ap_toupper(c) (isascii(c) ? tolower(c) : (c))
#endif
#define ap_isalnum(c) (isascii(c) && isalnum(c))
#define ap_isalpha(c) (isascii(c) && isalpha(c))
#define ap_iscntrl(c) (isascii(c) && iscntrl(c))
#define ap_isdigit(c) (isascii(c) && isdigit(c))
#define ap_isgraph(c) (isascii(c) && isgraph(c))
#define ap_islower(c) (isascii(c) && islower(c))
#define ap_isprint(c) (isascii(c) && isprint(c))
#define ap_ispunct(c) (isascii(c) && ispunct(c))
#define ap_isspace(c) (isascii(c) && isspace(c))
#define ap_isupper(c) (isascii(c) && isupper(c))
and replace all occurances everywhere in the code.
Dean