This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: sqlite defect
- From: jojelino <jojelino at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 19 Jul 2013 10:56:16 +0900
- Subject: Re: sqlite defect
- References: <trinity-fdc5a0b5-6dcf-4fc0-9370-dd32a75fe928-1373654994500 at 3capp-gmx-bs47> <51E703FB dot 1010300 at etr-usa dot com> <trinity-1068d666-3dec-43c9-8453-39c7cae3a94c-1374102947415 at 3capp-gmx-bs33> <51E74AB4 dot 7010508 at etr-usa dot com> <ks87ur$nle$1 at ger dot gmane dot org> <20130718085953 dot GC9628 at calimero dot vinschen dot de>
On 2013-07-18 PM 5:59, Corinna Vinschen wrote:> On Jul 18 17:11,
jojelino wrote:
>> On 2013-07-18 AM 10:53, Warren Young wrote:
>>> Nothing so simple. Locking is handled at the OS and/or Cygwin DLL
>>> level. The build change between 3.7.16.2 and 3.7.17-3 is that
we're now
>>> relying on new features in the Cygwin DLL to do Windows-style
locking by
>>> default.
>>>
>>> Older versions of Cygwin SQLite bypassed the Cygwin DLL entirely for
>>> this, going straight to the Win32 API, thereby preventing the DLL from
>>> interposing itself for the "posix" case.
>>>
>> Mandatory locking feature of cygwin used in sqlite is broken.
>
> Simple testcase in plain C?
>
>
> Corinna
>
#include <stdio.h>
#include <fcntl.h>
#include <assert.h>
#include <string.h>
#include <sys/file.h>
int
main()
{
int fd = open("asdf.txt", O_BINARY | O_RDWR | O_NOINHERIT | O_CREAT);
const char* buf =
"KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK\0";
int i=0;
write(fd, buf, strlen(buf));
fcntl(fd,F_LCK_MANDATORY,0);
assert(flock(fd,F_SETOWN)==0);
assert(flock(fd,F_SETOWN)==0);
assert(flock(fd,LOCK_NB|LOCK_UN)==0);
fcntl(fd,F_LCK_MANDATORY,1);
assert(flock(fd,F_SETOWN)==0);
assert(flock(fd,LOCK_NB|LOCK_UN)==0);
assert(flock(fd,F_SETOWN)==0);
assert(flock(fd,F_SETOWN)==0); /* assertion "flock(fd,F_SETOWN)==0"
failed: file "f_lck.c", line 28, function: main */
return 0;
}
/**/
--
Regards.
--
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