Subject: Tail claims bad file descriptor when following

From: Johan Pretorius <[email-masked]>
Date: Fri, 26 Nov 2010 10:44:28 +0200

Hi there,

I use tail 5.3.0 in Windows 7.  It works fine unless I try to follow a file.

Here is my --version output:

C:\>tail --version
tail (GNU coreutils) 5.3.0
Written by Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering.

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The following works as expected with no error messages.

tail \\ssb-batman\logs\batman\build.log

However, if I try to follow, it gives output as follows.

C:\>tail -f \\ssb-batman\logs\batman\build.log
[INFO] Unpacking
C:\p4ws\depot_cfg\ssb\trunk\postilion\ssb\postgen\target\postgen-izpack.zip
to

  C:\p4ws\depot_cfg\ssb\trunk\postilion\ssb_installer\target\staging
   with includes null and excludes:null
[INFO] Unpacking
C:\p4ws\depot_cfg\ssb\trunk\postilion\ssb\scheduleinjector\target\scheduleinjector-izpack.zip
to
  C:\p4ws\depot_cfg\ssb\trunk\postilion\ssb_installer\target\staging
   with includes null and excludes:null
[INFO] Unpacking
C:\p4ws\depot_cfg\ssb\trunk\postilion\ssb\services\target\services-izpack.zip
to
  C:\p4ws\depot_cfg\ssb\trunk\postilion\ssb_installer\target\staging
   with includes null and excludes:null
tail: \\ssb-batman\logs\batman\build.log: Bad file descriptor
tail: no files remaining

Why is tail suddenly claiming that the file descriptor is bad, when clearly
it works just fine?

So I tried some different things to see if I could get it to work.

I tried

tail --follow=\\ssb-batman\logs\batman\build.log

but that just gives an even stranger error:

tail: invalid argument `\\\\ssb-batman\\logs\\batman\\build.log' for
`--follow'
Valid arguments are:
  - `descriptor'
  - `name'
Try `tail --help' for more information.

I thought at first that maybe tail does not like the UNC path, but that is
not the case - it does exactly the same when I use a local file.

If I add --retry to the mix, I get the following very interesting reaction:
 It prints out the last few lines, throws out the same error as before, then
prints out the entire file!  This is what it looks like:

C:\>tail -f "\\ssb-batman\logs\batman\build.log" --retry
tail: warning: --retry is useful only when following by name
[INFO] CfgSystemInfoExt ...................................... SUCCESS
[4.328s]
[INFO] SSB Installer ......................................... SUCCESS
[1:28.422s]
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 22 minutes 54 seconds
[INFO] Finished at: Fri Nov 26 10:11:17 GMT+02:00 2010
[INFO] Final Memory: 66M/1016M
[INFO]
------------------------------------------------------------------------
tail: \\ssb-batman\logs\batman\build.log: Bad file descriptor
tail: `\\ssb-batman\logs\batman\build.log' has become accessible
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   Postilion Parent POM

<snip snip...>

In the interests of brevity I cut out the rest of my 250KB log file :-)

Regards,
Johan

-- 
Johan Pretorius
Cell: 0829268327
[email-masked]