Marian Aldenhoevel writes ("[sqlite] File locking to harsh?"):
> ~ # sqlite3 /test "create table A (B integer);"
> Error: database is locked
> 
> An strace of that command is attached. The problem surfaces here, I think:
> 
> open("/test", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
> ...
> fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, 
> len=1}, 0xbfae5690) = -1 EACCES (Permission denied)

Once again we see sqlite reporting an incorrect error message due to
(a) not checking errno and (b) not printing errno when reporting the
error to the user.  This time it's the sqlite3 shell so the sqlite
developers shouldn't be able wash their hands of it saying it's the
application's fault.

Once again:
 * fcntl F_SETLK failing does not necessarily mean "database is
   locked".  As here, it may mean something else is wrong.  This
   should be reported not as "database is locked" but as "IO error".
 * Reports of IO errors should include the errno value.

Then the user would have got
  Error: IO error: failed to lock database: Permission denied

I would guess that the problem may be due to either the filesystem not
supporting locking (although if the strace hasn't been edited that
seems unlikely for "/test") or perhaps SElinux.

Ian.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to