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


I've grepped your code for the usual binmode vs textmode problem - every 
fopen you call is in the "default" mode, which may be textmode.
In textmode, \n will be translated to \r\n when saving, which will corrupt 
your (binary) files.
Add a "b" to the open options in each fopen call - this will not disturb 
anything on any other platform, and probably fix your problem :)

HTH

rlc


On Mon, 7 Apr 2003 dmay at tvi dot edu wrote:

> Hi, all.
> 
> I have written a database engine that I use for several administrative
> projects for the organization that I work for.  My goal is to provide cygwin
> support for that system, but I have run into a problem that I have been unable
> to resolve.  The source for the engine is available at
> 
> http://w3.tvi.edu/~dmay/dcdb.html
> 
> The record deletion functionality for the system is similar to that in old
> dBase III, where the records aren't actually deleted but merely marked as
> deleted until a packing process occurs.  The packing process is where I am
> seeing the problem under cygwin.  Basically, indexes are getting corrupted
> during packing. The following are basically the steps that I use in packing a
> table:
> 
> - close the indexes associated with the table
> - delete the indexes associated with the table
> - create a copy of the table under a new name
> - create indexes for the copy
> - copy the undeleted records to the new table
> - close and delete the original table
> - close the new table
> - rename the new table to the name the original table had
> 
> All files are opened in binary mode.  At first it looked like the problem
> occurred because I tried to rename the table file while it was open.  However,
> I have changed the code to close the table before I try to rename it.  It's
> possible that I am trying to delete a file that is open for writing, but I've
> tried multiple work-arounds to avoid that situation to no avail.
> 
> I apologize that I can't get this down to a small snippet of code that clearly
> displays the problem, but I am rather baffled by this and don't know where to
> begin.  This same code works as is under Linux and Solaris compiled with
> gcc-2.9x.x, but fails under cygwin with gcc-3 or gcc-2.  I tried stepping
> through the code using gdb but the problem happens at some point and no error
> is raised immediately as a result of it (unless I am not handling errors in
> that part of the code correctly - always a possibility :o).  I am assuming
> that it is some windows file access rule that I am violating as it seems to
> only effect windows.
> 
> I have attached the output of 'cygcheck -s -v -r'.  I didn't find anything in
> the list archives that seemed to apply here.  Also, I didn't see anything in
> the FAQ that looks like it could be the problem.  Any ideas on how to track
> down and squash this problem would be greatly appreciated.
> 
> Thanks in advance.
> 


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