delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/14/13:15:52

X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: =?iso-8859-1?Q?RE:_bash-3.1-7=1B$B!!=1B=28BBUG?=
Date: Thu, 14 Sep 2006 18:15:43 +0100
Message-ID: <004c01c6d821$68f5fdf0$a501a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <45098A3B.4060105@scytek.de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 14 September 2006 17:59, Volker Quetschke wrote:

> Hi!

> (snip)
>> +#ifdef __CYGWIN__
>> +  /* lseek'ing on text files is problematic; lseek reports the true
>> +     file offset, but read collapses \r\n and returns a character
>> +     count.  We cannot reliably seek backwards if nr is smaller than
>> +     the seek offset encountered during the read, and must instead
>> +     treat the stream as unbuffered.  */
>> +  if ((bp->b_flag & (B_TEXT | B_UNBUFF)) == B_TEXT)
> ------------------------^^^^^^^^^^^^^^^^^      ^^^^^^
> part of the patch looks suspicious to me. You probably just want to test
> if the LHS expression is true.

  You reckon?  That looks to me like a test for B_TEXT is set *and* B_UNBUFF
is cleared.  Since the action we're going to take if this test succeeds is to
set the stream unbuffered, there's no need to do it for a stream that already
/is/ unbuffered.  That's how it looks to me at first glance, anyway.

  I agree it's a /slightly/ unclear construct that should /perhaps/ have an
explicit comment to clarify the way in which it's been worded.


>   Volker
> 
>> +    {
>> +      off_t offset = lseek (bp->b_fd, 0, SEEK_CUR);

  ... Could have made good use of another one of your "(snip)"s here...!

[ ... snip ... ]


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019