This is the mail archive of the cygwin@cygwin.com 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: Problem with database engine on Cygwin


On  9 Apr, lhall at pop dot ma dot ultranet dot com wrote: 
| Hi David,
| 
| The semantics of deleting a file on UNIX/Linux systems is different than
| on Windows with the Win32 API.  Traditionally, access issues during deletion
| under Cygwin could cause the unlink call to succeed in some circumstances 
| (the file was open by some other application requesting exclusivity) even 
| if the file was not immediately deleted.  There has been more work in this
| area recently as Chris Faylor pointed out.  But you may need to dig deeper
| than the POSIX API boundary to get a better understanding of the problem 
| you're seeing, though looking at the return values may give some clue.
| Sounds like Igor Pechtchanski is already looking at the unlink() code in 
| cygwin1.dll for his problem.  Perhaps he'll turn up something that will 
| help you too.
| 
| Larry
| 
| 
| 
| 
| --------------------------------------------------------------------
| mail2web - Check your email from the web at
| http://mail2web.com/ .
| 
| 
OK.  I devised a work-around.  You are probably right that the problem occurs
when you try to delete the file.  Apparently, the system still has some sense
that the file is still there, even though it is not.  The error condition is
definitely occuring at the point that I try to create a file with the same
name that has been deleted. There is a small C file attached that compiles
cleanly under Cygwin that shows the behavior I am seeing with my database
engine. Basically, as you can see when you run this code, on the second call
to creat(), you get a permission denied error. Is this a windows thing or is
it a cygwin thing?  I don't have VC++, so I can't compile this for pure
windows and see how it works.  Would someone who has VC++ please do that for
my curiosity and let me know what the result is?  You will have to change the
code slightly if you do.

I worked around the issue in my code by closing the offending file, renaming
it to a 20 character pseudo-random string and then deleting it.  When I did
that, I had no problem creating another file with the same name.  The problem
here is if I happen to get 2 20-character psuedo-random strings that are
identical (not likely, I know), this is going to fail.

So, I kludged it in a somewhat unclean, albeit functional, way.  Is there
another workaround that is a little more elegant?

Thanks again for the responses so far...I am interested in the final
disposition of this issue although I don't lurk the list.
-- 
=================================
David May
Senior UNIX System Administrator
Albuquerque TVI
505-224-3015

Attachment: test_file_del.c
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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