Yup -- that duplicates the problem.
 
Is there any reason why strerror() results can't be added to the error messages 
when file i/o errors occur like this?  It's used elsewhere in the code but not 
for any error messages in the api.
 
I added this in sqlite3ErrStr (I've got a snapshot of 3.7.0 I'm working with)
 
  if( ALWAYS(rc>=0) && rc<(int)(sizeof(aMsg)/sizeof(aMsg[0])) && aMsg[rc]!=0 ){
    switch(rc) {
    case SQLITE_CANTOPEN: return strerror(errno);
    default:
    return aMsg[rc];
    }

Then I get this error:
./sqlite3  ../x1/test.db
SQLite version 3.7.0
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> insert into data_his values(3,'test');
Error: No such file or directory

So it appears that the initial attempt to open the journal may not be getting 
an error?  That it comes later?
I wasn't quite able to trace what's happening in the limited time I've got.
 
I expected to see a "permission denied".
 
 
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov
Sent: Fri 6/11/2010 8:58 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] bug report: unhelpful error message 
whendirectorypermissions are wrong



> What's different about your setup?  Different permissions on the directory or 
> file?

Try to make file -rw-rw-rw-.


Pavel

On Fri, Jun 11, 2010 at 9:50 AM, Black, Michael (IS)
<michael.bla...@ngc.com> wrote:
> I did the following...so what kind of permissions do you have that are 
> different from this?
>
> drwxr-xr-x 2 root   root  4096 Jun 11 08:40 ./
> -rw-r--r-- 1 root   root 2048 Jun 11 08:40 test.db
> As a normal user I did this:
>
> sqlite3 test.db
> SQLite version 3.3.6
> Enter ".help" for instructions
> sqlite> insert into data_his values(3,'test');
> SQL error: attempt to write a readonly database
>
> Clear as a bell...
>
> What's different about your setup?  Different permissions on the directory or 
> file?
>
>
> Michael D. Black
> Senior Scientist
> Northrop Grumman Mission Systems
>
>
> ________________________________
>
> From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov
> Sent: Fri 6/11/2010 8:22 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] bug report: unhelpful error message when 
> directorypermissions are wrong
>
>
>
>> Finally I found that in
>> order to write to the database, Sqlite for some reason needs to have
>> write permissions to the _folder_ the file resides in.
>
> "Some reason" here is a necessity to create a journal file at the same
> directory to be able to restore the database in case of crash or power
> outage. To create files in the directory one must have write
> permissions to it.
>
>
> Pavel
>
> On Fri, Jun 11, 2010 at 7:22 AM, Otto Kekäläinen <o...@sange.fi> wrote:
>> Hello,
>>
>> You website states that bugs reports should be sent to this list
>> (http://www.sqlite.org/src/wiki?name=Bug+Reports).
>>
>> **
>> Bug report: unhelpful error message when directory permissions are wrong
>>
>> Steps to reproduce:
>> 1. Make new database in the directory /var/database/ with root permissions.
>> 2. Change file ower to normal user
>> 3. Try to open database and make changes to it as the normal user
>>
>> What happends:
>> There is the error message "sqlite: Unable to open database file"
>>
>> What was expected:
>> The error message: "sqlite: Unable to write to database due to file or
>> folder permissions"
>>
>> I just spent several hours trying to debug a PySqlite app which gave
>> the "unable to open database file" error. Finally I found that in
>> order to write to the database, Sqlite for some reason needs to have
>> write permissions to the _folder_ the file resides in.
>>
>> Please change the error message to be more descriptive so that others
>> could save time debugging the issue. You can find on Google tons of
>> people wondering about this error, but few will ever find the
>> solutions. Fixing the error message would solve it.
>> **
>>
>> --
>> Otto Kekäläinen
>> www.sange.fi
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to