delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/24/09:06:50

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
X-Authenticated: #527675
Message-ID: <40B1F32D.8080301@gmx.de>
Date: Mon, 24 May 2004 15:05:49 +0200
From: Reinhard Nissl <rnissl AT gmx DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: bash: slow command execution after permission denied error
X-IsSubscribed: yes

Hi,

I've discovered a strange behaviour of bash on Windows NT and 2000, but not on XP.

Please have a look on the following simple test script named x.sh:

----------------------------------------------------------------------------------

#!./bash

export PATH=`pwd`:$PATH
export CYGWIN=nontsec

while true ; do
	date
	rm -rvf "//merlin/upload/x.sh"
	date
	cp -av "x.sh" "//merlin/upload"
	date
	rm -rvf "//merlin/upload/zplmanual.pdf"
	date
	cp -av "./zplmanual.pdf" "//merlin/upload"
	date
	echo ------------------------
done

----------------------------------------------------------------------------------

All required binaries are located in the same directory, where x.sh resides,
that's why there is the "export PATH" statement. Furhtermore, I don't want
cygwin to use NT security.

Then, the script repeatedly prints the current time and executes a command.
"//merlin/upload" is a share, where the current user has enough rights, so the
first "rm" and "cp" execute properly. The same is true for the other commands,
that work on the PDF file (assuming that the PDF file is not opend by anybody
at that time).

Typically, this script runs fast with multiple iterations per second.


G E T T I N G   S T R A N G E

Now consider the case, where anybody is watching the PDF file on
"//merlin/upload" with Adobe reader. The second "rm" command remains quiet,
but takes much longer now to return. The second "cp" command gives a
"permission denied" error and takes a little bit longer to process too.

That's the behaviour, that one would expect. And one would also expect, that
at the next iteration, the first "rm" and "cp" command work fast as usual and
that the second pair takes longer to process.

This is true on Windows XP as the following output for three iterations shows:

----------------------------------------------------------------------------------

C:\HOME>bash -c ./x.sh
Mon May 24 14:06:17     2004
removing `//merlin/upload/x.sh'
Mon May 24 14:06:17     2004
`x.sh' -> `//merlin/upload/x.sh'
Mon May 24 14:06:17     2004
removing `//merlin/upload/zplmanual.pdf'
Mon May 24 14:06:20     2004
`./zplmanual.pdf' -> `//merlin/upload/zplmanual.pdf'
cp: cannot create regular file `//merlin/upload/zplmanual.pdf': Permission denied
Mon May 24 14:06:21     2004
------------------------
Mon May 24 14:06:21     2004
removing `//merlin/upload/x.sh'
Mon May 24 14:06:21     2004
`x.sh' -> `//merlin/upload/x.sh'
Mon May 24 14:06:21     2004
removing `//merlin/upload/zplmanual.pdf'
Mon May 24 14:06:24     2004
`./zplmanual.pdf' -> `//merlin/upload/zplmanual.pdf'
cp: cannot create regular file `//merlin/upload/zplmanual.pdf': Permission denied
Mon May 24 14:06:25     2004
------------------------
Mon May 24 14:06:25     2004
removing `//merlin/upload/x.sh'
Mon May 24 14:06:25     2004
`x.sh' -> `//merlin/upload/x.sh'
Mon May 24 14:06:25     2004
removing `//merlin/upload/zplmanual.pdf'
Mon May 24 14:06:28     2004
`./zplmanual.pdf' -> `//merlin/upload/zplmanual.pdf'
cp: cannot create regular file `//merlin/upload/zplmanual.pdf': Permission denied
Mon May 24 14:06:29     2004
------------------------

----------------------------------------------------------------------------------

But on Windows NT and Windows 2000 it behaves different:

----------------------------------------------------------------------------------

C:\HOME>bash -c ./x.sh
Mon May 24 14:07:58 WEDT 2004
removing `//merlin/upload/x.sh'
Mon May 24 14:07:59 WEDT 2004
`x.sh' -> `//merlin/upload/x.sh'
Mon May 24 14:07:59 WEDT 2004
removing `//merlin/upload/zplmanual.pdf'
Mon May 24 14:08:03 WEDT 2004
`./zplmanual.pdf' -> `//merlin/upload/zplmanual.pdf'
cp: cannot create regular file `//merlin/upload/zplmanual.pdf': Permission denied
Mon May 24 14:08:09 WEDT 2004
------------------------
Mon May 24 14:08:11 WEDT 2004
removing `//merlin/upload/x.sh'
Mon May 24 14:08:15 WEDT 2004
`x.sh' -> `//merlin/upload/x.sh'
Mon May 24 14:08:19 WEDT 2004
removing `//merlin/upload/zplmanual.pdf'
Mon May 24 14:08:24 WEDT 2004
`./zplmanual.pdf' -> `//merlin/upload/zplmanual.pdf'
cp: cannot create regular file `//merlin/upload/zplmanual.pdf': Permission denied
Mon May 24 14:08:30 WEDT 2004
------------------------
Mon May 24 14:08:32 WEDT 2004
removing `//merlin/upload/x.sh'
Mon May 24 14:08:36 WEDT 2004
`x.sh' -> `//merlin/upload/x.sh'
Mon May 24 14:08:40 WEDT 2004
removing `//merlin/upload/zplmanual.pdf'
Mon May 24 14:08:45 WEDT 2004
`./zplmanual.pdf' -> `//merlin/upload/zplmanual.pdf'
cp: cannot create regular file `//merlin/upload/zplmanual.pdf': Permission denied
Mon May 24 14:08:52 WEDT 2004
------------------------

----------------------------------------------------------------------------------

The difference is, that after the first "removing
`//merlin/upload/zplmanual.pdf'" every other command takes about 4 seconds to
execute. Please note, that command execution is not that slow in general,
because the first "rm" and "cp" command of the first iteration work as fast as
usual.

I hope, this issue is explained precisely enough to be reproduceable by any
cygwin developer. Currently, I don't know, whether it is an issue of bash or
any other component of cygwin.

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl AT gmx DOT de



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