delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/04/15/18:49:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <18310f490804151549m1653504frd2a3702e3f6e4f7b@mail.gmail.com>
Date: Tue, 15 Apr 2008 15:49:08 -0700
From: "smr xxxx" <smrxxxx AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Tail not reading to end of input
In-Reply-To: <18310f490804151523v418f2518t71c5a1b8bc4c3204@mail.gmail.com>
MIME-Version: 1.0
References: <18310f490804141056y466fa051x4240d2a52d3286a9 AT mail DOT gmail DOT com> <18310f490804151523v418f2518t71c5a1b8bc4c3204 AT mail DOT gmail DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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

FWIW, a little non-Cygwin (VS2008) test app to display results from
fstat(0,...) returns the same thing on XP and Vista Ent SP1:
0x00002000 which means character special, and not regular.

On Tue, Apr 15, 2008 at 3:23 PM, smr xxxx <smrxxxx AT gmail DOT com> wrote:
> I've done some debugging of tail.exe on XP (which works) and Vista
> Enterprise SP1 (which doesn't), and so far have found two differences
> when tailing output piped from another program:
>  1. S_ISREG (stats.st_mode) returns 0 on XP, but 1 on Vista (I
> haven't yet determined if this is an Enterprise-only or an SP1-only
> issue)
>  2. lseek() fails on XP, but succeeds on Vista.  The SEEK_CUR below
> returns 0, and the SEEK_END consistently returns 4105 in my tests (for
> output that should be much longer, so presumably it's looking at a
> single buffer of data).
> Combines, this means that on XP the following code in tail.c results
> in pipe_lines being called (as expected), but on Vista file_lines is
> being called.  Does any of this mean anything to anyone?
>
>      /* Use file_lines only if FD refers to a regular file for
>         which lseek (... SEEK_END) works.  */
>      if ( ! presume_input_pipe
>           && S_ISREG (stats.st_mode)
>           && (start_pos = lseek (fd, 0, SEEK_CUR)) != -1
>           && start_pos < (end_pos = lseek (fd, 0, SEEK_END)))
>        {
>                          file_lines(...);
>                }
>                else
>                {
>                          pipe_line(...);
>
>                }
>
>
> On Mon, Apr 14, 2008 at 10:56 AM, smr xxxx <smrxxxx AT gmail DOT com> wrote:
> > Hi, I've just rebuilt my machine and done a clean install of the
> > latest Cygwin, and am having a problem with tail.  I'm wanting to know
> > whether this is a known issue before digging deeper.  For other
> > reasons, I've rebuilt my machine clean twice this weekend and have had
> > this problem both times -- I also sourced the Cygwin files from two
> > different mirrors.
> >
> > It's been a few months since I last installed Cygwin, and all I can
> > think of that has changed since then is:
> >  1. I have a newer version of Cygwin
> >  2. I'm now on Vista Enterprise (was Vista Ultimate)
> >  3. I'm now on an SP1 of Vista (was original RTM of Vista)
> >
> > When running a command such as "dir /s /a cygwin | tail -2" (from C:\)
> > it displays:
> >  03/04/2008  10:32 PM                35 7zr
> >  07/19/2007  02:05 PM
> > This last line is the 29th line of output.  Redirecting to a file
> > shows that there are 7 spaces at the end of this last line, and the
> > total output is 1028 bytes, or 1000 after running dos2unix.
> >
> > Moving C:\cygwin to C:\x\cygwin (to force some extra characters into
> > the output of the above command, ie. the "x\") and rerunning shows
> > that it again stops at precisely the same place (7 spaces after the
> > time on the 29th line), but the output is now 1032 bytes, or 1004
> > after running dos2unix, due to the extra characters.
> >
> > If I first redirect the output of the dir command to a file and tail
> > that then all is well.  Even running "type filename | tail -2" works.
> > Also, if I dos2unix the stream inplace (ie. "dir /s /a cygwin |
> > dos2unix | tail -2") it works correctly.  Note that I installed with
> > Unix file type (as always).
> >
> > I just tried the same on \Windows, and it stops on the 26th line at a
> > position that seems to amount to 1124 bytes, or 1098 when dos2unix'd.
> >
> > I'm guessing that this is a bigger problem that just tail (I could be
> > wrong), but "dir /s /a cygwin | wc -l" doesn't have any problems.
> >
> > Has anyone seen this before?
> >
>

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