[ 
https://issues.apache.org/jira/browse/COUCHDB-966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Filipe Manana updated COUCHDB-966:
----------------------------------

    Attachment: COUCHDB-966.patch

Here's a patch that returns an explicit error when trying to access a file for 
which there's no read and/or write permission:

Your configuration use case:

$ curl -H 'X-Couch-Persist: true' -X PUT 
http://localhost:5984/_config/couchdb/delayed_commits -d '"false"'
{"error":"file_permission_error","reason":"/home/fdmanana/git/hub/couchdb/etc/couchdb/local_dev.ini"}

For a database file for which we don't have read permission:

$ curl http://localhost:5984/abc
{"error":"file_permission_error","reason":"/home/fdmanana/git/hub/couchdb/tmp/lib/abc.couch"}


At startup when the user has no access to one of the critical files (log file, 
config files, _users database, etc):

Apache CouchDB 1.2.0aac02c7b-git (LogLevel=info) is starting.

=CRASH REPORT==== 6-Jan-2011::12:41:28 ===
  crasher:
    initial call: couch_event_sup:init/1
    pid: <0.80.0>
    registered_name: []
    exception exit: {file_permission_error,
                        "/home/fdmanana/git/hub/couchdb/tmp/log/couch.log"}
      in function  gen_server:init_it/6
    ancestors: [couch_primary_services,couch_server_sup,<0.32.0>]


If nobody raise an objection, I'll commit it to trunk.

> Error log contents when the config files are not writable are not helpful
> -------------------------------------------------------------------------
>
>                 Key: COUCHDB-966
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-966
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 1.0
>         Environment: Any
>            Reporter: MC Brown
>            Priority: Minor
>         Attachments: COUCHDB-966.patch
>
>
> If you try to update the configuration settings, either through the API or 
> Futon, but the underlying configuration files are not writable by the CouchDB 
> process, the API response is '500', and the Futon response is just to appear 
> to have frozen. 
> Checking the log, you get this output: 
> [Thu, 25 Nov 2010 12:51:45 GMT] [error] [<0.31700.81>] ** Generic server 
> couch_config terminating 
> ** Last message in was {set,"uuids","algorithm","random",true}
> ** When Server state == {config,[{<0.31726.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.31719.81>,#Fun<couch_config.3.18912695>},
>                                  {<0.31719.81>,#Fun<couch_config.3.18912695>},
>                                  {<0.31717.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.31715.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.31714.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.31714.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.31712.81>,#Fun<couch_config.3.18912695>},
>                                  {<0.31711.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.31709.81>,#Fun<couch_config.2.4103357>},
>                                  {false,#Fun<couch_server.3.123842465>},
>                                  {<0.31706.81>,#Fun<couch_config.3.18912695>},
>                                  {<0.31706.81>,#Fun<couch_config.2.4103357>},
>                                  {<0.6.0>,#Fun<couch_config.2.4103357>}],
>                                 "/etc/couchdb/local.ini"}
> ** Reason for termination == 
> ** {{badmatch,{error,eacces}},
>     [{couch_config_writer,save_to_file,2},
>      {couch_config,handle_call,3},
>      {gen_server,handle_msg,5},
>      {proc_lib,init_p_do_apply,3}]}
> [Thu, 25 Nov 2010 12:51:45 GMT] [error] [<0.31700.81>] {error_report,<0.32.0>,
>               {<0.31700.81>,crash_report,
>                [[{initial_call,{couch_config,init,['Argument__1']}},
>                  {pid,<0.31700.81>},
>                  {registered_name,couch_config},
>                  {error_info,{exit,{{badmatch,{error,eacces}},
>                                     [{couch_config_writer,save_to_file,2},
>                                      {couch_config,handle_call,3},
>                                      {gen_server,handle_msg,5},
>                                      {proc_lib,init_p_do_apply,3}]},
>                                    [{gen_server,terminate,6},
>                                     {proc_lib,init_p_do_apply,3}]}},
>                  {ancestors,[couch_server_sup,<0.33.0>]},
>                  {messages,[]},
>                  {links,[<0.79.0>]},
>                  {dictionary,[]},
>                  {trap_exit,false},
>                  {status,running},
>                  {heap_size,6765},
>                  {stack_size,24},
>                  {reductions,52930}],
>                 []]}}
> [Thu, 25 Nov 2010 12:51:45 GMT] [error] [<0.79.0>] {error_report,<0.32.0>,
>     {<0.79.0>,supervisor_report,
>      [{supervisor,{local,couch_server_sup}},
>       {errorContext,child_terminated},
>       {reason,
>           {{badmatch,{error,eacces}},
>            [{couch_config_writer,save_to_file,2},
>             {couch_config,handle_call,3},
>             {gen_server,handle_msg,5},
>             {proc_lib,init_p_do_apply,3}]}},
>       {offender,
>           [{pid,<0.31700.81>},
>            {name,couch_config},
>            {mfa,
>                {couch_server_sup,couch_config_start_link_wrapper,
>                    [["/etc/couchdb/default.ini","/etc/couchdb/local.ini",
>                      "/etc/couchdb/default.ini","/etc/couchdb/local.ini"],
>                     <0.78.0>]}},
>            {restart_type,permanent},
>            {shutdown,brutal_kill},
>            {child_type,worker}]}]}}
> [Thu, 25 Nov 2010 12:51:45 GMT] [error] [<0.31718.81>] Uncaught error in HTTP 
> request: {exit,
>                                  {{{badmatch,{error,eacces}},
>                                    [{couch_config_writer,save_to_file,2},
>                                     {couch_config,handle_call,3},
>                                     {gen_server,handle_msg,5},
>                                     {proc_lib,init_p_do_apply,3}]},
>                                   {gen_server,call,
>                                    [couch_config,
>                                     {set,"uuids","algorithm","random",
>                                      true}]}}}
> None of this nicely points out that it is simply a file permission issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to