X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Message-ID: <49EE9A96.6040900@byu.net> Date: Tue, 21 Apr 2009 22:18:30 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [1.7] Updated: cygwin-1.7.0-45 References: <20090402171059 DOT GE12738 AT calimero DOT vinschen DOT de> <20090331111757 DOT GA22043 AT calimero DOT vinschen DOT de> <200904031037 DOT n33Ab4Ma001073 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <20090403145139 DOT GJ12738 AT calimero DOT vinschen DOT de> <200904211025 DOT n3LAPf7a022955 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <20090421152334 DOT GH8722 AT calimero DOT vinschen DOT de> <20090421161337 DOT GG18867 AT trikaliotis DOT net> <20090421165642 DOT GK8722 AT calimero DOT vinschen DOT de> <20090421175436 DOT GA18266 AT calimero DOT vinschen DOT de> <49EE5D4D DOT 8030906 AT gmail DOT com> In-Reply-To: <49EE5D4D.8030906@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Dave Korn on 4/21/2009 5:57 PM: >> And better so since sed isn't broken. It puts EOF into the isblank >> function and rightly expects that isblank returns 0. > > I thought the problem was that it puts 0xff into the isblank function and > gets 1 in some locales where 0xff is an NBSP, if that's not the case I've > misunderstood the thread so far. The bug was that isblank(-1) was blindly treated as if were equivalent with isblank(0xff), which, in some locales, is flat out wrong (isblank(EOF) should always be 0, even when isblank(0xff) is well-defined as 1). Broken apps can't tell the difference between isblank((char)0xff) and isblank(EOF), but correct apps, like sed, CAN tell the difference between 0xff and EOF in "int ch = getchar(); isblank(ch)" since getchar() returns an int containing an unsigned char value (and not a char). Sed's infinite loop, then, was because of newlib/cygwin's bug - sed reached the end of the file while trying to skip blanks, but because isblank() was returning the wrong value for -1, sed thought that EOF was a blank and kept trying to read the file instead of breaking out of the loop. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9 AT byu DOT net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknumpYACgkQ84KuGfSFAYDOfgCeLGrunriMXtbakIUc+8zZQ8TA +tgAnjidi630v2rf4q79zWv2MCJ3CBWC =f2gG -----END PGP SIGNATURE----- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/