This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preremove/postinstall scripts fail with snapshot installed


On Feb 13 18:07, Ken Brown wrote:
> On 2/13/2011 12:20 PM, Ken Brown wrote:
> >Works for me on W7 64 bit with KB 2393802 installed.
> 
> BTW, when I said that it works, I was talking about the original bug
> that I reported about preremove/postinstall scripts.  But I just now
> tested removing an in-use directory, and I was surprised by what
> happened.  Maybe I just don't understand how this is supposed to
> work. I have two bash shells open, with prompts $1 and $2.
> 
> In shell 1:
> 
> $1 mkdir /tmp/foo
> $1 cd /tmp/foo
> 
> In shell 2:
> 
> $2 rmdir /tmp/foo
> $2 ls /tmp/foo
> ls: cannot access /tmp/foo: No such file or directory
> 
> Back to shell 1:
> 
> $1 ls
>       0 [main] bash 2220 exception::handle: Exception:
> STATUS_ACCESS_VIOLATION

Yes, I encountered that at one point yesterday as well, and I have
already a patch in the pipe, but didn't apply it so far because I
want to do some tests first.

What happens is this.

When Cygwin forks, it actually performs some magic centered around
a call to CreateProcess.  Up to Windows 2003, the CreateProcess
call just duplicates the parent's CWD handle and stores it as the
CWD handle in the child.  Starting with Windows Vista, the CWD handle
is always a fresh one, created on process startup, even if the CWD
of the child is the same as the CWD of the parent.

The problem with this scenario is that in the child process the CWD
handle creation fails, because the requested CWD doesn't exist anymore.
The result is that an important pointer in the OS is NULL.  My change
from yesterday neglected this possibility, so it dereferences this 
pointer without checking it for NULL, which in turn crashes.

Unfortunately it's not just adding a simple test, because Cygwin needs
the pointer to figure out which version of the FAST_CWD structure is
used.

Anyway, I'll apply a patch later today.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]