bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change in strncmp, at least on PowerPC


From: Bob Schmertz
Subject: Re: Change in strncmp, at least on PowerPC
Date: Mon, 26 Jan 2004 10:06:43 -0800 (PST)

--- Andreas Schwab <address@hidden> wrote:
> Bob Schmertz <address@hidden> writes:
> 
> > The problem is this: if strncmp is called with a null pointer for at
> > least one of the strings, and n is supplied as 0, it segfaults.
> 
> Don't do that then.
> 
> 7.21.1 String function conventions
> 
[snip quoting chapter and verse]
> 
> > This difference has broken zsh on the PPC platform.
> 
> zsh is broken.

Of course, I am not asking anyone to change this so that my shell of
choice will start working better.  I will agree that zsh was broken; I
contacted the maintainers with a fix before investigating what the
changes to glibc had been, and they happily accepted my fix.

Perhaps I should bring back part of my original post:

    Zsh is a widely ported shell, which suggests that other C libraries
    also return 0 in this situation, and there are undoubtedly other
    apps out there that rely on this behavior.

My associates have confirmed that the current version of glibc does not
crash on this bad strncmp call in x86, but returns 0.  Now, I wouldn't
have any great objections if the situation were reversed, i.e., if the
PPC version were more forgiving than the x86 version.  But it is a fact
of life that there is a lot of "incorrect" code out there that works fine
under x86 (the most popular platform by far), and does not get tested on
less popular platforms like PPC.  Now, if this behavior change were to be
introduced into x86, maintainers would find and fix their broken
software.  But as it is, I think few will do so, and GNU/Linux on the PPC
platform will suffer.

=====
Cheers,
Bob Schmertz

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]