This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: tail -f <file name> locks <file name>


--- Eugene Kanter <eugene@bgs.com> wrote:
--8<--
> Here is an example:
> 
> bash window 1:                     bash window 2:
> bash-2.02$ touch  mappfile.out
> bash-2.02$ tail -f  mappfile.out   bash $ cat > mappfile.out
> line1                              line1
> line2                              line2
>                                    ^C
>                                    bash $ rm mappfile.out
>                                    bash $ ls mappfile.out
>                                    ls: mappfile.out: No such file or
> directory
>                                    bash $ cat > mappfile.out
>                                    bash: mappfile.out: Permission denied
> 
> Is this enough for you to reproduce it?

The rm of mappfile.out in the bash 2 window has not actually removed it yet as
it is still open in the bash 1 window.  Cygwin has marked it in a table to be
removed when it gets closed but it's really not gone yet.  You then try to
create the file and the filesystem complains that it can't get rid of
mappfile.out because another process has it open so you get the "Permission
denied" error.  This is a feature of the MS OSes.

The only thing you can do in this case is to exit tail at which time cygwin
will note the closure of the file and remove it.

===
"Earnie Boyd" <mailto:earnie_boyd@yahoo.com>
CYGWIN RELATED HELP:
 DOCUMENTATION: <http://sourceware.cygnus.com/cygwin/docs.html>
       DLLHELP: <http://www.xraylith.wisc.edu/~khan/software/gnu-win32/>
ARCHIVE SEARCH: <http://www.delorie.com/archives/> OR
                <http://www.eGroups.com/list/gnu-win32/>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com